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.
Daniel
Short, sweet and to the point… just what I needed.
Great to see the code displayed with easy steps for the php phibic like me!
Thanks for being the brains trust!
Thank you for posting this!!!
That code did not come through correct:
Nevermind, got it. Simply place the below code after the excerpt code:
Is there a way to include the read more link dave was talking about on excerpts without fuddling about with the tag?
Thank you very much for sharing
Thanks for your guides
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.
Thanks! Tip worked like a charm.
oops forgot to list the plugin for whoever might be interested…
http://guff.szub.net/2005/02/26/the_excerpt-reloaded/
never mind…. i just found this really great plugin which does everything i want and more!
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
prevedburzhuy
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.
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?
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.
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
Sweet Hack! I really hate to see long posts in archives. I use a plugin called Evenmore, which does this automatically
Excerpts are a great practice. Here’s a good article on them:
Rory, lets chat via Skype, the file must be there somewhere otherwise the category pages would not be loading hehe.
I hit a roadblock straight away – I don’t have an archives.php!
Very nice tip Daniel .
I voted for Problogger.net myself, so no big deal
Brilliant. Thank you for this.