the_tags

Sponsored Link

このテンプレートタグは、記事に属するタグまたはタグへのリンクを表示します。もしタグが現在のエントリーに関連付けられていない場合は、関連付けられているカテゴリーが代わりに表示されます。このタグはループ内で使用する必要があります。

Sponsored Link

This template tag displays a link to the tag or tags a post belongs to. If no tags are associated with the current entry, the associated category is displayed instead. This tag should be used within The Loop.

the_tagsのテンプレートタグ使用方法

<?php the_tags( $before, $separator, $after ); ?> 

the_tagsのパラメーター

$before

(string)実際のタグの前に表示するテキスを表示します。デフォルトはタグです:

(string) Text to display before the actual tags are displayed. Defaults to Tags:

$separator

(string)各タグのリンクの間にテキストまたは文字列が表示されます。デフォルトは各タグの間にカンマ(、)です

(string) Text or character to display between each tag link. The default is a comma (,) between each tag.

$after

(string) 最後のタグの後にテキストが表示されます。デフォルトでは何も表示しません。

(string) Text to display after the last tag. The default is to display nothing.

デフォルトの使い方

デフォルトの使い方は、デフォルトのテキストタグの前に来る、カンマ(,)によって区切られた各タグ()とタグのリスト化します。:.

The default usage lists tags with each tag (if more than one) separated by a comma (,) and preceded with the default text Tags: .

<p><?php the_tags(); ?></p>

コンマで区切る方法

それ以降改行とタグの一覧を表示します。

Displays a list of the tags with a line break after it.

<?php the_tags('Tags:', ', ', '<br />'); ?> 

矢印で区切る方法

Social tagging:テキストと共に、タグを矢印(>)で区切って前に置いたタグのリストを表示します。

Displays links to tags with an arrow (>) separating the tags and preceded with the text Social tagging:

<?php the_tags('Social tagging: ',' > '); ?>
Social tagging: WordPress > Computers > Blogging

中黒点で区切る方法

Taggedテキストと共に、タグを中黒点(・)で区切って前に置いたタグのリストを表示します:そして改行が続きます。

Displays links to tags with a bullet (・) separating the tags and preceded with the text Tagged with: and followed by a line break.

<?php the_tags('Tagged with: ',' ・ ','<br />'); ?>
Tagged with: WordPressComputersBlogging

リストの例

順不同リストとしてタグの一覧を表示します:

Displays a list of the tags as an unordered list:

<?php the_tags('<ul><li>','</li><li>','</li></ul>'); ?>
  • WordPress
  • Computers
  • Blogging

変更ログ

Since: 2.3.0

関連テンプレートタグ

the_tags, tag_description, single_tag_title, wp_tag_cloud, wp_generate_tag_cloud, get_tags, get_the_tags, get_the_tag_list, get_tag_link

Sponsored Link