Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a way to exclude certain categories from a widgetised sidebar? I've got categories that are associated with custom post types and ones associated with my blog - I don't want to display the CPT categories when viewing my blog.

Any ideas? All I can think of is that I have to hard code the sidebar instead and ditch the widgetised version.

share|improve this question

2 Answers 2

If i understand correctly, a quick solution could be using something like Widget Logic and create a custom menu for each category, then use whatever Conditional Tags applies.// such as is_category() or in_category( '5' ) Or, if you don't want to use a plug-in, you could try duplicating the widget and then adding the conditional tag there... hope that helps!

share|improve this answer

The categories in widget are retrieved in following way:

wp_list_categories(apply_filters('widget_categories_args', $cat_args));

So you can make use of this filter to modify arguments.

However it might be simpler to use alternative widget, for example one from Widgets Reloaded, that offers more control via interface.

share|improve this answer
    
I don't want to use a plugin. Where do I find this: wp_list_categories(apply_filters('widget_categories_args', $cat_args)); –  Evie Milo Oct 17 '11 at 9:31
    
@Evie Milo this is code from widget. You can hook into widget_categories_args to adjust the arguments, used to retrieve the categories in widget. See Plugin API > Filters if you need info about hooks. –  Rarst Oct 17 '11 at 11:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.