wp获取分类wp_list_categories($args);

142 阅读1分钟

    <?php $args = array(
'show_option_all'    => '',
'orderby'            => 'name',
'order'              => 'ASC',
'style'              => 'list',
'show_count'         => 0,
'hide_empty'         => 0,
'use_desc_for_title' => 1,
'child_of'           => 0,
'feed'               => '',
'feed_type'          => '',
'feed_image'         => '',
'exclude'            => '',
'exclude_tree'       => '',
'include'            => '',
'hierarchical'       => 1,
'title_li'           => _( 'Categories' ),
'show_option_none'   => _
('No categories'),
'number'             => null,
'echo'               => 1,
'depth'              => 0,
'current_category'   => 0,
'pad_counts'         => 0,
'taxonomy'           => 'category',
'walker'             => null
); 
wp_list_categories($args);
?>

 

 

<?php

 `` wp_list_categories( ``$args );

$args = ``array``(

 ``'show_option_all'  => ``''``,``//是否列出分类链接

 ``'orderby'      => ``'name'``,``//按名称排列

 ``'order'       => ``'ASC'``,``//升、降序

 ``'style'       => ``'list'``,``//是否用列表(ul>li)

 ``'show_count'     => 0,``//是否显示文章数量

 ``'hide_empty'     => 1,``//是否显示无日志分类

 ``'use_desc_for_title' => 1,``//是否显示分类描述

 ``'child_of'      => 0,``//是否限制子分类

 ``'feed'        => ``''``,``//是否显示rss

 ``'feed_type'     => ``''``,``//rss类型

 ``'feed_image'     => ``''``,``//是否显示rss图片

 ``'exclude'      => ``''``,``//排除分类的ID,多个用',(英文逗号)'分隔

 ``'exclude_tree'    => ``''``,``//排除分类树,即父分类及其下的子分类

 ``'include'      => ``''``,``//包括的分类

 ``'hierarchical'    => true,``//是否将子、父分类分级

 ``'title_li'      => __( ``'Categories' ),``//列表标题的名称

 ``'show_option_none'  => __(``'No categories'``),``//无分类时显示的标题

 ``'number'       => null,``//显示分类的数量

 ``'echo'        => 1,``//是否显示,显示或者返回字符串

 ``'depth'       => 0,``//层级限制

 ``'current_category'  => 0,``//添加一个没有的分类

 ``'pad_counts'     => 0,``//这个我也不明白

 ``'taxonomy'      => ``'category'``,``//使用的分类法

 ``'walker'       => null``//用于显示的类(很复杂的概念)

?>