Skip to main content

Modifying The Wordpress Thesis Themes Custom Categories Further

in

Most Blogging software creates categories, yet most people want to change the text that appears at the top from the ugly "From The Category Archives" to something different.

The Wordpress Thesis Theme is no different and in my research I found there are a few different ways to accomplish this.

I started looking into accomplishing this after modifying one of my Drupal sites in a similar manner.

I found, Rae Hoffman's site Sugarrae.com in my research and she had already outlined what needed to be done. Yet, in the examples I found the SEO issue I've always seen with database driven sites.

Below is the custom code that Rae had come up with, and it does work great. Yet, like anyone who likes to tinker I had to make a few modifications for better SEO purposes.

/* Custom Categories */
function custom_archive_info() {
if (is_category('apples')) {
?>
<div class="post_box top intro_block">
<div class="headline_area">
<h1><?php single_cat_title(); ?></h1>
</div>
<div class="format_text">
 
YOUR CUSTOM APPLES TEXT HERE</div>
</div>
<?php
}
elseif (is_category('oranges')) {
?>
<div class="post_box top intro_block">
<div class="headline_area">
<h1><?php single_cat_title(); ?></h1>
</div>
<div class="format_text">
 
YOUR CUSTOM ORANGES TEXT HERE</div>
</div>
<?php
}
else
thesis_default_archive_info();
}
remove_action('thesis_hook_archive_info', 'thesis_default_archive_info');
add_action('thesis_hook_archive_info', 'custom_archive_info');

What I found was that once you went to page two of any of your categories, you ended up with the same body of text that appeared on the main category page.

By changing the code to this:

if (is_category('insert-your-category-here') && !is_paged())

It eliminated the text from being displayed on page two, three, etc...

... But then it reverted back to the original ugly "From The Category Archive:" By adding this to the code:

elseif (is_category() && is_paged()) {
?&gt;
<div class="post_box top intro_block">
<div class="headline_area">
<div class="format_text">
 
<?php _e('Even More Great Posts on:', 'thesis'); ?></div>
<h1><?php single_cat_title(); ?></h1>
 
 
<hr /></div>
</div>
<?php
}

I was able to easily change what was displayed on page 2, 3 etc... Now instead of displaying "From the category archive:" I set mine to "Even More Great Posts On:"  While still not perfect it gets me a little closer to what I'd really like to see for the categories.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.