WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Getting the number of entries (2 posts)

  1. ryanoz
    Member
    Posted 7 years ago #

    How would you go about getting the number of entries made on the last post date.

    So if the last time a post was made is April 23,
    how would you get the number of post made on this day
    and assign it to a variable?

  2. ryanoz
    Member
    Posted 7 years ago #

    Ok, so I was able to figure this one out by reading this support topic:
    http://wordpress.org/support/topic/88942?replies=10

    Somehow, this will give you the total number of post made on the last post date. It makes no sense, and I have no idea how it works. If anyone could explain what is going on here, it would be helpful. Why does it take such a complicated garbled mess like this just to get the number? What a mess:

    <?php
    $post = $posts[0]; // Hack
    if (is_day()) {
    $likedate = 'Y-m-d ';
    }
    $count = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_date LIKE '" . get_the_time($likedate) . "%' AND post_date_gmt < '" . current_time('mysql', TRUE) . "' AND post_status = 'publish'");
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic