WordPress.org

Ready to get started?Download WordPress

Forums

display count of posts on a day (6 posts)

  1. tcal
    Member
    Posted 7 years ago #

    Hey everyone,

    Trying to put in a tiny bit of code to the right of the date display on my site, so that'll it will have the DATE and then a little piece of text saying 'X posts so far today' where X is a count of the posts for that day.

    So eg. it would say September 10th 2006 - 5 posts so far today

    I'm just going around in circles trying to get the syntax right, any help appreciated.

  2. tcal
    Member
    Posted 7 years ago #

    SELECT COUNT(*) FROM wp_posts where post_date = CURRENT_DATE()

    if i can get that query to work i can do it. But my MySQL is very week, trying to work out how i can get the post_date or post_date_gmt to equal a MYSQL variable for todays date.

    Any help appreciated!

  3. spencerp
    Member
    Posted 7 years ago #

    For displaying the date, just use this:
    <?php the_time('F jS, Y') ?>

    For the other one, I think there is a plugin for it? Let me look once..

    spencerp

    By the way.. take a look at my blog once.. I got the date code from there. ;)

  4. tcal
    Member
    Posted 7 years ago #

    yep, I know the code for the date thanks.

    But I still can't get this 'X posts so far today' to work.

    It should be just a case of running a SQL query where it shows all published posts from wp_posts where the date = the day passed in from the loop.

    I've searched for a plugin but can't find any.

    Any help appreciated!

  5. jwurster
    Member
    Posted 7 years ago #

  6. spencerp
    Member
    Posted 7 years ago #

    jwurster, you're just as awesome as I am! Thanks! =)

    spencerp

Topic Closed

This topic has been closed to new replies.

About this Topic