$text"; break; default: break; } } // count total featured post function total_featured() { $result = new WP_Query(array( 'post_type' => 'post', 'post_status' => 'publish', 'meta_query' => array( array( 'key' => '_is_featured', 'value' => 'yes' ) ) , 'posts_per_page' => 1 )); wp_reset_postdata(); wp_reset_query(); $totalFeaturedPosts = $result->found_posts; unset($result); return $totalFeaturedPosts; } function aps_current_screen($screen) { if (defined('DOING_AJAX') && DOING_AJAX) { return $screen; } add_filter('views_edit-post', 'featured_post_counts_display'); return $screen; } // show featured post counts on admin screen post screen function featured_post_counts_display($views) { $count = total_featured(); $views['featured_post'] = "

Published Featured Posts ({$count})

"; return $views; } function aps_admin_head() { $apsAjaxLoader = APS_PLUGIN_URI .'/css/ajax-loader.gif'; ?> $post_id, 'featured_status' => $toggleStatus, 'total_featured' => total_featured() )); die(); } add_action('wp_ajax_toggle_featured_post', 'toggle_featured_post');