Search results

Making Special, Hidden Categories Separate From Your Home Page and Feed

by Tom Johnson on Jul 7, 2007
categories: blogging technical-writingwordpress

Each additional WordPress site gets less and less attention than the first.Rather than having two distinct blogs -- a professional blog and a personal blog -- you can have one blog with a special hidden category that is separate from the home page and feed.

The special hidden category (perhaps for personal, off-topic posts) can have its own feed and template appearance. The posts from this special category also won't appear on your home page, so your readers won't be bothered by your randomness.

For example, in my blog I've just added an Life category where I write posts unrelated to the established focus of my blog. You won't see my Life posts unless you go to my Shared Info section on my sidebar and click the Tom's Life link.

Rather than manipulating feeds, some people actually have two separate blogs -- one professional, with posts only related to their professional interests. Their other blog is often their personal blog, with random posts on random topics. Some podcast blogs may also have separate sites for their blog and podcast.

However, having separate sites is not ideal — maintaining multiple blogs is actually a serious pain. I know, because I at one time I actually maintained three blogs: this blog, my podcast, and the Suncoast chapter blog. One blog would receive most of my attention, while the others would be neglected. Each additional blog you have receives less and less care.

To set up a category so that it's separate from the home page and feed, follow each section below.

1. Create the New Category

In your admin panel, go to Manage > Categories and create the category you want to hide. In this example, we'll call this new category "Life" Look at the ID for the Off Topic category. In this case, it's 35.

2. Exclude the New Category from Appearing on Your Home Page

Go to Presentation > Theme Editor and click your main index template file (index.php). This file determines the display of your home page. Right before the loop, paste the following code:

&lt;?php $page = (get_query_var('paged'))<br />
? get_query_var('paged') : 1;<br />
query_posts("cat=-35&amp;showposts=10&amp;paged=$page");

In case you don't know where the loop code starts, put the above code right before this line:

&lt;?php if (have_posts()) : ?&gt;

If you go to this WordPress support page, you can find the original code.

3. Hide the Category from Your Feed

To hide category 35 from your feed, first deactivate any FeedBurner Replacement Feed plugins you have. The FeedBurner Replacement plugin routes all your site's feeds automatically to one FeedBurner feed. Since you'll have multiple feeds on your site, you don't want this automatic routing anymore.

Your site's RSS feed is something like this:

https://idratherbewriting.com/wp-rss2.php

(Except you have a different domain, obviously.)

Feeds syntaxes can vary. If your site's feed is https://idratherbewriting.com/feed, change it to the syntax above.

Here's something fascinatingly simple: To exclude a category from your feed, change your feed path to the following:

https://idratherbewriting.com/wp-rss2.php?cat=-35

If you have multiple categories you want to exclude, separate them with commas, like this:

https://idratherbewriting.com/wp-rss2.php?cat=-35,-6,-5

The minus sign removes the category from your feed. Conversely, the following syntax gives you a feed of only category 34:

https://idratherbewriting.com/wp-rss2.php?cat=35

And

https://idratherbewriting.com/wp-rss2.php?cat=-35,6,5

gives you a feed of only categories 35, 6, and 5.

Now that you know how to modify your feed, log into FeedBurner (if you have burned your feed through its services) and edit your original feed details so that instead of a feed URL like https://idratherbewriting.com/wp-rss2.php or https://idratherbewriting.com/feed, you now have

https://idratherbewriting.com/wp-rss2.php?cat=-35

(Again, 34 is just the ID of the sample category we're excluding.)

Now your special category is hidden from both your home page and feed.

4. Hide the Category from your Sidebar's List of Categories

To hide your category from the list of categories in your sidebar, plug the following template call into a PHP widget in your sidebar:

<ul><?php

wp_list_categories('orderby=name&exclude=35&title_li=');

?></ul>

To run PHP in widgets, you need a PHP widget plugin, such as this one from Samsarin. To learn more about the parameters you can add to the wp_list_categories template call, see this page on wp list categories from the WordPress Codex.

5. Provide a Unique Template Page for Your Category

You can view all posts in your hidden category (we're still using 35 as the sample category ID) by going to its archive link:

https://idratherbewriting.com/category/off-topic

In this case, category 35's category slug is "Life" Look to see the specific name of your category.

You can add this link anywhere you want in your sidebar. But since it's such a unique category, you may want to dress the category page up a little. For example, when you view my Life category page, you'll see that I have some unique text at the top. This text is present in the template for this specific category, but not in my other categories.

To create a category template for your special hidden category, download the archive.php file from your theme's files. Change the name to category-35.php, modify the template as desired, and then upload it back into your theme's files.

When you view posts from category 35, WordPress automatically calls category-35.php rather than archive.php.

You can also create a custom sidebar for your category template. For your category template to have a unique sidebar, download your existing sidebar.php file, modify it as desired, change its name (for example, rename it to something like lifesidebar.php) and reupload it to your theme's files.

Then open your category template file (category-35.php), and change the call to the sidebar as follows:

<?php include(TEMPLATEPATH."/lifesidebar.php");?>

Now your special hidden category has its own appearance and sidebar.

6. Create a Feed for your Hidden Category

Log back into FeedBurner (again, if you're using FeedBurner, that is) and burn a new feed for your special category. Like I explained previously, the category-specific feed path for category 35 is as follows:

https://idratherbewriting.com/wp-rss2.php?cat=35

After you create the feed, while still in FeedBurner, click the Publicize tab and then click the friendly graphic link to get the code for an RSS button and graphic. Add this to your sidebar where your category link is.

Was this tutorial helpful? If so, let me know. You can do more with category feeds. For example, you can create custom keyword feeds from your favorite sites. Go this post by Lorelle and see the section titled "Custom Keyword Feeds from Various Sources."

Additional Resources

About Tom Johnson

Tom Johnson

I'm an API technical writer based in the Seattle area. On this blog, I write about topics related to technical writing and communication — such as software documentation, API documentation, AI, information architecture, content strategy, writing processes, plain language, tech comm careers, and more. Check out my API documentation course if you're looking for more info about documenting APIs. Or see my posts on AI and AI course section for more on the latest in AI and tech comm.

If you're a technical writer and want to keep on top of the latest trends in the tech comm, be sure to subscribe to email updates below. You can also learn more about me or contact me. Finally, note that the opinions I express on my blog are my own points of view, not that of my employer.