• Resolved nzguyyy

    (@nzguyyy)


    I am trying to create a new thumbnail size to use on a specific category page as I want it to take up the full 400pixels width.

    In my function.php file I have added this:

    `if ( function_exists( ‘add_theme_support’ ) ) {

    add_theme_support( ‘post-thumbnails’ );
    add_image_size( ‘category-thumb’, 300, 9999 );

    }’

    and then on my category-new-zealand-tours.php file I added this:

    <?php
    if ( has_post_thumbnail() ) {
    the_post_thumbnail( ‘category-thumb’ );
    }
    ?>

    but it doesn’t seem to work. Any ideas what I’m doing wrong? Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter nzguyyy

    (@nzguyyy)

    Fixed

    Please share your solution. Thx ??

    Thread Starter nzguyyy

    (@nzguyyy)

    Hi Bassilner

    In the functions.php file this needs to be added:

    f ( function_exists( 'add_theme_support' ) ) {
    
    add_theme_support( 'post-thumbnails' );
    add_image_size( 'whatever-you-want-to-name-it', 300, 9999 );
    
    }

    This creates a new thumbnail size each time you add a featured image. In this particular instance, it is 300 pixels wide with no limit on its height.

    Then, on my category page I added the following:

    <?php if(has_post_thumbnail()) : ?>
    
    				<div class="image-wrap">
    
    				<a href="<?php the_permalink();?>" title="<?php the_title();?>">
    
    					<?php the_post_thumbnail( 'whatever-you-want-to-name-it' ); ?>
    
    				</a>
    
    				</div>
    
    			<?php endif; ?>

    Hi nzguyyy,

    thanks a lot. I will try that.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding new thumbnail size’ is closed to new replies.