我正在尝试使用WordPress的内置函数来调用类别列表。不幸的是,对于如何抽取最受欢迎的类别(比如前5名),似乎没有任何争议。我正在使用下面的代码,这是拉在所有类别。你知道我如何修改它来显示前5个最常用的类别吗?
<?php
$args = array(
\'show_option_all\' => \'\',
\'orderby\' => \'name\',
\'order\' => \'ASC\',
\'style\' => \'list\',
\'show_count\' => 0,
\'hide_empty\' => 1,
\'use_desc_for_title\' => 1,
\'child_of\' => 0,
\'feed\' => \'\',
\'feed_type\' => \'\',
\'feed_image\' => \'\',
\'exclude\' => \'1\',
\'exclude_tree\' => \'\',
\'include\' => \'\',
\'hierarchical\' => 1,
\'title_li\' => __( \'\' ),
\'show_option_none\' => __( \'\' ),
\'number\' => 5, // limits the number of displayed categories
\'echo\' => 1,
\'depth\' => 0,
\'current_category\' => 0,
\'pad_counts\' => 0,
\'taxonomy\' => \'category\',
\'walker\' => null,
);
wp_list_categories( $args );
?>