WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Bug in wp_list_categories? Number not working w/ child_of (7 posts)

  1. trex33
    Member
    Posted 5 years ago #

    I'm having problems trying to limit number of subcategories that are displayed when using wp_list_categories and child_of.
    <?php wp_list_categories('child_of=11&number=5'); ?>

    The SQL LIMIT Works fine with parent categories, but not with subcategories (never shows the correct number of subcategories; usually off by 2 or 3). Is this a WP bug or am I just going crazy? I saw this topic awhile back.

    http://wordpress.org/support/topic/161358?replies=1

  2. MichaelH
    Member
    Posted 5 years ago #

    Look at using the depth= parameter with the template tag, wp_list_categories(), rather than number=.

  3. trex33
    Member
    Posted 5 years ago #

    Thanks Michael but I thought depth paramter controls how many levels of subcats show? I am just trying to limit number of 2nd level subcats that display. For example:

    Parent Cat
    2nd level subcat1
    2nd level subcat2
    2nd level subcat3
    2nd level subcat4
    2nd level subcat5
    2nd level subcat6

    Let's say I try to limit these 2nd level subcats to only display 3 of them (e.g., "number=3"). That's when wrong amount is displayed (usually none or less than specified limit).

  4. MichaelH
    Member
    Posted 5 years ago #

    Ah, well I don't believe wp_list_categories() can do that.

  5. trex33
    Member
    Posted 5 years ago #

    Thanks Michael. Is this a bug or not a feature? If you can limit number of parent cats, it would seem logical that you should be able to limit number of subcats.

    Depending on your answer to question above, where can I report bug or request new feature?

  6. MichaelH
    Member
    Posted 5 years ago #

    Not a bug as far as I know, but you should read Reporting Bugs just in case.

    Feature request:
    http://wordpress.org/extend/ideas/

  7. trex33
    Member
    Posted 5 years ago #

    Version 2.7.1 has fixed this issue.

Topic Closed

This topic has been closed to new replies.

About this Topic