test

0,
'orderby' => 'slug',
'order' => 'ASC',
// 子タームの投稿数を親タームに含める
'pad_counts' => true,

// 投稿記事がないタームも取得
'hide_empty' => false
);

// カスタム分類のタームのリストを取得
$terms = get_terms( $taxonomy , $args );

if ( count( $terms ) != 0 ) {
echo '

';

// 親タームのリスト $terms を $term に格納してループ
foreach ( $terms as $term ) {

// 親タームのURLを取得
$term = sanitize_term( $term, $taxonomy );
$term_link = get_term_link( $term, $taxonomy );
if ( is_wp_error( $term_link ) ) {
continue;
}

// 親タームのURLと名称とカウントを出力
echo '

' . $term->name . ' (' . $term->count . ')

';

// 子タームのIDのリストを取得
$termid = $term->term_id;
$term_children = get_terms( $taxonomy, array('child_of'=>$termid,'orderby'=>'slug','order'=>'ASC') );
if( count( $term_children ) != 0 ) {
echo '

    ';
    // 子タームのIDのリスト $term_children を $term_idに格納してループ
    foreach ( $term_children as $term_id ) {

    // 子タームのIDを元に子タームの情報を取得
    $term_child = $term_id;

    // 子タームのURLを取得
    $taxonomy_m = 'musicains';
    $term_child = sanitize_term( $term_child, $taxonomy );
    $term_child_link = get_term_link( $term_child, $taxonomy );
    $descriptions = term_description( $term_child, $taxonomy );
    if ( is_wp_error( $term_child_link ) ) {
    continue;
    }
    // 子タームのURLと名称とカウントを出力
    echo '

  • ' . $term_child->name . '';echo' (Musician: ';/* ここから */if( empty( $descriptions ) ){echo 'unknown';}
    elseif( strpos( $descriptions, ',') !== false ){ $now_tags = explode(', ', $descriptions); foreach($now_tags as $now_tag){$tag_properties = get_term_by('name', $now_tag, $taxonomy_m); $now_tag_slug = $tag_properties->slug; $term_m_links = get_term_link( $now_tag_slug, $taxonomy_m ); $now_tag_links = '' . $now_tag . ','; $now_tag_link_a .= $now_tag_links;}; $now_tag_link_b = substr($now_tag_link_a, 0, -1); $now_tag_link_c = explode(',', $now_tag_link_b); $now_tag_link = implode(', ', $now_tag_link_c); echo $now_tag_link; unset($now_tag_link_a); }
    elseif ( strpos( $descriptions, ',') === false ){$now_tag = $descriptions; $tag_properties = get_term_by('name', $now_tag, $taxonomy_m); $now_tag_slug = $tag_properties->slug; $term_m_links = get_term_link( $now_tag_slug, $taxonomy_m ); $now_tag_link = '' . $now_tag . ''; echo $now_tag_link; unset($now_tag_link); }/* ここまで */echo')
  • ';}
    echo '

';
}
}

echo '

';
}
?>
Currently ' . $terms_total .' lyrics listed up.

';
?>