Support » Plugins and Hacks » Post Word Count – how to exclude pages, only count words in Posts not Pages?

  • Dgold

    (@dgold)


    Can anyone tell if this plugin counts the total # of words in Posts & Pages, or Just Posts?

    I want to count just the posts.

    http://wordpress.org/extend/plugins/post-word-count/

    the relevant part of the plugin code may be this,

    if ($single) $query = "SELECT post_content FROM $wpdb->posts WHERE ID = '$id'";
    	else $query = "SELECT post_content FROM $wpdb->posts WHERE post_status = 'publish' AND post_date < '$now'";

    How to exclude Pages from it?

Viewing 1 replies (of 1 total)
  • tomontoast

    (@tomontoast)

    It was counting the total # of words in Posts & Pages. The following modification excludes pages:

    if ($single) $query = "SELECT post_content FROM $wpdb->posts WHERE ID = '$id' AND post_type='post'";
    	else $query = "SELECT post_content FROM $wpdb->posts WHERE post_status = 'publish' AND post_date < '$now' AND post_type='post'";
Viewing 1 replies (of 1 total)
  • The topic ‘Post Word Count – how to exclude pages, only count words in Posts not Pages?’ is closed to new replies.