[resolved] Twentyeleven child-issue with thumbnail size on custom post type (3 posts)

  1. jrelgin
    Posted 4 years ago #

    I have created a child theme of twentyeleven and I am having issues with a custom post type's thumbnails being created with the dimensions of 1000px X 288px. I know that this is the image size in the custom header function of the parent. I have added the following to my child function.php:

    if ( function_exists( 'add_theme_support' ) ) {
        add_theme_support( 'post-thumbnails' );
        set_post_thumbnail_size( 280, 210, true ); // Normal post thumbnails
        add_image_size( 'screen-shot', 720, 540 ); // Full size screen

    My custom post type is being looped in a custom page template. I've also created a pastebin here:

    Any help is much appreciated!

  2. keesiemeijer
    Posted 4 years ago #

    Let the parent theme set the default post thumbnail size (for the custom header function) and just add a new post thumbnail size in your child theme's functions.php:

    add_image_size( 'new-size', 280, 210, true ); // new post thumbnail size

    If you're on 3.4.1 you don't have to check if the add_theme_support function exists.

    Now in your custom template change this:

    <?php the_post_thumbnail(); ?>

    to this:

    <?php the_post_thumbnail('new-size'); ?>


    sometimes you need to re-genarate your (old) post thumbnails to have the new image size take effect: http://wordpress.org/extend/plugins/regenerate-thumbnails/

    Only do this after a full backup (images and database)

  3. jrelgin
    Posted 4 years ago #

    Thank you so much keesiemeijer!

    That is a much more elegant solution and way less obtrusive than what I was trying.

    Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Topic