Please feel free to subscribe using either RSS or Email to stay upto date with the latest news.

RSS for 42k Wordpress Theme
RSS for Factory42
RSS for Factory42
 

All Delivered by FeedBurner

Hiding a category listing completely

Sometimes you may wish to hide a category name completely, hidden from the category lists and to hide the cat name from the printed out post.

I use this sometimes on blogs to have a category for layout purposes only, rather than to categorize something for the reader.

Firstly find the category number you wish to blank out. If your unsure how to do this please see here

Using your favorite editor, open wp-includes/widgets.php and find the line;

$d = $options[$number]['dropdown'] ? ‘1′ : ‘0′;

Below this line we need to add the following;

$ex = "1,2";

Changing 1,2 to the category numbers you wish to hide.

Then later in the same page, find the following line;

$cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);

And replace it with this;

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

Save widgets.php back to its original location and your all done! Now when you look at your category list on your blog those cats defined in the $ex array will be hidden.

You must be logged in to post a comment.