
通过MemberPress实现WordPress接入ChatGPT终极指南
the_terms ( $post_id, $taxonomy, $before = '', $sep = ', ', $after = '' )
the_terms: 这个函数检索并以列表的形式显示与文章或自定义文章类型相关的术语。术语可以显示为逗号分隔的列表,也可以显示为由指定分隔符分隔的列表: 这个函数需要三个参数:文章或自定义文章类型的ID,术语所属的分类法,以及用于分隔列表中的术语的分隔符。
在一个列表中显示一个文章的术语。
function the_terms( $post_id, $taxonomy, $before = '', $sep = ', ', $after = '' ) { $term_list = get_the_term_list( $post_id, $taxonomy, $before, $sep, $after ); if ( is_wp_error( $term_list ) ) { return false; } /** * Filters the list of terms to display. * * @since 2.9.0 * * @param string $term_list List of terms to display. * @param string $taxonomy The taxonomy name. * @param string $before String to use before the terms. * @param string $sep String to use between the terms. * @param string $after String to use after the terms. */ echo apply_filters( 'the_terms', $term_list, $taxonomy, $before, $sep, $after ); }