How do I make the category template display full posts instead of partial posts?

I’m using WordPress 3.0.1 with the Twenty Ten theme. I’m trying to change the way the posts in the Category view are displayed (i.e. by going to a url like mywebsite.com/category/mycategory). Currently the posts in the Category view just show the first part of a post, but I’d like to change that so it shows the whole thing.

In the Category Template (category.php) file, there are a few lines of code that look like they are responsible for generating the category data:

/* Run the loop for the category page to output the posts.
 * If you want to overload this in a child theme then include a file
 * called loop-category.php and that will be used instead.
 */
get_template_part( 'loop', 'category' );
?>

Since the comments mention setting up a child theme, I went ahead and followed these instructions (via this answer) to set up a child theme so I could add my custom functionality.

I see from the comments that I’m supposed to create a file called loop-category.php with my custom implementation, but I don’t know what code I need to put in that file. What do I need to add to loop-category.php to get Category views to show up with full blog posts?

NOTE: While I’ve been using WordPress for quite a while, this is my first dive into theme customization. Any help would be much appreciated.

2 Answers
2

@Ben,

If you look at line 132 of loop.php in Twentyten you will find the conditional statement that is telling WordPress to only display the_excerpt on category archives. Right below that after <?php else : ?> is how all posts that are not on an archive page, in the asides category or in the gallery category will be displayed. (The asides and gallery categories are targeted at the beginning of loop.php)

<?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
            <div class="entry-summary">
                <?php the_excerpt(); ?>
            </div><!-- .entry-summary -->
    <?php else : ?>
            <div class="entry-content">
                <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
                <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
            </div><!-- .entry-content -->
    <?php endif; ?>

In your loop-category.php file the easiest thing to do would be copy and paste the whole loop.php file and change the section of code above to:

<?php if ( is_search() ) : // Only display excerpts for archives and search. ?>
            <div class="entry-summary">
                <?php the_excerpt(); ?>
            </div><!-- .entry-summary -->
    <?php else : ?>
            <div class="entry-content">
                <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
                <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
            </div><!-- .entry-content -->
    <?php endif; ?>

You will notice that we only removed is_archive from the conditional statement so now category archives will displayed using the code after the else statement which contains the_content as opposed to the_excerpt.

Leave a Comment