• In my functions.php, I have:

    function theme_setup(){
      // Featured Image Support
      add_theme_support('post-thumbnails');
    
      //set_post_thumbnail_size(900, 600);
    
      // Post Format Support
      add_theme_support('post-formats', array('gallery'));
    }
    
    add_action('after_setup_theme', 'theme_setup');

    You see I commented out the line:
    //set_post_thumbnail_size(900, 600);
    I did that because with this line images could not be loaded in a gallery post. An error message is displayed.

    Now I can upload images, but then in content-gallery.php, using this line:
    <?php echo get_the_post_thumbnail($id, 'large', $attr); ?
    there is no image displayed.

    Two questions:
    – what could be the cause that set_post_thumbnail_size(900, 600); gives an error, and what could be done about it?
    – why is <?php echo get_the_post_thumbnail($id, 'large', $attr); ? not displaying?

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter kwibus

    (@kwibus)

    Edit:

    Forget about the second question; the image is displayed. It was my mistake, the featured image was not set.

    Moderator bcworkz

    (@bcworkz)

    I’m not sure, but I seem to recall there being an upper limit for the built in “post-thumbnail” sized image. 900×600 is quite large for the typical thumbnail size used by most themes. This is the actual thumbnail size “thumbnail” we are talking about here, not the featured image post “thumbnail”. Ambiguous and confusing? Sadly true, but that is the way it is. Try to remember that image sizes and featured images are not directly related. A featured image can be any size needed.

    If you want to display 900×600 images, featured or not, assign your own name to the size and specify that name when getting images. (using add_image_size() to assign your name)

    Thread Starter kwibus

    (@kwibus)

    It was not my own idea to set the size to 900 x 600. Actually it was in a course I follow.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘set_post_thumbnail_size’ is closed to new replies.