Definition:
function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) {}
Retrieve a post’s terms as a list with specified format.
Parameters
- int $id: Post ID.
- string $taxonomy: Taxonomy name.
- string $before: Optional. Before list.
- string $sep: Optional. Separate items using this.
- string $after: Optional. After list.
Defined filters
- term_links-$taxonomy
apply_filters( "term_links-$taxonomy", $term_links )
Source code
function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) {
$terms = get_the_terms( $id, $taxonomy );
if ( is_wp_error( $terms ) )
return $terms;
if ( empty( $terms ) )
return false;
foreach ( $terms as $term ) {
$link = get_term_link( $term, $taxonomy );
if ( is_wp_error( $link ) )
return $link;
$term_links[] = '<a href="' . $link . '" rel="tag">' . $term->name . '</a>';
}
$term_links = apply_filters( "term_links-$taxonomy", $term_links );
return $before . join( $sep, $term_links ) . $after;
}
1855

February 12, 2011 


No comments yet... Be the first to leave a reply!