Changing Category Page Formatting in Pilcrow Theme

No Comments

A WordPress user on Reddit asked, “I’d like for category links to show the full content of articles instead of just excerpts. google isn’t helping“.  The answer lays in the loop.php file of the theme.  Around line 66 in version 1.0 of the theme there are a series of if/else statements which define how to format the Archive, Search and Default layout.  Category is not specifically defined, so WordPress treats it as a Category per the template hierarchy.

By replacing the default code:

 

<?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?> <div> <?php the_excerpt(); ?> </div><!– .entry-summary –> <?php else : ?> <div> <?php the_content( __( ‘Continue reading <span>&rarr;</span>’, ‘pilcrow’ ) ); ?> <?php wp_link_pages( array( ‘before’ => ‘<div>’ . __( ‘Pages:’, ‘pilcrow’ ), ‘after’ => ‘</div>’ ) ); ?> </div><!– .entry-content –> <?php endif; ?>

With the following:

<?php if ( is_category() ) : // Dispaly the content for Categories ?> <div> <?php the_content(); ?> </div><!– .entry-summary –> <?php elseif ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?> <div> <?php the_excerpt(); ?> </div><!– .entry-summary –> <?php else : ?> <div> <?php the_content( __( ‘Continue reading <span>&rarr;</span>’, ‘pilcrow’ ) ); ?> <?php wp_link_pages( array( ‘before’ => ‘<div>’ . __( ‘Pages:’, ‘pilcrow’ ), ‘after’ => ‘</div>’ ) ); ?> </div><!– .entry-content –> <?php endif; ?>

All Category pages will now more closely resemble the Default page layout seen on the home page of the theme.  If you only need this change for one specific category, you can specify by Category ID or Slug like so:

<?php if ( is_category(’10’) ) :

Where 10 is a ID of the Category you wish to alter.

I'm the front-man of It's WordPress. I come from a diverse array of backgrounds, enjoying the opportunity to expand my knowledge base and skill set by re-inventing myself. I enjoy environments that focus on emerging information, technology and concepts. I put on the technical hat in my early 20s and never really looked back. I'm love technology and the internet, as well as the outdoors and avidly hike, kayak and camp every chance I get.

About Us

We can take you from concept, through design, development and deployment in one seamless process. Whether you choose a self-managed web site or need a continuing support relationship; we've got you covered.

Click to edit this heading

Request Consulation

Ready to transform your vision into a reality? Just looking to see what it takes to get the ball rolling. Tell us about your project and we can help. No spam. No obligation. Just answers.

More from our blog

See all posts

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.