Advertisement
JTWilcox

Untitled

Jun 20th, 2011
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.49 KB | None | 0 0
  1. function my_videos_columns($columns)
  2. {
  3.     $columns = array(
  4.         "cb" => "<input type=\"checkbox\" />",
  5.         "title" => "Title",
  6.         "firstname" => "First Name",
  7.         "lastname" => "Last Name",
  8.         "titles" => "Title",
  9.         "value" => "Value",
  10.         "subject" => "Subject",
  11.         "date" => "Date"
  12.     );
  13.     return $columns;
  14. }
  15.  
  16. function my_custom_columns($column){
  17.     global $post;
  18.     switch($column){
  19.         case "firstname":
  20.             $custom = get_post_custom();
  21.                 echo $custom["video_firstname"][0];
  22.             break;
  23.         case "lastname":
  24.             $custom = get_post_custom();
  25.             echo $custom["video_lastname"][0];
  26.             break;
  27.         case "titles":
  28.             $custom = get_post_custom();
  29.             echo $custom["video_title"][0];
  30.             break;
  31.         case "value":
  32.             // Get terms for post
  33.             $terms = get_the_terms( $post->ID , 'Values' );
  34.            
  35.             // Loop over each item since it's an array
  36.             foreach( $terms as $term ) {
  37.                 // Print the name method from $term which is an OBJECT
  38.                 print $term->name . '<br />';
  39.                 // Get rid of the other data stored in the object, since it's not needed
  40.                 unset($term);
  41.             }
  42.             break;
  43.         case "subject":
  44.             // Get terms for post
  45.             $terms = get_the_terms( $post->ID , 'Subjects' );
  46.            
  47.             // Loop over each item since it's an array
  48.             foreach( $terms as $term ) {
  49.                 // Print the name method from $term which is an OBJECT
  50.                 print $term->name . '<br />';
  51.                 // Get rid of the other data stored in the object, since it's not needed
  52.                 unset($term);
  53.             }
  54.             break;
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement