我正在使用 User-Submitted-Posts 插件,以便让用户将他们的图像提交到我的 wordpress 网站。每个图像都在一个类别中上传。类别在 wordpress 管理区域中设置,并使用以下代码拉入提交表单。
我唯一的问题是,这个 Web 表单按类别 ID 排序而不是按字母顺序排列类别。因此,当我添加一个类别时,即使它以字母 A 开头,它也会出现在底部。
谁能让我知道如何编辑以下代码以按 ASC 字母顺序列出所有类别?
<li class="usp_category">
<label for="user-submitted-category" class="usp_label"><?php _e('Categories'); ?></label>
<div>
<select class="usp_select" name="user-submitted-category" id="user-submitted-category">
<?php foreach($settings['categories'] as $categoryId) { $category = get_category($categoryId); if(!$category) { continue; } ?>
<option class="usp_option" value="<?php echo $categoryId;?> "><?php $category = get_category($categoryId); echo htmlentities($category->name); ?></option>
<?php } ?>
</select>
</div>
</li>