Post Count With a Twist - Help Please :) (2 posts)

  1. Terry
    Posted 9 years ago #

    I have searched the archives here for *days*, so if this is already mentioned somewhere--I apologize in advance.

    I'm currently using:

    <?php echo $numposts; ?>

    To display the blog's post count. Works like a charm. However, it includes posts in that count that are future timestamped--I'd like to leave those out of the count and have the count show only the posts that are live.

    Also I'd like to exclude posts from a specific category from being included in that count.

    I've tried countless code snippets (I'm terrible as a coder btw) as well as numerous plugins that I've lost track with. Everything seems to include future timestamped posts and nothing to exclude a category.

    Is what I'm looking for possible?

  2. Terry
    Posted 9 years ago #

    Ok I did something a little different on my end, but I still need help with one little thing :).

    I changed the categories so that they all fall under a certain parent category. This helped achieve a few things I was looking to do. But here's what I need help with in regards to post count:

    Parent Category (500)
    Child Category #1 (220)
    Child Category #2 (260)
    Child Category #3 (100)

    The parent category count is perfect, it only counts a post once even if it's in 2 or 3 different child categories. What I'm wanting to do is take the Parent Category count (500) and place it elsewhere on the sidebar.

    What is the code I can use to grab that number (500)? I'd prefer it to show without brackets as well, I just want the number displayed, nothing else. I did try a plugin that shows the count for one category, but it just gave me a '0' since the posts are all actually filed under child categories and not the parent. (plugin: http://wordpress.org/support/topic/10321?replies=16)

    Does anyone know? TIA if it's possible :).

Topic Closed

This topic has been closed to new replies.

About this Topic