Control child categories in WP 2.1 (4 posts)

  1. cousinagam
    Posted 8 years ago #

    Prior to 2.1, I set my sidebar to display only categories 2, 3, and 4, each of which has so many children that I don't want them to show in the sidebar. Instead each of these has its own category page (e.g., category-4.php) that lists all the children as links. (Category 1 was uncategorized, so I excluded it completely.) The old code:

    <?php wp_list_cats('exclude=1&children=0'); ?>

    With 2.1, I find that wp_list_cats is deprecated. I'm trying to get the same effect with wp_list_categories but am coming up short.

    displays the children of categories 2, 3, and 4 but not the categories themselves.

    displays the parents (2, 3, 4) and the children.

    (which leaves out 'hierarchical') also displays both parents and children.

    I'm sure I'm overlooking something obvious, but as you can see it's not obvious to me.

    This is the site: Cousin Agam Fhèin

  2. cousinagam
    Posted 8 years ago #

    Just an update... poking around the Codex, I get the impression that 2.1x's changes mean I can't get wp_list_categories to do what I want (e.g., show only categories 2, 3, and 4 in the sidebar, <i>without</i> showing their children.

    A workaround came to me in the dentist's office:

    I added hyperlinks in the sidebar for the three category-specific pages. I entered a text label of "Categories" and under it put links to category-2.php, category-3.php, and category-4.php

    Works just fine.

  3. I posted this in your other thread, but in case you don't see it:


    Where there is an exclude, there is usually an include as well.

  4. cousinagam
    Posted 8 years ago #


    I used your format (include=2,3=4), but I'm still getting the children (e.g., children of 4) listed in the sidebar.

Topic Closed

This topic has been closed to new replies.

About this Topic