テーマ作成 タグの人気記事
当サイトでも、category.phpやtag.phpで使用しております。
カテゴリー名を出力するときのソース
タグ名を出力するときのソース
1 |
<?php $category = get_the_category(); $cat_id = $category[0]->cat_ID; $cat_name = $category[0]->cat_name; $cat_slug = $category[0]->category_nicename; ?><?php echo $cat_name; ?> |
1 |
<?php $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo $tag->name . ' '; } } ?> |
Category : ワードプレス