
-
AuthorPosts
-
April 7, 2025 at 1:05 pm #1480927
Hi,
I registered a custom image size adding following code to functions.php:function add_custom_image_size() { add_image_size( 'medium_squared', 600, 600, true ); // true = crop esatto } add_action( 'init', 'add_custom_image_size' ); function add_custom_image_sizes_to_editor( $sizes ) { return array_merge( $sizes, array( 'medium_squared' => __( 'Medium squared' ), ) ); } add_filter( 'image_size_names_choose', 'add_custom_image_sizes_to_editor' );
Now I can see and use my new image size in Wp:
But i can’t see it in Enfold ALB elemnts dropdowns:
Any help?
Thank youApril 8, 2025 at 5:40 am #1480970Hey aledef,
Thank you for the inquiry.
You have to add the image size using the avf_modify_selectable_image_sizes filter.
Example:
function avf_modify_selectable_image_sizes_mod( array $selectableImgSize, array $imgSizes ) { $selectableImgSize['medium_squared'] = 'Medium squared'; return $selectableImgSize; } add_filter( 'avf_modify_selectable_image_sizes', 'avf_modify_selectable_image_sizes_mod', 10, 2 );
Let us know if this works.
Best regards,
IsmaelApril 10, 2025 at 3:07 pm #1481136Hi Ismael,
it works but I had to make a little change to my code.Here is the full working code to add custom image sizes to WP and enable them in Enfold ALB, in case anybody needs it:
// Add image sizes to WP function add_custom_image_size() { // add_image_size( 'name', width, height, crop ); add_image_size( 'medium_squared', 600, 600, true ); } add_action( 'after_setup_theme', 'add_custom_image_size' ); // Make custom image sizes selectable from WP admin function add_custom_image_sizes_to_editor( $sizes ) { return array_merge( $sizes, array( 'medium_squared' => 'Medium squared', ) ); } add_filter( 'image_size_names_choose', 'add_custom_image_sizes_to_editor' ); // Make custom image sizes selectable from Enfold ALB elements function add_custom_image_sizes_to_enfold_alb( array $selectableImgSize, array $imgSizes ) { $selectableImgSize['medium_squared'] = 'Medium squared'; return $selectableImgSize; } add_filter( 'avf_modify_selectable_image_sizes', 'add_custom_image_sizes_to_enfold_alb', 10, 2 );
Thanks
Best regards,
AlessioApril 10, 2025 at 7:37 pm #1481146Hi,
Great, I’m glad that you found a solution and thanks for sharing. Please let us know if you should need any further help on the topic, or if we can close it.
Best regards,
RikardApril 11, 2025 at 10:43 am #1481186Hi,
you can close the topic.Best regards,
Alessio -
AuthorPosts
- The topic ‘Add custom image size to enfold ALB elements’ is closed to new replies.