
Untitled
By: a guest on
Sep 29th, 2011 | syntax:
PHP | size: 1.26 KB | hits: 196 | expires: Never
//CUSTOMIZE POST TYPE MANGEMENT COLUMNS
add_action( 'manage_posts_custom_column' , 'custom_columns' );
add_filter('manage_edit-attachment_columns' , 'set_edit_attachment_columns');
function set_edit_mediapage_columns($columns) {
return array_merge($columns, array(
'imagetype' => __('Media Category')
)
);
}
function custom_columns( $column ) {
global $post;
switch ( $column ) {
case 'imagetype':
$imagetype_meta_values = get_the_terms($post->ID, 'imagetype');
foreach($imagetype_meta_values as $imagetype_meta_value) {
$value .= $imagetype_meta_value->name.', ';
}
if (is_string($value)) {
echo $value;
}
break;
}
}
///MEDIA CATEGORY SUBMENU///
add_action('admin_menu', 'my_plugin_menu');
function my_plugin_menu() {
add_media_page('Media Category', 'Media Category', 'read', 'imagetype', 'display_media_taxonomy_page');
}
function display_media_taxonomy_page() {
$args = array(
'tax_query' => array(
array(
'taxonomy' => 'imagetype',
'field' => 'slug'
)
)
);
$myquery = new WP_QUERY($args);
while (have_posts() ) : thepost();
echo get_the_term_list( $post->ID, 'imagetype', '', ', ', '' );
echo '<p>BLARG'.the_title().'</p>';
endwhile;
wp_reset_postdata();
}