• Hi! I would like to know how can I establish two different sizes for featured images in both posts and pages.

    I put the following code on function.php and it works perfect for post images. From the single.php i called with <?php the_post_thumbnail( ‘single-post-thumbnail’ ); ?>

    //Enable Post Thumnails
    add_theme_support( ‘post-thumbnails’ );
    //thumnail size
    set_post_thumbnail_size( 121, 91 ); // 50 pixels wide by 50 pixels tall, box resize mode
    //original size for the single
    add_image_size( ‘single-post-thumbnail’, 500, 374 ); // Permalink thumbnail size

    But for the pages images i would like to use a diffrent size, 162×374. For that I duplicate the code as follow and change the ‘names’, but apparently it doesn’t work like that. In addition the duplicated code disables the first one.

    //Enable Post Thumnails
    add_theme_support( ‘page-thumbnails’ );
    //thumnail size
    set_post_thumbnail_size( 121, 91 ); // 50 pixels wide by 50 pixels tall, box resize mode
    //original size for the pages
    add_image_size( ‘page-thumbnail’, 162, 374 ); // Permalink thumbnail size

    Hopefully someone can help me.
    Thanks!!
    Carla

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try putting this near the top of your theme’s page.php file. Put it somewhere before the WordPress loop.

    If you put it in a block of already existing PHP code take off the beginning and ending PHP tags from this line of code

    <?php set_post_thumbnail_size( 162, 374); ?>

    @stvwlf Your suggestion worked for me. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘different size for featured images in post and pages’ is closed to new replies.