Ive been looking for a way of adding a piece of static content at the top of each category in a wordpress archive. The problem with wordpress is that there is too much content curn on any given category page, so as a result the search engines don’t know what content to hang from when it comes to keywords. Its been a pain in the ass finding a decent solution this, so im sharing with you now !
ref this page for the original advice : http://codex.wordpress.org/Category_Templates and go half way down the page for this.
Instructions : (wordpress version 2.1)
in the Archive template just above…
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
Use this code
<?php if ( $paged < 2 ) { // Do stuff specific to first page?>
<?php if ( is_category() ) : ?>
<h2 id=”category-name-header”><?php echo $cache_categories[$cat]->cat_name ?></h2>
<?php add_filter(‘category_description’, ‘wpautop’); ?>
<?php add_filter(‘category_description’, ‘wptexturize’); ?>
<div id=”category-description”>
<?php echo category_description(); ?>
</div>
<?php endif; ?>
<?php } else { // Do stuff specific to non-first page ?>
<?php } ?>
To be able to use HTML go to :
wp-admin/admin-db.php
and edit out
//$category_description = apply_filters(‘pre_category_description’, $category_description);
As I have done
then go into your category editor and edit whatever category you like and add the relevant HTML into the description and save
and now you have fixed content for a linked to category page !
Nice
Related posts:


0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Please Leave a Comment