Support » Themes and Templates » the_post_thumbnail doesn't work in category.php (but does work in index.php)

Viewing 4 replies - 1 through 4 (of 4 total)
  • most of the posts don’t seem to have thumbnails (featured images);

    otherwise, for instance, there is no difference in display of the ‘new size test post’ between /arts/ or /all stories/

    Hi alchymyth, thanks for the repsonse!

    “New Test Post” is the only “arts” post that has a thumbnail.

    I actually just made a change and it works, but not in a way that I can explain. I looked at the template hierarchy and removed all the category and archive templates and just had it roll down to use index.php. When the categories use index.php it works, but not when it was using category.php.

    http://codex.wordpress.org/Category_Templates

    Weird, but it works. I’d like to know why it works here but not in category.php if anyone has any ideas?

    I made a loop-category.php
    and added to this part:

    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
    			<div class="entry-summary">
    		<?php the_post_thumbnail('category-post-thumbnail'); ?>
    			<?php the_excerpt(); ?>
    			</div><!-- .entry-summary -->

    <?php the_post_thumbnail(‘category-post-thumbnail’); ?>

    I did that for
    loop-tag
    loop-archive
    loop-search

    so that the featured post thumbnail would show up.

    Oh and in functions something like this:

    // This theme uses post thumbnails
    	add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 100, 160 ); //  box resize mode
    add_image_size( 'category-post-thumbnail', 100, 160 );
    add_image_size( 'archive-post-thumbnail', 100, 160 );
    add_image_size( 'search-post-thumbnail', 100, 160 );
    add_image_size( 'tag-post-thumbnail', 100, 160 );
    add_image_size( 'page-post-thumbnail', 100, 160 );
    add_image_size( 'front-page-post-thumbnail', 100, 160 );
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘the_post_thumbnail doesn't work in category.php (but does work in index.php)’ is closed to new replies.