WC_Breadcrumb::term_ancestors()
Add crumbs for a term.
Метод класса: WC_Breadcrumb{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->term_ancestors( $term_id, $taxonomy );
- $term_id(int) (обязательный)
- Term ID.
- $taxonomy(строка) (обязательный)
- Taxonomy.
Код WC_Breadcrumb::term_ancestors() WC Breadcrumb::term ancestors WC 8.7.0
protected function term_ancestors( $term_id, $taxonomy ) { $ancestors = get_ancestors( $term_id, $taxonomy ); $ancestors = array_reverse( $ancestors ); foreach ( $ancestors as $ancestor ) { $ancestor = get_term( $ancestor, $taxonomy ); if ( ! is_wp_error( $ancestor ) && $ancestor ) { $this->add_crumb( $ancestor->name, get_term_link( $ancestor ) ); } } }