Posted By

florent on 10/21/11


Tagged

wordpress admin


Versions (?)

DISPLAY POST VIEWS WITHIN ADMIN POST COLUMNS


 / Published in: PHP
 

  1. add_filter('manage_posts_columns', 'posts_column_views');
  2. add_action('manage_posts_custom_column', 'posts_custom_column_views',5,2);
  3. function posts_column_views($defaults){
  4. $defaults['post_views'] = __('Views');
  5. return $defaults;
  6. }
  7. function posts_custom_column_views($column_name, $id){
  8. if($column_name === 'post_views'){
  9. echo getPostViews(get_the_ID());
  10. }
  11. }

Report this snippet  

You need to login to post a comment.