-
AuthorPosts
-
July 26, 2023 at 7:27 pm #1414558
I’m building a new website on Enfold, see link in private for the dev/test site.
I have changed the Featured Image size in my child theme:
/* Reduce featured image size on single post */ #top.single-post .big-preview { max-width: 600px !important; margin: 0 auto;}
I upload images at 2000 x 1500 px and use Simple Image Sizes to create the sizes I need and also use the
function ava_image_sizes() { remove_image_size('square'); etc etc
function to stop creating the theme sizes I don’t want.
One of my custom image sizes is called posts-FI, sized at 600 x 450 px, for use as the FI. But when I set the FI in the post, there is no selection available to choose the appropriate image size, so it is loading (I think) the original 2000 x 1500 px photo.
There’s an ‘img’ declaration that appears to confirm the 2000 x 1500 px photo is being loaded. But there’s a bunch of code preceding the ‘img’ stating ‘data-srcset’ that I thought was supposed to load the right sized image for the “container”. I confess to not understanding how this works.
Dev Tools tells me the “intrinsic size” of the image in that post is 2000 x 1500 px, which clearly I don’t want.
So… how can I get the 600 x 450 px loaded as the FI in a post, and not any of the larger images?
July 27, 2023 at 9:31 am #1414630Hey zimbo,
Thank you for the inquiry.
Instead of creating a new thumbnail, you can use the avf_modify_thumb_size filter to modify the size of existing thumbnails. This way, you will be able to select the desired thumbnail and make adjustments accordingly. For instance, to resize the “portfolio” thumbnail, you can add the following code:
add_filter( 'avf_modify_thumb_size', 'avf_modify_thumb_size_mod', 10, 1 ); function avf_modify_thumb_size_mod( $size ) { $size['portfolio'] = array('width'=> 600, 'height'=>450); return $size; }
You may need to regenerate the thumbnails after adding the filter.
// https://wordpress.org/plugins/regenerate-thumbnails/
Best regards,
IsmaelJuly 27, 2023 at 3:20 pm #1414683I decided to alter the default Medium size (300 x 300) using the function because I use Portfolio, which works. Medium is now 600 x 450 px.
But the issue remains that when setting a Featured Image in the Post there is no selection available to choose the Medium size – Add A New Post / Featured Image only allows the full sized image to be chosen, nothing else.
How do I set the altered Medium size as the FI?
July 28, 2023 at 9:26 am #1414732Hi,
Thank you for the update.
You cannot pick a specific size when selecting a featured image, but you can define which thumbnails to display by editing the templates. For example, on the single post page, you can modify the includes > loop-index.php file around line 92 and define a different thumbnail size.
/* * retrieve slider, title and content for this post,... */ $size = strpos( $blog_style, 'big' ) ? ( ( strpos( $current_post['post_layout'], 'sidebar' ) !== false ) ? 'entry_with_sidebar' : 'entry_without_sidebar' ) : 'square';
The code above will display the “entry_with_sidebar” or the “entry_without_sidebar” thumbnails depending on the layout of the page, whether it has a sidebar or not.
Best regards,
IsmaelJuly 28, 2023 at 12:59 pm #1414749Is it possible to make such a change to loop-index.php via a child theme?
July 31, 2023 at 3:09 am #1414987 -
AuthorPosts
- You must be logged in to reply to this topic.