Support » Plugin: Liveblog » How to query number of liveblog entries for a given post?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Do you have normal comments on liveblog posts too, or are those disabled?

    At the moment they are disabled, but eventually I will be using normal comments and would like to distinguish between the two.

    Plugin Author Nikolay Bachiyski

    (@nbachiyski)

    @eschickel, currently there isn’t specific API for getting the count, but you can use the following code:

    function get_liveblog_entries_count_for_post_id( $post_id ) {
        $query = new WPCOM_Liveblog_Entry_Query( $post_id, WPCOM_Liveblog::key );
        return count( $query->get_all() );
    }

    If you’re using an object cache it would be pretty fast. It’s calling get_comments() once under the hood, so it shouldn’t be too slow in any case.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to query number of liveblog entries for a given post?’ is closed to new replies.