(+84) 463.28.7979

10 Most Wanted Category Hacks and Plugins for WordPress

In this article we will share the most wanted category hacks and plugins for WordPress which you can use in your themes. These snippets of codes are a lifesaver in many situations when it comes to modifying a theme.

1. Display Certain Categories in a Menu

Display Certain Categories in a Menu

In many cases, users only want to display certain categories in their navigation menu at the top of the page. There are limited spots, that can only be filled by top categories, but if you use the default wp_list_categories code, it will show all categories. This is why this hack below comes in very handy when you want to create a navigation menu and only display certain categories.

<ul style=”float:left; width:730px;”>
<?php wp_list_categories(‘orderby=name&include=7,9,19,16,1,5,17,23′); ?>

Note, you can also change the ‘include’ text to ‘exclude’ and show all categories and exclude those that you don’t want displayed. The numbers displayed in the code are the category IDs. Remember since WordPress shows categories in a list format, you will need to edit the CSS in order to make it work.

2. Display Category in a Dropdown Menu

Display Certain Categories in a Dropdown Menu

Some blogs have a lot of categories which they can’t display in their sidebar. Or some bloggers do not want to take up a lot of space displaying categories. This option allows them to have a select menu, dropdown menu, for categories. See WordPress Codex for details.

<form action=”<?php bloginfo(‘url’); ?>/” method=”get”>
$select = wp_dropdown_categories(‘show_option_none=Select Category&show_count=1&orderby=name&echo=0&selected=6′);
$select = preg_replace(“#<select([^>]*)>#”, “<select$1 onchange=’return this.form.submit()’>”, $select);
echo $select;
<noscript><input type=”submit” value=”View” /></noscript>

3. Exclude Certain Categories from Being Displayed in a Loop

Your blog page shows recent posts from all categories. If you want to have a separate page for some reason, or do not want to display certain categories, you can use the following code, and it will exclude a certain category from being displayed in a Loop. Just change the category IDs.

<?php if ( have_posts() ) : query_posts($query_string .’&cat=-13,-26′); while ( have_posts() ) : the_post(); ?>

4. Display the Most Recent Posts from a Specific Category

Display the Most Recent Posts from a Specific Category

This code comes in handy when you want to display posts from a specific category on your homepage, or in your sidebar. A live example of this code can be seen at Balkhis.com. The code below will show 1 post with the excerpt from category 3. You can modify the numbers as you desire.

while(have_posts()) : the_post();
<li><h3><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></h3>

<ul><li><?php the_excerpt(); ?></li>
<?php endwhile; ?>

To only show links from the category use the code below:

while(have_posts()) : the_post();
<li><h3><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></h3>
<?php endwhile; ?>

5. Exclude a Specific Category from RSS Feeds

Exclude a Specific Category from RSS Feeds

There are certain categories that contain maybe link love and others which most of your users are not interested in. This is the option to satisfy those users. You can exclude a specific category by using a plugin called Advanced Category Excluder, or you can do it manually by using the code below:


To exclude multiple cateogries, just use the ampersand symbol:


If you don’t want to use the plugin and don’t want to do it manually with the link. There is another way which you can use by editing your function.php. Paste the following code in it:

function myFilter($query) {
if ($query-&gt;is_feed) {
$query-&gt;set(‘cat’,’-5′); //Don’t forget to change the category ID =^o^=
return $query;


6. Make a Separate RSS Feed for Each Category

Often times bloggers wonder how to make separate RSS feed for their category. Because sometimes your user only visits your website for the design category, but you have ten other categories that the user is not interested in. This hack will take care of this issue. (Source)


All you have to do is add the word feed in front of the category URL, and it will take you to the feed for that specific category.

If you want to display a RSS icon in front of category listings then use the code below:

<?php wp_list_categories(‘feed_image=http://www.wpbeginner.com/image.gif&feed=XML Feed&optioncount=1&children=0′); ?>

You must make sure to change the URL of the image because this will display RSS icon in front of each category.

7. Assign an Author to a Specific Category

On Blogs that have multiple authors, it is wise to assign authors to specific categories to avoid confusion. This plugin limits the user to publishing into the categories he/she is assigned.

Check out the plugin Userextra

8. Show Post Excerpts on Category Pages

Sometimes in order to prevent duplicate content, and make your category pages easy to browse, it is recommended that you use excerpts instead of displaying full posts. Category pages are indexed like normal blogs are in chronological order, so if you have a post that is 1000 words and 25 images, and you are displaying 5 posts on each page. It will be a hassle for your user to go through category archives. Therefore we suggest you show excerpts instead of full posts on category pages. Then you just direct them to the single post page where full text is written. It also helps pageviews for those who are addicted with stats.

First you would need to open index.php and locate this code:

<?php the_content() ?>

and replace it with:

<?php the_excerpt() ?>

Now when you write posts, just write a custom excerpt to make it more interesting.

9. Show Category Icons

Show Category Icons

Pictures make a site more lively which is a given which is why blogger might want to associate pictures with their category. This plugin lets you associate a specific icon of your choice to a designated category. You can use this plugin to list categories by icon with or without names, and much more.

Download this Plugin

10. Display Category Description in Template

Displaying category description on category pages are considered to be more SEO Friendly. But this is often used when running a modified theme in which you have subcategories within a category. When you have separate category pages customized displaying category description is always a good edition.

This is the description that you type when creating a category in your WordPress admin panel.

Add the following code in your archive.php / category.php whichever one is more appropriate for you:

<?php echo category_description(); ?>

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>