How can I add descriptions to a category listing in Wordpress 2.1?
February 7, 2007 10:00 AM   Subscribe

WordPress 2.1 help: How can I add descriptions to a category page?

Using Wordpress 2.1, here's what I'm trying to do:

1. Publish a post to a selected category (easy)
2. Have the post automatically listed on the category page (easy)
3. Have a "sticky intro" at the top of the category page (don't know how)
4. Display a POST DESCRIPTION (or a 2-line excerpt from the post), rather than just a list of titles or the entire freakin' post, for each post in that category list.

Is there a plug-in I can install that will let me do this, or some code I can modify? Go easy on the techno-speak, I'm a designer, not a coder. Here's a text-only example of how I'd like the page to end up (or something close to this):
-----------------------------

Category Page Title

This is a welcome message that stays at the top all the time, explaining the page to new visitors. The rest of the page will be descending chronological summary of posts in this category, that looks a little bit like this:

[horizontal divide]
Linked post title * Date
# Comments * Posted in Category by Author
Brief description of what this post is about, or a two-line excerpt from the post itself. Brief description of what this post is about, or...
[horizontal divide]

[another box just like above]

-----------------------------

Does anybody around here have any ideas? I know I should be asking the WordPress help forum (and I have), but you guys are smart, too. Any help would be appreciated. Bonus points if the solution looks nice and is easy to create.
posted by Milkman Dan to Computers & Internet (6 answers total) 1 user marked this as a favorite
 
The adhesive plugin (currently offline but available on this page will take care of the "sticky intro". Just post the intro as an, er, post in that category and mark it sticky.
posted by doublesix at 10:13 AM on February 7, 2007


I haven't actually tried this but doesn't the optional extract (below uploads) do the rest of what you need? Oh, and please add a ')' to my post above.
posted by doublesix at 10:14 AM on February 7, 2007


Response by poster: Doublesix: Thanks for the tip on Adhesive. I'll check that out.

Regarding the excerpt function, that doesn't seem to work. Even with text inputted into the excerpt box, category pages still display the whole posts, rather than just the excerpt, and I couldn't find any settings to change to indicate it should be displaying just excerpts.

Any other ideas?
posted by Milkman Dan at 11:30 AM on February 7, 2007


I've used the Condensed Content-plugin for this. Though I made sure it only shows the results of searches condensed, on my weblogs.
posted by ijsbrand at 12:32 PM on February 7, 2007


If the category description is sufficient for the 'sticky intro', putting category_description() into the template should do the trick.

To display excerpts instead of full posts, simply edit the template to use the_excerpt() instead of the_content()
posted by malevolent at 12:29 AM on February 8, 2007


malevolent is right, there is built-in WP code to do this — you don't need a plug-in, and I'd think it would be harder to configure that for each category than simply filling in the cat descriptions for each category.

In your dashboard, go to Manage -> Categories -> then select edit for whatever category you want to add a description to. Fill in the description box.

Then, go to Presentation -> Theme Editor -> and select the page for your theme where the categories are (probably Archives or maybe Category or perhaps just Page Template). There will be several "if" statements — this is the Wordpress Loop. Find the one that mentions categories, and then slip this code in: php echo category_description().

My code is in the archive.php file, and looks like this:

< code>?php /* If this is a category archive */ if (is_category()) { ?>
< code>?php echo single_cat_title(); ?> < code>?php _e('Archives','bnTiny'); ?>
< code>p class="description">< code>?php echo category_description(); ?>
This means that if a single category is displayed, the code then searches for the description for that one cat. You can modify the CSS for p class=description to get the other effects you want (such as the horizontal divide, or whatever).

More info here and you can see examples by clicking on my category links.
posted by Brittanie at 12:49 AM on February 8, 2007


« Older How to record a sing-along choir track without a...   |   Gift For Li'l Landlord? Newer »
This thread is closed to new comments.