wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



the_terms › WordPress Function

Od2.5.0
Przestarzałyn/a
the_terms ( $post_id, $taxonomy, $before = '', $sep = ', ', $after = '' )
Parametry: (5)
  • (int) $post_id Post ID.
    Wymagane: Tak
  • (string) $taxonomy Taxonomy name.
    Wymagane: Tak
  • (string) $before Optional. String to use before the terms. Default empty.
    Wymagane: Nie
    Domyślny: (puste)
  • (string) $sep Optional. String to use between the terms. Default ', '.
    Wymagane: Nie
    Domyślny: ', '
  • (string) $after Optional. String to use after the terms. Default empty.
    Wymagane: Nie
    Domyślny: (puste)
Powrót:
  • (void|false) Void on success, false on failure.
Zdefiniowane na:
Codex:

Displays the terms for a post in a list.



Źródło

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 );
}