Forum

 
You must be logged in to post Login Register


Register? | Lost Your Password?

Search Forums:


 






Wildcard Usage:
*    matches any number of characters
%    matches exactly one character

Excluding Categories in WordPress Sidebar Widget

Read original blog post

No Tags
UserPost

9:25 pm
November 13, 2009


Josh

Admin

posts 52

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.


Read original blog post

No Tags

About the Traffic Is Gold Forum

Most Users Ever Online: 18

Currently Online:
4 Guests

Currently Browsing this Topic:
1 Guest

Forum Stats:

Groups: 1
Forums: 13
Topics: 28
Posts: 28

Membership:

There are 27 Members

There is 1 Admin
There is 1 Moderator

Top Posters:

Maria – 1

Administrators: Josh (52 Posts)

Moderators: Lilly (1 Post)