get_the_term_list

Sponsored Link

投稿と取得したタクソノミーで関連付けられているタクソノミーのタームのHTML文字列を返します。タームはそれぞれのタームをリストアップしたページにリンクします。

Sponsored Link

Returns an HTML string of taxonomy terms associated with a post and given taxonomy. Terms are linked to their respective term listing pages.

get_the_term_listのファンクションタグ使用方法

<?php get_the_term_list( $id, $taxonomy, $before, $sep, $after ) ?> 

get_the_term_listのパラメーター

$id

(int) (required)投稿ID。
デフォルト:0

(int) (required) Post ID
Default: 0

$taxonomy

(string|array) (required)タクソノミーの名前
デフォルト:なし

(string|array) (required) Name of taxonomy
Default: None

$before

(string) (optional)主要なテキスト
デフォルト:なし

(string) (optional) Leading text
Default: None

$sep

(string) (optional)タグを区切るには文字列
デフォルト:なし

(string) (optional) String to separate tags
Default: None

$after

(string) (optional)テキストの末尾
デフォルト:なし

(string) (optional) Trailing text
Default: None

戻り値

(string)
タクソノミータームのHTML文字列

(string)
HTML string of taxonomy terms.

基本な例

特定の投稿のために人タクソノミーからタームを出力するループ内で使用されます。

Used inside the loop this outputs the terms from the people taxonomy for a specific post.

<?php echo get_the_term_list( $post->ID, 'people', 'People: ', ', ', '' ); ?> 

これは、いかようにも返します。

This would return something like.

People: 
<a href="person1">Person 1</a>, 
<a href="person2">Person 2</a>, ...

HTMLリストを返します

(x)htmlリストとして特定の投稿のためのスタイルのタクソノミーからタームを出力するループ内で使用されます。

Used inside the loop this outputs the terms from the styles taxonomy for a specific post as an (x)html list.

echo '<ul class="styles">';
echo get_the_term_list( $post->ID, 'styles', '<li>', ',</li><li>', '</li>' );
echo '</ul>';

これは、いかようにも返します。

This would return something like.

<ul class="styles">
    <li><a href="person1">Style 1,</a></li> 
    <li><a href="person2">Style 2,</a></li>
</ul>

変更ログ

Since: 2.5.0

ソースファイル

get_the_term_list()は、wp-includes/category-template.php内に位置しています。

get_the_term_list() is located in wp-includes/category-template.php.

関連ファンクションタグ

get_the_tag_list()

Terms: is_term(), term_exists(), get_objects_in_term(), get_term(), get_term_by(), get_term_children(), get_term_link(), get_terms(), get_the_terms(), get_the_term_list(), has_term(), sanitize term(), wp_get_object_terms(), wp_set_object_terms(), wp_get_post_terms(), wp_set_post_terms()

Sponsored Link