Excluding Categories in Wordpress Sidebar Widget

This is a short Youtube video demo on how you can exclude categories from you side bar if using the sidebar widget. This requires us to edit the widgets.php file instead of the sidebar.php file. More how to videos can be found at the Traffic is Gold Youtube channel.

Similar Videos:
Excluding Pages In The Wordpress Sidebar

We also announce our videos on Twitter, you can follow us on Twitter here: @trafficisgold.

Step by Step code credit goes to Lance Hoff

Step 1:
Download widgets.php from here: wp-includes/widgets.php

Step 2:
Find this line of code:
$d = $options[$number]['dropdown'] ? ‘1′ : ‘0′;

under it palce this line of code: $ex = “1,2,3″;
(NOTE: change out 1,2,3 with the actual Categories you want to exclude.)

So all together it looks like this:
$d = $options[$number]['dropdown'] ? ‘1′ : ‘0′;
$ex = “1,2,3″;

Step 3:

Find
$cat_args = array(’orderby’ => ‘name’, ’show_count’ => $c, ‘hierarchical’ => $h);

Replace
$cat_args = array(’orderby’ => ‘name’, ’show_count’ => $c, ‘hierarchical’ => $h, ‘exclude’ => $ex );

Step 4:
Save the file and uplaod back to it’s original location

You are done!!

Again thanks to Lance for the code and his step by step blog post. Please visit the site here.

Join the forum discussion on this post - (1) Posts

Related posts:

  1. Excluding Pages In The Wordpress Sidebar
  2. Protect Your Wordpress Site From a Malicious Attack
  3. Future Posting In WordPress (Video)
  4. Adding YouTube Videos to your Blog Post
  5. Limit the Number of Pages in Your Wordpress Navigation Bar
  6. Making WordPress SEO Friendly URLS
  7. How to Create an Email Signature in Thunderbird
blog comments powered by Disqus