0,
'orderby' => 'name',
'order' => 'ASC',
'taxonomy' => 'subject',
'pad_counts' => 1,
'hide_empty' => true,
) );
// оставим только термины с parent=0
$terms = wp_list_filter( $terms, array('parent'=>0) );
//var_dump($terms);
$list = "
- Все предметы
";
$count = 1;
foreach( $terms as $item ) {
$link = get_term_link($item->term_id, 'subject');
$list .= "- " . $item->name . "
";
$count++;
}
$list .= "
";
?>
Наши преподаватели
term_id; // ID термина
$taxonomy = 'subject'; // Название кастомной таксономии
$count = 1;
$args = array(
'post_type' => 'teacher', // Кастомный тип записи
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'field' => 'term_id', // Ищем по ID термина
'terms' => $term_id,
),
),
'posts_per_page' => -1, // Количество записей (-1 = все записи)
);
$query = new WP_Query($args);
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
$teacher_subjects = carbon_get_post_meta( $post->ID, 'teacher_subjects' );
if ( $count > $count_teachers ) {
$style = 'display: none; scale: 0;';
} else {
$style = '';
}
?>
$count_teachers ) { ?>