Quantcast
Channel: Ruben Sargsyan » widget
Viewing all articles
Browse latest Browse all 9

Modify the categories from WordPress default widget “Categories”

$
0
0

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
.


Viewing all articles
Browse latest Browse all 9

Latest Images

Trending Articles





Latest Images