diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)


Top Cat: a WordPress Plugin

Top Cat is a WordPress plugin that allows you to specify a main category for your posts. Even though WordPress posts can have more than one category, you may want to specify which of them is the main category for each post. Top Cat lets you do this and also provides template tags for displaying the main category. Using style sheets, you can then apply different styling to posts based on their main category, even if they belong to the same set of categories.

Note: To take advantage of this plugin, you’ll have to create posts in WordPress Admin, if you make posts through XMLRPC based desktop clients, Blogjet, Windows Live Writer. etc. it’ll not work.

Installation & usage:

  1. Download the topcat.php file to a local folder.
  2. Upload topcat.php to wp-content/plugins/ foldery.
  3. Activate from the plugins page in WordPress Admin panel.
  4. When you create or edit a post in WordPress Admin panel, you will see round radio buttons next to each “Category” check box. Check the checkboxes as normal, and also select the radio button next to the category that you want to specify as the main one.
  5. In your theme pages, you can use the template tags defined in the plugin to get or display the main category’s name or ID. The tags are

These tags can be called within the loop, or outside of the loop if you give them the ID of a post. Have a look inside the plugin source file for more details.


To style posts according to their main category, you’ll need to edit your theme. For example, you could edit the default WordPress theme by adding the main category name to the class for each post:


This gives each post the CSS class “category-categoryslug“. For example, if you have a post with main category “New Zealand”, then the post will have the CSS class “category-new-zealand”. Then you could edit the CSS file for the theme to vary posts’ background colour depending on their main category:

.category-new-zealand { background-color: #cfc; }
.category-australia { background-color: #ffc; }

Top Cat -Home page | WebTools

Top Cat, WordPress, Plugin, Blogs

Share This Story, Choose Your Platform!

Get Latest News

Subscribe to Digital News Hub

Get our daily newsletter about the latest news in the industry.
First Name
Last Name
Email address
Secure and Spam free...