dog1

With the default WordPress installation you can display a list of categories in the side bar. Sometimes you do not want to show every category however.  You may be designing a custom page, where you only want the subcategories showing, or some themes use a custom category like “featured” to show only the posts that are in this category on the main page. You don’t usually need or want this category showing in the side post, it is just “clutter”

There are many plug-ins that can provide you with a customized category listing, however I have found from experience, that you can spend way too much time downloading, installing, and repeating until you find one that suites your site.

There is an easier way to exclude specific categories from your Category list.

1)You will need to know the category ID(s) that you want to exclude. There are 2 ways to find these:

a) Go to your Categories section in wordpress admin(Posts->Categories) and mouse over a category, you will see the cat_ID=# at the bottom of your browser window.

b) Use the Reveal ID’s for WP Admin Plugin

2)Next you will need to edit the widgets.php file. You cannot do this with the built in wp editor. You must use your favorite FTP client. Navigate to wp-includes/widgets.php in your WP installation and copy the file to your hard drive.

3) Open widgets.php in a text editor and locate the following line: (use the search function)

4) Ad the following directly under the above line. Replace the 1,2,3 with the categories you want to exclude

5) Next find the following line:

6) Replace it with this:

7) Save it, and upload your new widgets.php back to the wp-includes directory on your server.

Your sidebar category widget should now display all the categories except the ones you excluded.

Tagged with:

Filed under: How To

Like this post? Subscribe to my RSS feed and get loads more!