Adding Views column to the Posts Manage page
-
To display the views count on the post manage page, add the following code to your theme’s functions.php file:
/* * Adds the views column to Posts Manage page */ function add_wpp_views_columns($columns) { if ( function_exists('wpp_get_views') ) { $columns['views'] = 'Views'; } return $columns; } add_filter('manage_posts_columns', 'add_wpp_views_columns'); /* * Displays the views column data */ function wpp_views_columns_data($name) { if ( 'views' == $name && function_exists('wpp_get_views') ) { global $post; echo wpp_get_views( $post->ID ); } } add_action('manage_posts_custom_column', 'wpp_views_columns_data');
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Adding Views column to the Posts Manage page’ is closed to new replies.