我需要将此代码转换为用于在wordpress中选择类别而不是显示图标的选择选项。
<div class="form-main-section classiera-post-cat">
<div class="classiera-post-main-cat">
<h4 class="classiera-post-inner-heading">
<?php esc_html_e('Select an Occasion', 'classiera') ?> :
</h4>
<ul class="list-unstyled list-inline">
<?php
$categories = get_terms('category', array(
'hide_empty' => 0,
'parent' => 0,
'order'=> 'ASC'
)
);
foreach ($categories as $category) {
//print_r($category);
</ul><!--list-unstyled-->
<input class="classiera-main-cat-field" name="classiera-main-cat-field" type="hidden" value="">
</div><!--classiera-post-main-cat-->
<div class="classiera-post-sub-cat">
<h4 class="classiera-post-inner-heading">
<?php esc_html_e('Select a Category', 'classiera') ?> :
</h4>
<ul class="list-unstyled classieraSubReturn">
</ul>
<input class="classiera-sub-cat-field" name="classiera-sub-cat-field" type="hidden" value="">
</div><!--classiera-post-sub-cat-->
<!--ThirdLevel-->
<div class="classiera_third_level_cat">
<h4 class="classiera-post-inner-heading">
<?php esc_html_e('Select a Category', 'classiera') ?> :
</h4>
<ul class="list-unstyled classieraSubthird">
</ul>
<input class="classiera_third_cat" name="classiera_third_cat" type="hidden" value="">
</div>
<!--ThirdLevel-->
</div>
任何帮助将不胜感激。我不需要将所有图标设置为每个类别,只需将类别的名称设置为
。答案 0 :(得分:0)
foreach ($categories as $category) {?>
您需要存储的___ value ___“?>>名称__要显示的名称__?> // print_r($ category);