ну вот создал таксономию и там пункты.. как их вывести?
скрин https://gyazo.com/8612ad40ffb6b75f660e09d4886a1b92
Модератор
Юрій
(@yube)
Неужели так трудно называть вещи своими именами?
$args = array( 'hide_empty=0' );
$terms = get_terms( 'my_term', $args );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
$count = count( $terms );
$i = 0;
$term_list = '<p class="my_term-archive">';
foreach ( $terms as $term ) {
$i++;
$term_list .= '<a href="' . esc_url( get_term_link( $term ) ) . '" alt="' . esc_attr( sprintf( __( 'View all post filed under %s', 'my_localization_domain' ), $term->name ) ) . '">' . $term->name . '</a>';
if ( $count != $i ) {
$term_list .= ' · ';
}
else {
$term_list .= '</p>';
}
}
echo $term_list;
}
Пример отсюда: https://developer.wordpress.org/reference/functions/get_terms/
спасибо! не подскажите как только родительские вывести?
Модератор
Юрій
(@yube)