Support » Fixing WordPress » Getting the number of entries

  • Resolved ryanoz

    (@ryanoz)


    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?

Viewing 1 replies (of 1 total)
  • 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'");
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Getting the number of entries’ is closed to new replies.