<p class="program-m">Уровень подготовки</p>
<?php
$categories = get_terms('level', 'orderby=name&hide_empty=0');
if($categories){
echo '<select name="level"><option value="card-item">Любая</option>';
foreach ($categories as $cat){
echo "<option value='level-{$cat->term_id}'>{$cat->name}</option>";
}
echo '</select>';
}
?>
<p class="program-m">Направление образования</p>
<?php
$categories = get_terms('direction', 'orderby=name&hide_empty=0');
if($categories){
echo '<select name="direction"><option value="card-item">Любая</option>';
foreach ($categories as $cat){
echo "<option value='direction-{$cat->term_id}'>{$cat->name}</option>";
}
echo '</select>';
}
?>
<p class="rus">Уровень подготовки</p>
<?php
$categories = get_terms('level', 'orderby=name&hide_empty=0');
if($categories){
echo '<select name="level" id="level1"><option value="card-item">Любой</option>';
foreach ($categories as $cat){
echo "<option value='level-{$cat->term_id}'>{$cat->name}</option>";
}
echo '</select>';
}
?>
<p>Направление образования</p>
<?php
$categories = get_terms('direction', 'orderby=name&hide_empty=0');
if($categories){
echo '<select name="direction" id="direction1"><option value="card-item">Любое</option>';
foreach ($categories as $cat){
echo "<option value='direction-{$cat->term_id}'>{$cat->name}</option>";
}
echo '</select>';
}
?>
<?php
$categories = get_terms('direction', 'orderby=name&hide_empty=0');
if($categories){
echo '<select name="foo"><option value="card-item">Любая</option>';
foreach ($categories as $cat){
echo "<option value='direction-{$cat->term_id}'>{$cat->name}</option>";
}
echo '</select>';
}
?>
<?php
$categories = get_terms('direction', 'orderby=name&hide_empty=0');
if($categories){
echo '<select name="foo"><option value="card-item">Любое</option>';
foreach ($categories as $cat){
echo "<option value='direction-{$cat->term_id}'>{$cat->name}</option>";
}
echo '</select>';
}
?>
Оно сохраняет по id ИЛИ имени
Можешь подправить, чтоб сохраняло по чему-то одному. Или по id и по имени одновременно
<select name="foo">
<option value="1">Борода</option>
<option value="2">Усы</option>
<option value="3">Расчестка</option>
<option value="4">Карлосон</option>
</select>
<select name="foo">
<option value="1">Борода</option>
<option value="2">Усы</option>
<option value="3">Расчестка</option>
<option value="4">Карлосон</option>
</select>
<?php
$categories = get_terms('direction', 'orderby=name&hide_empty=0');
if($categories){
echo '<select name="foo" id="direction1"><option value="card-item">Любое</option>';
foreach ($categories as $cat){
echo "<option value='direction-{$cat->term_id}'>{$cat->name}</option>";
}
echo '</select>';
}
?>
<?php
$categories = get_terms('direction', 'orderby=name&hide_empty=0');
if($categories){
echo '<select name="foo"><option value="card-item">Любая</option>';
foreach ($categories as $cat){
echo "<option value='direction-{$cat->term_id}'>{$cat->name}</option>";
}
echo '</select>';
}
?>