画像タクソノミの追加と表示

http://ja.forums.wordpress.org/topic/4779?replies=3(wordpress forum)


global $wp;
	$wp->add_query_var( 'post_status' );

/**
 *
 *
 *
 */

register_taxonomy(
 'sky', #項目追加
 'attachment:image', #コンテンツの種類
 array(
 'label'=> '天気', #項目ラベル
 'helps'=> '天気を入力して下さい。' #項目説明
 )
);
register_taxonomy(
 'place', #項目追加
 'attachment:image', #コンテンツの種類
 array(
 'label'=> '場所', #項目ラベル
 'helps'=> '車じゃないといけない、バスで行ける、電車でいける、' #項目説明
 )
);

attachment.php

 <?php the_taxonomies();?>
 <?php						
 //this link not work multi user?
  echo get_the_term_list( $post->ID, 'sky', 'お天気: ', ', ', '' ); ?>
 <?php echo get_the_term_list( $post->ID, 'place', '場所: ', ', ', '' ); ?>
 <?php
 // show value only
 $t= get_the_terms( $post->ID, 'sky'); 
 $p= get_the_terms( $post->ID, 'place'); 
 
 echo "<p>お天気: ".$t[0]->name." 場所: ".$p[0]->name."</p>";

実用的には、media tag pluginの利用も視野に

echo '<h3>media tags plugin output</h3>';
list_mediatags();

[emulsion_relate_posts]