ワードプレスの一覧ページで表示される「カテゴリー:」「タグ:」、ない方が見栄えがいい場合がある。
そんな時はテンプレートの「functions.php」に以下を記載。
カテゴリー「カテゴリー:」を非表示
1 2 3 4 5 6 7 8 9 10 11 |
add_filter( 'get_the_archive_title', function ( $title ) { if( is_category() ) { $title = single_cat_title( '', false ); } return $title; }); |
カテゴリー「カテゴリー:」タグ「タグ:」を非表示
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
add_filter( 'get_the_archive_title', function ($title) { if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } return $title; }); |
コメント