Advertisement
manchumahara

Custom col and add tax in post manage

Aug 7th, 2012
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. // Prepend the new column to the columns array
  2. function cb_customtag_columns($cols) { 
  3.         $cols['racetype']       = 'Race Types';
  4.         $cols['racedistance']   = 'Race Distance';
  5.         $cols['racelocation']   = 'Race Location';
  6.         $cols['awards']         = 'Race Awards';
  7.     return $cols;
  8. }
  9.  
  10. // Echo the ID for the new column
  11. function cb_customtags_value($column_name, $id) {  
  12.         if ($column_name == 'racetype'){
  13.                     echo get_the_term_list( $id, 'racetype', '', ', ', '' );
  14.         }
  15.         if ($column_name == 'racedistance'){
  16.                     echo get_the_term_list( $id, 'racedistance', '', ', ', '' );
  17.         }
  18.         if ($column_name == 'racelocation'){
  19.                     echo get_the_term_list( $id, 'racelocation', '', ', ', '' );
  20.         }
  21.         if ($column_name == 'awards'){
  22.                     echo get_the_term_list( $id, 'awards', '', ', ', '' );
  23.         }
  24. }
  25.  
  26. function cb_add_custom_taxonomy_col()
  27. {
  28.     add_filter('manage_race_posts_columns', 'cb_customtag_columns');
  29.     add_action('manage_race_posts_custom_column', 'cb_customtags_value', 10, 2);
  30. }
  31. add_action('admin_init', 'cb_add_custom_taxonomy_col');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement