WordPress.org

Ready to get started?Download WordPress

Forums

wp_list_categories exclude doesn't work (12 posts)

  1. Tim Rogers
    Member
    Posted 3 years ago #

    I tried to use the wp_list_categories function to exclude the category cat=1 from the menu.

    <?php wp_list_categories('exclude=1&show_count=1&title_li='); ?>

    http://localhost/wp-content/themes/hp/sidebar.php

    But nothing changes, what can I do?
    Here the link to my homepage:
    http://mcaf.ee/d0b4c

  2. Cathy Tibbles
    Member
    Posted 3 years ago #

    Are you using this code in the sidebar? Do you have a php-exec plugin installed? Or adding it to the templates?

  3. Tim Rogers
    Member
    Posted 3 years ago #

    I have written the named Code in this file:
    /wp-content/themes/hp/sidebar.php

    No, I have no active plugins installed.

  4. Cathy Tibbles
    Member
    Posted 3 years ago #

    Can you paste the code into a pastebin? What you have should work assuming there is a cat with the ID of 1.

  5. Tim Rogers
    Member
    Posted 3 years ago #

    Which code do you mean excactly?

    What you have should work assuming there is a cat with the ID of 1.

    What do you mean with that?
    (I am not an English native speaker)

  6. Cathy Tibbles
    Member
    Posted 3 years ago #

    THis code should work: <?php wp_list_categories('exclude=1&show_count=1&title_li='); ?>

  7. Tim Rogers
    Member
    Posted 3 years ago #

    It should work but it doesn't work.
    Even if I delete the line completely
    <?php wp_list_categories('exclude=1&show_count=1&title_li='); ?>
    the categories are there still.
    Here my complete sidebar.php from /wp-content/themes/hp/sidebar.php

    [Large code excerpt removed by moderator per forum rules. Please use the pastebin for all large code excerpts. It works better anyway.]

  8. Tim Rogers
    Member
    Posted 3 years ago #

    Here the code in the pastebin

  9. Tim Rogers
    Member
    Posted 3 years ago #

  10. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    did you use a category widget in 'dashboard - appearance - widgets' ?

    if, then this will show the category list, and any edits in the code of 'wp_list_categories()' in sidebar.php will have no effect.

    one possibility is to find one of the category widget plugins, which may allow to exclude categories.

  11. Tim Rogers
    Member
    Posted 3 years ago #

    Yes I use such a widget.

    I couldn't find until now any widget, that has this function to exclude categories and is compatible to 3.0.1.

    Is there no possibility to include the wp_list_categories in the theme manually?

  12. Tim Rogers
    Member
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic