Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1463329

    Hi,
    I have my blog thumbnail size set as 200 pixels width x 300 pixels height in WordPress > Settings > Media Settings.
    However I cannot for the life of me manage to get my website to display this size thumbnails for blog posts. Instead it is displaying either much smaller or much larger thumbnails. See https://guardingtheguards.com/category/library/garda-review/

    I have also tried editing my blog page to show 5 across and the correct thumbnail size here:
    Screenshot-2024-07-30-130728
    This is also having no impact.

    I would appreciate any help as to how I can get my website to display thumbnails of 200×300.

    Many thanks

    • This topic was modified 3 months, 3 weeks ago by lucybb2.
    • This topic was modified 3 months, 3 weeks ago by lucybb2.
    #1463397

    Hey lucybb2,

    Thank you for the inquiry.

    Looks like you’re trying to adjust the size of the thumbnails on the archive or category pages. This cannot be adjusted in the Settings > Media panel. You have to edit the archive.php file directly or use this filter in the functions.php file:

    add_filter("avf_post_slider_args", function($atts, $context) {
      if( $context == "archive" ) {
        $atts['type']  = 'grid'; 
        $atts['columns']  = 4;
        $atts['preview_mode'] = 'custom';
        $atts['image_size'] = 'medium';
      }
      return $atts;
    }, 10, 2);

    The filter above will set the image size to Medium. Also, when you change the size of the thumbnails, you need to either upload the images again or regenerate the thumbnails.

    // https://wordpress.org/plugins/regenerate-thumbnails-advanced/
    // https://wordpress.org/plugins/force-regenerate-thumbnails/

    Best regards,
    Ismael

    #1463445

    Thank you.

    Is there maybe a typo in this code snippit. I’m only getting errors if I add it to functions.php, like
    Your PHP code changes were not applied due to an error on line 14 of file wp-content/themes/enfold-child/functions.php. Please fix and try saving again.

    syntax error, unexpected token “}”

    #1463488

    Hi,

    I’m only getting errors if I add it to functions.php, like

    Sorry about that. We adjusted the code a bit. Please try it again:

    add_filter("avf_post_slider_args", function($atts, $context) {
        if ($context == "archive") {
            $atts['type'] = 'grid'; 
            $atts['columns'] = 4;
            $atts['preview_mode'] = 'custom';
            $atts['image_size'] = 'medium';
        }
        return $atts;
    }, 10, 2);
    

    Best regards,
    Ismael

    #1463507

    Yes. This worked. Thank you very much. I really appreciate the high quality of support you guys offer :)

    #1463517

    Hi,

    Thanks for the update. Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

    #1463531

    No more help need with this issue. Thank you.

    #1463572

    Hi,

    Great! Please feel free to open another thread if you have more questions.

    Have a nice day.

    Best regards,
    Ismael

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Blog Thumbnail Size’ is closed to new replies.