Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_the_term_list [ WordPress Function ]

get_the_term_list ( $id, $taxonomy, $before = '', $sep = '', $after = '' )
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.
Returns:
  • (string)
Defined at:



Retrieve a post's terms as a list with specified format.

Source


<?php
function get_the_term_list$id$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="' esc_url$link ) . '" rel="tag">' $term->name '</a>';
    }

    
$term_links apply_filters"term_links-$taxonomy"$term_links );

    return 
$before join$sep$term_links ) . $after;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics