WordPress.org

Forums

Category Post Counter (19 posts)

  1. digitaldave2
    Member
    Posted 9 years ago #

    I was wondering if anyone knew the code or of a plug in that would easily allow you to display the amount of posts in each category.

    So if I make 5 posts to the "New Post" category, on the menu it will out "New Post (5)". And so on for each other category.

  2. digitaldave2
    Member
    Posted 9 years ago #

    can someone please help?

  3. skulled
    Member
    Posted 9 years ago #

    Please take a look here:

    http://codex.wordpress.org/Template_Tags/wp_list_cats

    You need to have something like this:


    <?php wp_list_cats('sort_column=name&optioncount=1'); ?>

  4. moshu
    Member
    Posted 9 years ago #

    WP does that without any plugin. See the parameters of the Template_Tags/wp_list_cats tag (or the one it's used in your sidebar).

  5. digitaldave2
    Member
    Posted 9 years ago #

    <?php wp_list_cats('sort_column=name&optioncount=1'); ?>

    Ok this code works but displays the count below the category

    New Posts
    (5)

    Is there an argument to have it all show on one line?

  6. moshu
    Member
    Posted 9 years ago #

    Argument? No. You'll have to play with the CSS.

  7. Kafkaesqui

    Posted 9 years ago #

    What theme are you using? Look at the css for it.

  8. digitaldave2
    Member
    Posted 9 years ago #

    What in the css would break it to the next line?

  9. skulled
    Member
    Posted 9 years ago #

    The width of your sidebar perhaps is not wide enough to accommodate the whole line properly and thats why its getting pushed down maybe ..

  10. digitaldave2
    Member
    Posted 9 years ago #

    There's plenty of room on the bar. It isn't taking the <ul>
    <li>
    tags either as far as color and size. Is there a way to run the optioncount argument seperately?

  11. Kafkaesqui

    Posted 9 years ago #

    Look for any use of display: block; related to your sidebar links (i.e. a tag). This can push any text on a line to the next one.

  12. skulled
    Member
    Posted 9 years ago #

    Can you post the link to where you have this running?

    And what do you mean run the optioncount argument separately?

  13. digitaldave2
    Member
    Posted 9 years ago #

    I got it to work it was simply a block I forgot about.

    Thanks guys

  14. semperfidelis
    Member
    Posted 9 years ago #

    i have the samen problem.

    the (#) apears in the next line.
    http://www.pdsxxi.com.ar

    i canĀ“t find in the css the right line of code to modificate.

  15. semperfidelis
    Member
    Posted 9 years ago #

    ok. i fix it. was a display:block in the css too. thanks.

  16. Kafkaesqui

    Posted 9 years ago #

    Just to note for future queries, when using the Blix theme the display: block; in this case is found under:

    #navigation li a

    in the theme's layout.css.

  17. utopiad
    Member
    Posted 9 years ago #

    Is there anyway to display the total ammount of post at your blog at the top of the sidebar?

    Thanks!

  18. Videos
    Member
    Posted 9 years ago #

    I'm looking for the same thing.

    Is there anyway to display the total ammount of posts in the blog? Like postcount author 1 + postcount author2 + postcount author3 etc

    Thanks in advance!

  19. Next time, don't hijack the thread for an unrelated question. ;)

    Total Posts: <?php echo $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_status = 'publish'"); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags