WordPress.org

Ready to get started?Download WordPress

Forums

Display the number of post by Categories (6 posts)

  1. hey2you
    Member
    Posted 6 years ago #

    Hello,

    I want to print out the number of post by Categories and show it next to the corresponding Category. how can I do this??

    Thanks

  2. Ivovic
    Member
    Posted 6 years ago #

    if you're trying to work with a wordpress template tag, your best bet is to find it in the Codex.

    In this case, one of the parameters for wp_list_categories() is 'show_count', which does exactly what you want.

    Check it out on that page.

  3. hey2you
    Member
    Posted 6 years ago #

    Yes it works!! Thanks alot.

    But the number of post (x) is not next to the Category. It is under it, I think it apply an extra linefeed to it, how can I solve this??

  4. Ivovic
    Member
    Posted 6 years ago #

    it doesn't apply a line feed or a line break, or anything at all.

    I can't see your site, but... what might be happening, is that the extra (x) could be wrapping to the next line due to width...

    Or... your style sheet could have an interesting defintion for 'cat-item' or the links inside list-item tags.

  5. hey2you
    Member
    Posted 6 years ago #

    my sidebar CSS code: Any thought??

    #sidebar ul, #topbar ul, #topbar li {
    margin: 0;
    padding:0;
    }

    #sidebar ul ol, #topbar ul ol {
    margin: 0;
    padding:0;
    }

    #sidebar ul li, #topbarleft ul li, #topbarcenter ul li {
    list-style-type:none;
    list-style-image:none;
    margin-bottom: 15px;
    padding-left:0px;
    }

    #sidebar ul p, #sidebar ul select, #topbar ul p {
    margin: 0px 0 0px;
    }

    #sidebar ul ul, #sidebar ul ol, #topbar ul ul, #topbar ul ol {
    margin: 5px 0 0 10px;
    }

    #sidebar ul ul ul, #sidebar ul ol, #topbar ul ul ul, #topbar ul ol {
    margin: 0 0 0 10px;
    }

    ol li, #sidebar ul ol li, #topbar ul ol li {
    list-style: decimal outside;
    }

    #sidebar ul ul li, #sidebar ul ol li, #topbar ul ul li, #topbar ul ol li {
    margin: 3px 0 0;
    padding: 0;
    }

  6. Ivovic
    Member
    Posted 6 years ago #

    no, but post a link to your site, please.

Topic Closed

This topic has been closed to new replies.

About this Topic