Skip to content

Instantly share code, notes, and snippets.

@hellofromtonya
Created August 9, 2014 16:59
Show Gist options
  • Save hellofromtonya/5182a3d9b3cf5dbe88ec to your computer and use it in GitHub Desktop.
Save hellofromtonya/5182a3d9b3cf5dbe88ec to your computer and use it in GitHub Desktop.
Add Number of Views to the WordPress Posts Listings' Columns
add_filter('manage_page_posts_columns' , 'lunarwp_core\add_stats_column');
add_filter('manage_post_posts_columns' , 'lunarwp_core\add_stats_column');
/**
* Add Number of Views to the Post Listings' Columns
*
* @since 1.0.0
*
* @param array $columns Post Listing Columns
* @return array Returns the amended columns array
*/
function add_stats_column($columns)
{
return \lunarwp_core\insert_array_into_associatve_array($columns, array('lunarwp_stats' => __('#Views', 'lunarwp')), 2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment