Guest User

Untitled

a guest
Sep 29th, 2011
461
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //CUSTOMIZE POST TYPE MANGEMENT COLUMNS
  2. add_action( 'manage_posts_custom_column' , 'custom_columns' );
  3.  
  4. add_filter('manage_edit-attachment_columns' , 'set_edit_attachment_columns');
  5. function set_edit_mediapage_columns($columns) {
  6.     return array_merge($columns, array(
  7.         'imagetype' => __('Media Category')
  8.         )
  9.     );
  10. }
  11.  
  12. function custom_columns( $column ) {
  13.     global $post;
  14.    
  15.     switch ( $column ) {
  16.         case 'imagetype':
  17.             $imagetype_meta_values = get_the_terms($post->ID, 'imagetype');
  18.             foreach($imagetype_meta_values as $imagetype_meta_value) {
  19.                 $value .= $imagetype_meta_value->name.', ';
  20.             }
  21.             if (is_string($value)) {
  22.                 echo $value;
  23.             }
  24.             break;
  25.     }
  26. }
  27.  
  28. ///MEDIA CATEGORY SUBMENU///
  29. add_action('admin_menu', 'my_plugin_menu');
  30.  
  31. function my_plugin_menu() {
  32.     add_media_page('Media Category', 'Media Category', 'read', 'imagetype', 'display_media_taxonomy_page');
  33. }
  34.  
  35. function display_media_taxonomy_page() {
  36.     $args = array(
  37.         'tax_query' => array(
  38.             array(
  39.                 'taxonomy' => 'imagetype',
  40.                 'field' => 'slug'
  41.             )
  42.         )
  43.     );
  44.    
  45.     $myquery = new WP_QUERY($args);
  46.    
  47.     while (have_posts() ) : thepost();
  48.         echo get_the_term_list( $post->ID, 'imagetype', '', ', ', '' );
  49.         echo '<p>BLARG'.the_title().'</p>';
  50.     endwhile;
  51.    
  52.     wp_reset_postdata();
  53. }
  54.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×