• I can get add_image_size to work with my thumbnails on by posts if I post the images individually.

    However add_image_size doesn’t seem to work with the wp built in [gallery] thumbnails. The only thing that seems to control the thumbnails is the ‘thumbnail’ section of the ‘media’ tab in the wp-admin area.

    Am I doing somehting wrong or is it that you cant control the gallery thumbnails with add_iamge_size.

    Also I don’t want to use plugins.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The [gallery] uses the thumbnail image size by default.

    You have two options:

    1) pass a “size” argument to the shortcode

    2) change the dimensions of the thumbnail image size, using set_post_thumbnail_size() in functions.php:

    https://codex.www.ads-software.com/Function_Reference/set_post_thumbnail_size

    (Note: if you change the default thumbnail size, you will have to regenerate thumbnails for any existing attachment images. There are a few Plugins for this purpose in the Repository.)

    Thread Starter samput

    (@samput)

    I have tried this: (and been using a regenerate-thumbnails plugin)

    —–
    //functions.php

    add_theme_support( ‘post-thumbnails’ );
    set_post_thumbnail_size(300, 9999);

    add_image_size(‘my-custom-thumbnail’, 610, 9999);

    —–
    // page-gallery.php

    the_post_thumbnail(‘my-custom-thumbnail’);

    —–

    But it doesn’t seem to take effect.

    Does the gallery only register ‘set_post_thumbnail_size’?

    I have successfully created an add_image_size for my gallery thumbnails, but it seems to only work for the first thumbnail only. The first thumbnail gets the cropped size and all other images get the resized version.

    Here is the code: https://pastebin.com/VLkdLLCN

    Any ideas why?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘add_image_size wp [gallery] thumbnails’ is closed to new replies.