function my_count_popular_posts($post_id) { if (!is_single()) { return; } if (!is_user_logged_in()) { if (empty($post_id)) { global $post; $post_id = $post->ID; } my_popular_post_views($post_id); } }
function count_my_popular_posts($post_id) { //Check if it is a single post and user is a visitor if (!is_single()) { return; } if (!is_user_logged_in()) { if (empty($post_id)) { global $post; $post_id = $post->ID; } //Run the popular post view my_popular_post_views($post_id); } }
/** * Dynamically inject counter into single posts */ function my_count_popular_posts($post_id) { // Check that this is a single post and that the user is a visitor if (!is_single()) { return; } if (!is_user_logged_in()) { // Get the post ID if (empty($post_id)) { global $post; $post_id = $post->ID; } // Run Post Popularity Counter on post my_popular_post_views($post_id); } }