Modify the categories from WordPress default widget “Categories”

I have a post about how to exclude the categories from WordPress default widget “Categories”. Now I’d like to bring to your attention how to modify the categories from WordPress default widget “Categories” for the users who probably doesn’t know WordPress coding so good. The solution is the following: add this code in the file functions.php of the using theme:

<?php
function modify_widget_categories($args){
$include = “3,6,18”; // The IDs of the including categories
$args[“include”] = $include ;

$args[“hide_empty”] = 0; // If it is 0 it will show the empty categories as well

return $args;
}
add_filter(“widget_categories_args”,”modify_widget_categories”);
?>

You can find the full list of parameters to modify the widget categories here: http://codex.wordpress.org/Function_Reference/get_categories#Default_Usage
.

Advertisements
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: