WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Excluding categories from categories menu

[Resolved] Excluding categories from categories menu

  • I’m wondering how to exclude categories from my themes built-in category menu bar, which I think is driven by this line of code in the header:

    <?php wp_list_categories('sort_column=name&title_li=&depth=4'); ?>

    Is there a recommended plugin for managing what appears in the defualt WP category menu? I’m just talking about the menu/navigation, not search or any other functions..just how to exclude categories from the menu. I have so many it’s soon going to overrun the bar unless I can exclude some (or specifically ‘include’ some)

    any help appreciated.

    Hugh

Viewing 4 replies - 1 through 4 (of 4 total)
  • MichaelH

    @michaelh

    The template tag, wp_list_categories(), has an exclude= argument. Also note that you could be “more restrictive” by changing your depth=4 to something smaller.

    <?php wp_list_categories('exclude=7,2,6,10,23&sort_column=name&title_li=&depth=4'); ?>

    Alternative using include:

    <?php wp_list_categories('include=9,5,4,8,21&sort_column=name&title_li=&depth=4'); ?>

    instead of:
    wp_list_categories('sort_column=name&title_li=&depth=4');

    try:

    wp_list_categories('sort_column=name&title_li=&depth=4&exclude=1,2,3');

    where “1,2,3” are the ids of the categories the you wish to exclude in ascending order.

    Many thanks guys! Just what I wanted. Resolved.

    Hugh

    Oh by the way, Michael… http://wordpress.org/support/topic/334111?replies=12

    I got the pages up on a live server now. It’s the sidebar and categories thread you were helping with.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Excluding categories from categories menu’ is closed to new replies.
Skip to toolbar