get_categories
不允许您设置rand
像orderby
阿飞,但这没什么大不了的。它返回一个数组,因此在您的情况下,您所要做的就是洗牌该数组:
<?php
$categories = get_categories( array(
\'orderby\' => \'name\',
\'order\' => \'ASC\',
\'exclude\' => \'all\',
\'include\' => \'135,19,124,133,126\',
) );
shuffle ( $categories );
foreach ($categories as $category) {
echo \'<div class="category-list">\';
echo \'<a href="\' . get_category_link( $category->term_id ) . \' "><div class="image_wrapper2 is-image list-image">\'. do_shortcode(sprintf(\'[wp_custom_image_category term_id="%s"]\',$category->term_id)). \'</div></a>\' ;
echo \'<div class="image-category-mosje"><h2 class="title-category"><a href=" \' . get_category_link( $category->term_id ) . \' "> \'.$category->name.\' </a></h2></div>\';
echo \'<span class="category-count"> \' . $category->count . \'</span>\';
echo \'</div>\';
}
?>