WordPress.org

Ready to get started?Download WordPress

Forums

wp_list_categories shows children of children (5 posts)

  1. the_fear66
    Member
    Posted 7 years ago #

    Hello

    I've just upgraded a site i'm working on from 2.0 to 2.1. I use a number of categories and sub categories and sub sub categories, and have noticed that 2.1 behaves differently from 2.0 in relation to these.

    I was using the list_cats function in 2.0 like this

    <?php list_cats(TRUE, '', 'name', '', '', TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, 82, '0', FALSE, '', '', '', TRUE); ?>

    Which showed only children of category 82, and not any children of the child categories. Since upgrading however all child - child categories are also showing.

    Anyone know a way to get around this?? I've tried the wp_list_categories function for 2.1 but it doesn't look like it will help.

    Cheers
    Matt

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Use wp_list_categories and add the categories you don't want to see to the exclude option.

  3. the_fear66
    Member
    Posted 7 years ago #

    That could work... but I use WP as a CMS and want my clients to be able to add categories at the lowest level from time to time. Therefore I was hoping to have it done dynamically, as it did in 2.0.

    It would seem a shame for a nice feature like this to disappear in a new 'improved' version.

    Cheers
    Matt

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Unfortunately, the changes to the way categories work have eliminated this feature for the time being. Perhaps it'll be in an update or somebody will come up with a fix. Stay tuned, and be patient.

  5. Braydon Fuller
    Member
    Posted 7 years ago #

    i think i got something to work
    download and install this plugin
    http://braydon.com/unfold_list_categories.zip

    to only show 1 level of categories use this:
    <?php unfold_list_categories('depth=1&hierarchical=1'); ?>

    in place of this:
    <?php wp_list_categories(); ?>

    let me know if it works for you... it worked for me but it was sort of by accident i think

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags