我使用此选项显示所有类别:
<?php $args = array(
\'child_of\' => 0,
\'current_category\' => 0,
\'depth\' => 0,
\'echo\' => 1,
\'exclude\' => \'\',
\'exclude_tree\' => \'\',
\'feed\' => \'\',
\'feed_image\' => \'\',
\'feed_type\' => \'\',
\'hide_empty\' => 1,
\'hide_title_if_empty\' => false,
\'hierarchical\' => true,
\'order\' => \'ASC\',
\'orderby\' => \'name\',
\'separator\' => \' \',
\'show_count\' => 0,
\'show_option_all\' => \'\',
\'style\' => \'h3\',
\'taxonomy\' => \'category\',
\'title_li\' => __( \'Categories\' ),
\'use_desc_for_title\' => 1,
);
var_dump( wp_list_categories($args) ); ?>
但它也给了我一个词;空;。
如何删除;空“;?
最合适的回答,由SO网友:gimsech 整理而成
我解决了它。看来空值是通过$args
.
<?php wp_list_categories( array(
\'child_of\' => 0,
\'depth\' => 0,
\'echo\' => 1,
\'exclude\' => \'\',
\'exclude_tree\' => \'\',
\'feed\' => \'\',
\'feed_image\' => \'\',
\'feed_type\' => \'\',
\'hide_empty\' => 0,
\'hide_title_if_empty\' => 1,
\'hierarchical\' => 0,
\'order\' => \'ASC\',
\'orderby\' => \'title\',
\'separator\' => \' \',
\'show_count\' => 0,
\'show_option_all\' => \'A – Z | \',
\'style\' => 0,
\'taxonomy\' => \'category\',
\'use_desc_for_title\' => 1
) ); ?>