Consolidating multiple WordPress blogs using categories

I’ve had separate professional and personal blogs for a while because most people I know who would read one wouldn’t be interested in the other. Recently as I started getting back into writing code, I wanted to participate in the active community of blogging programmers. But start yet another blog? Instead I decided to make heavy use of categories in my primary WordPress blog to split the audiences. Here’s how I did it.

Mutually exclusive categories

By default WordPress categories are checkboxes; a single post can be in multiple categories. I want each category to be sort of its own blog so I made a category for each audience: Coding, Computing, and Research. WordPress requires you to have an Uncategorized category so I renamed that Whatever.

To enforce a single category per post, I added the Radio Button Categories plugin.


By default WordPress has just one feed for all posts (and one for comments). I needed a way to have a feed per category. I also wanted to let people subscribe by email per category. FeedBlitz does it all but it costs money . FeedBurner is free and does email subscriptions so I just needed to make it work with category feeds.

I already wrote about how to set up a FeedBurner feed per category. With that, a browser can find the RSS links in the header and offer them to the user to subscribe too,  but I also wanted a way to subscribe by email. For that I wrote a subscribe widget using this tutorial. The widget reads the FeedBurner config from the plugin and if there is a FeedBurner feed for the currently displayed category it presents a form with an email address field the user can use to subscribe.


Lastly, I needed a clear visual navigation between the categories. This was surprisingly difficult to implement because the WordPress theming API, the Thematic framework and the Earlymorning theme I was building off were all new to me. Along the way trying to learn the framework upon framework, I wondered if I’d have been better with fewer abstractions. I already know PHP, HTML, CSS and now I have to learn this stuff too just to get my page up? I go back and forth on re-use versus DIY, but I digress.

I couldn’t get wp_list_categories() to look right so I sort of reimplemented it:

function childtheme_category_info() { 
  $current = single_cat_title("", false); 
  $categories = get_categories(); 
  echo '<div id="category-selection">on '; 
  foreach ($categories as $catinfo) { 
  if (in_category($catinfo->term_id)) 
  $class = ($catinfo[''] == $current) ? "current-category" : ""; 
  echo "<a class=\"$class\" href=\"/category/$catinfo->slug/\">$catinfo->name</a> "; 

echo '</div>';

Then I thought there must be an easier way and realized that I could use CSS to make the <ul> look how I wanted. So here’s my code for the category navigation in the header in functions.php of my Thematic child theme:

function childtheme_category_info() { 
  echo '<div id="category-selection">on <ul>'; 
  echo '</ul></div>'; 

add_action('thematic_header', 'childtheme_category_info', 4);

And here’s my CSS too:

#category-selection {

font-family: "Copperplate Gothic Light", Georgia, Times, serif; 
  font-size: 16px; 
  font-weight: normal; 
  line-height: 34px; 
  float: left; 
  margin-top: 70px; 
  margin-left: 60px; 
  position: absolute; 

#category-selection ul {
  list-style: none;
  display: inline;
  margin: 0 -1pt 0 2pt;
  padding: 0;

#category-selection ul li {
  list-style: none;
  display: inline;
  margin-top: 4pt;
  margin: 0 2pt;

#category-selection a:link, a:visited, a:active {
  color: black;
  text-decoration: none;
  border: none;

#category-selection .current-cat a {
  border-bottom: 3px solid #92bf9b;

#category-selection a:hover {
  color: #fe5757;
  border-bottom: 3px solid #92bf9b;

There’s probably an easier way if you’re a WordPress ninja. I’m not and don’t have time to be. Even finding and using the wp_list_categories() function was, in hindsight, probably a waste of time versus hard-coding it for my site.

Now I’m pretty satisfied with the design. Next I want to transfer my old OpenEducationResearch posts to this blog. And then, I don’t know, write.

This entry was posted in Coding. Bookmark the permalink. Both comments and trackbacks are currently closed.
  • Subscribe

    Subscribe to all posts by feed.