我有一个主题,它有一个类别参数,但是它以错误的顺序显示它们
<?php
$categories= get_categories(\'taxonomy=types&title_li=\'); foreach ($categories as $category){ ?>
我想让它在slug中显示这个,比如说,这样它们就可以按顺序排列。
我会添加以下论点吗?
<?php
$categories= get_categories(\'taxonomy=types&title_li=\' \'orderby\' => \'name\',); foreach ($categories as $category){ ?>
这是完整类别查询,只是将其按错误的顺序排列:
<?php $categories= get_categories(\'taxonomy=types&title_li=\'); foreach ($categories as $category){ ?>
<?php //print_r(get_term_link($category->slug, \'types\')) ?>
<li><a href="<?php echo get_term_link($category->slug, \'types\') ?>" class="<?php echo $category->category_nicename;?>" data-type="<?php echo $category->category_nicename;?>"><?php echo $category->name;?></a></li>