How to make category pages display post excerpts
Category pages, just like search results or archives, are usually used for navigation purposes. Considering this fact it would make no sense to display full posts on those pages since the reader needs to be able to skim through a larger number of posts to decide what he wants to read.
If your Wordpress theme is currently displaying full posts on the category or archive pages below you will find how to change it, showing only the post excerpts or even the post titles.
First of all you need to locate the file inside your theme folder that is managing the category, archives and search pages. Most Wordpress themes have that information inside the archive.php or archives.php file.
The file will look more or less like this:
<?php if (is_category()) { ?>
<h2 class='archives'>Archive for the '<?php echo single_cat_title(); ?>' Category</h2>
<?php }
elseif (is_day()) { ?>
<h2 class='archives'>Archive for <?php the_time('F jS, Y'); ?></h2>
Once you find the file you will need to find where the Loop starts, usually with the following line:
<?php while (have_posts()) : the_post(); ?>
The information contained inside the Loop will govern the structure of the posts inside the mentioned pages (categories, archives, search results and so on). A couple of lines after the beginning of the Loop you will find the argument that includes the full posts on those pages:
<?php the_content(__('Read more »'));?>
In order to display the post excerpts you will need to substitute that line with the following:
<?php the_excerpt() ?>
If you want to display only the post titles (should be considered if you have a large number of posts on every category or on the archives) you can just eliminate that line altogether.
Finally, you may also want to remove the meta data (author, date or comments information) from those pages, which should be listed right after the post title or after the content line.
Don't want to miss a single tip?
Subscribe to our RSS Feed!
Related Articles
Bookmark
22 Responses to “How to make category pages display post excerpts”
- Instalación de un Blog: 40 Tips Practicos
- 40 de sfaturi despre cum să îţi faci un blog | CNET.ro
- Blog updates and a few quick SEO tips
- 建博40个实用技巧 | 精品博客
- Setting up Blog for the first time in WordPress??? Need a Step by Step Guide ?? No Problem.. have a look at the given resource at DailyBlogTips | Rahul's Blog












Brilliant. Thank you for this.
I wish I could convey how hard I’m kicking myself for not voting for you in those recent Web Awards. I didn’t vote for anyone, but I’m cursing now!
I voted for Problogger.net myself, so no big deal
Very nice tip Daniel .
I hit a roadblock straight away - I don’t have an archives.php!
I have it in my themes folder, but it is not available on the Presentation page. Is it because I removed it from my sidebar?
My (hidden) archives.php reads:
Archives
By month:
By category:
But I’m not sure if I edit that it will make any difference.
Rory, lets chat via Skype, the file must be there somewhere otherwise the category pages would not be loading hehe.
Excerpts are a great practice. Here’s a good article on them:
http://www.pearsonified.com/20.....y-step.php
One thing I’ve noticed is that if you’re using a feedburner feed with summaries it’ll use your excerpt instead of just cutting off the first 200 characters or so.
Sweet Hack! I really hate to see long posts in archives. I use a plugin called Evenmore, which does this automatically
Daniel, you should mention that a category.php in the theme is the best way to create the category pages. Alternatively, you can use the (is_category()) and if true display the_excerpt otherwise do the_content
Excellent info. I found myself in the same boat as Rory in that the theme I use (Burvy from GFX) did not have separate calls for archives and categories. I’m not an expert, but it seems my theme uses the same post output whether it is single post, archive, or category selected. I tried to carve out an excerpt call in the index.php just for category pages with the info you give but I couldn’t get it to work.
I was curious if a workaround was discovered for these situations when you worked with Rory?
Rich, at the very least I think your theme has on call for single posts and one for archives, categories and search results, could it be?
If that is not in place you will need to create those manually on the theme files. Just check some themes that use that structure and replicate it.
Glad I use Textpattern so I never have to deal with an issue like this where you actually have to know some php to do such a simple thing.
prevedburzhuy
Just a quick question….. how do you change the [...] at the end of the excerpt to “read more” or “see more” or anything instead of [...] ?
dave
never mind…. i just found this really great plugin which does everything i want and more!
oops forgot to list the plugin for whoever might be interested…
http://guff.szub.net/2005/02/2.....-reloaded/
the only thing is you need to get into code a wee bit…..
Thanks! Tip worked like a charm.
Oh my god, THANK YOU!!! I was told I have to install a plugin and fiddle with this and that, but no! I don’t! Thank you SO much for the simple instructions, you rock.