add_image_size + wp [gallery] thumbnails (4 posts)

  1. samput
    Posted 5 years ago #

    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.

  2. Chip Bennett
    Theme Review Admin
    Posted 5 years ago #

    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:


    (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.)

  3. samput
    Posted 5 years ago #

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


    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size(300, 9999);

    add_image_size('my-custom-thumbnail', 610, 9999);

    // page-gallery.php



    But it doesn't seem to take effect.

    Does the gallery only register 'set_post_thumbnail_size'?

  4. katart17
    Posted 5 years ago #

    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: http://pastebin.com/VLkdLLCN

    Any ideas why?

Topic Closed

This topic has been closed to new replies.

About this Topic