Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * show posts views column in main articles page
- *
- */
- function add_articles_views_column($columns) {
- return array_merge( $columns,
- array('views' => __('Views')) );
- }
- add_filter('manage_articles_posts_columns' , 'add_articles_views_column');
- function my_articles_views_columns( $column, $post_id ){
- global $post;
- switch ($column){
- case 'views':
- $views = get_post_meta($post_id, 'post_views_count', true );
- /* If no duration is found, output a default message. */
- if ( empty( $views ) )
- echo __( 'No Views' );
- /* If there is a duration, append 'minutes' to the text string. */
- else
- printf( __( '%s views' ), $views );
- break;
- }
- }
- add_action( 'manage_articles_posts_custom_column', 'my_articles_views_columns', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement