• Resolved wrimomatt

    (@wrimomatt)


    working on a child theme with already established custom thumbnail sizes

    added these to functions.php

    add_image_size( 'portfolio-small', 300, 300, true );
    add_image_size( 'portfolio-big', 610, 300, true );

    call them like this on the template:

    <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'portfolio-small' ); } ?>
    <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'portfolio-big' ); } ?>

    but they don’t fill the div. they scale to the width and leave a bunch of white space.
    I regenerated thumbnails, took off featured image and reuploaded, tried “false” instead of true

    my code on another site was lifted directly from the codex and looks like this for my functions.php:

    if ( function_exists( 'add_theme_support' ) ) {
    	add_theme_support( 'post-thumbnails' );
            set_post_thumbnail_size( 150, 150 ); // default Post Thumbnail dimensions
    }
    
    if ( function_exists( 'add_image_size' ) ) {
    	add_image_size( 'gallery-thumb', 160, 140, true );
    	add_image_size( 'gallery-full', 9999, 400, true );
    }

    code in child’s theme I’m working with functions looked like this:

    // Add Thumbnail Sizes
    if ( function_exists( 'add_theme_support' ) ) {
    	add_image_size( 'slideshow', 960, 400, true );
    	add_image_size( 'item', 9999, 300 );
    }

    but the parent theme had:

    // Register post thumbnail support
    if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
    	add_theme_support( 'post-thumbnails' );
    }

    I tried adding my new sizes, tried subbing in the codex code I got to work on another site, tried everything.

    Any ideas?

Viewing 1 replies (of 1 total)
  • Thread Starter wrimomatt

    (@wrimomatt)

    If anyone else ever has this problem: you have to regenerate thumbnails after you add a new custom size.

Viewing 1 replies (of 1 total)
  • The topic ‘custom thumbnail sizes not working’ is closed to new replies.