Collapsing Categories creates an expandable list of categories and
“崩溃类别”创建类别的可扩展列表,并且
subcategories.
子类别。
It can also expand to show posts.
它也可以展开以显示帖子。
The primary usage is as a
主要用法是
widget, but you can also use the code in your theme manually if you wish (see
小部件,但您也可以根据需要手动使用主题中的代码(请参见
installation instructions)
安装说明) p>
Options
选项 h3>
Style options can be set via the settings panel.
可以通过设置面板设置样式选项。
All other options can be set
可以设置所有其他选项
from the widget panel.
从小部件面板中。
If you wish to insert the code into your theme manually
如果您希望将代码手动插入主题中
instead of using a widget, you can use the following options.
除了使用小部件,您还可以使用以下选项。
These options
这些选项
can be given to the collapsCat()
function either as an array or in query
可以作为数组或在查询中赋予 collapsCat() code>函数
style, in the same manner as the wp_list_categories
function.
样式,与 wp_list_categories code>函数的方式相同。 p>$defaults=array( $ defaults = array( 'showPostCount' => true,
'showPostCount'=>是,
'inExclude' => 'exclude',
'inExclude'=>'排除',
'inExcludeCats' => '',
'inExcludeCats'=>'',
'showPosts' => true,
'showPosts'=>是,
'showPages' => false,
'showPages'=>否,
'linkToCat' => true,
'linkToCat'=>是,
'olderThan' => 0,
'olderThan'=> 0,
'excludeAll' => '0',
'excludeAll'=>'0',
'catSortOrder' => 'ASC',
'catSortOrder'=>'ASC',
'catSort' => 'catName',
'catSort'=>'catName',
'postSortOrder' => 'ASC',
'postSortOrder'=>'ASC',
'postSort' => 'postTitle',
'postSort'=>'postTitle',
'expand' => '0',
'展开'=>'0',
'defaultExpand' => '',
'defaultExpand'=>'',
'postTitleLength' => 0,
'postTitleLength'=> 0,
'accordion' => 0,
'手风琴'=> 0,
'catfeed' => 'none',
'catfeed'=>'无',
'taxonomy' => 'category',
'分类法'=>'类别',
'showPostDate' => false,
'showPostDate'=>否,
'postDateAppend' => 'after',
'postDateAppend'=>'之后',
'postDateFormat' => 'm/d',
'postDateFormat'=>'m / d',
'useCookies' => true,
'useCookies'=>是,
'showTopLevel' => true,
'showTopLevel'=>是,
'postsBeforeCats' => false,
'postsBeforeCats'=>否,
'expandCatPost' => true,
'expandCatPost'=>是,
'debug'=>'0'
'调试'=>'0'
);
);
code> pre>
- inExclude
- in排除
- Whether to include or exclude certain categories
- 是否包括或排除某些类别
- ‘exclude’ (default)
- “排除”(默认) li>
- ‘include’
- “包含” li>
ul>
li>
ul>
li>
- inExcludeCats
- inExcludeCats
- The categories which should be included or excluded
- 应包括或排除的类别 li>
ul>
li>
- showPages
- showPages
- Whether or not to include pages as well as posts.
- 是否包括页面和帖子。
Default if false
默认为false li>
ul>
li>
- linkToCat
- linkToCat
- 1 (true), clicking on a category title will link to the category archive (default)
- 1(true),单击类别标题将链接到类别存档(默认) li>
- 0 (false), clicking on a category title expands and collapses
- 0(否),单击类别标题将展开和折叠 li>
ul>
li>
- catSort
- catSort
- How to sort the categorys.
- 如何对类别进行排序。
Possible values:
可能的值:
- ‘catName’ the title of the category (default)
- “ catName”类别的标题(默认) li>
- ‘catId’ the Id of the category
- “ catId”类别的ID li>
- ‘catSlug’ the url of the category
- “ catSlug”类别的网址 li>
- ‘catCount’ the number of posts in the category
- “ catCount”类别中的帖子数 li>
- ‘catOrder’ custom order specified in the categorys settings
在类别设置中指定的
- “ catOrder”自定义订单 li>
ul>
li>
ul>
li>
- catSortOrder
- catSortOrder
- Whether categories should be sorted in normal or reverse
- 类别应按正序还是反向排序
order.
订购。
Possible values:
可能的值: p>
- ‘ASC’ normal order (a-z 0-9) (default)
- “ ASC”正常顺序(a-z 0-9)(默认) li>
- ‘DESC’ reverse order (z-a 9-0)
- “ DESC”逆序(z-a 9-0) li>
ul>
li>
ul>
li>
- postSort
- postSort
- How to sort the posts.
- 如何对帖子进行排序。
Possible values:
可能的值:
- ‘postDate’ the date of the post (default)
- “ postDate”发布日期(默认) li>
- ‘postId’ the Id of the post
- “ postId”帖子的ID li>
- ‘postTitle’ the title of the post
- “ postTitle”帖子标题 li>
- ‘postComment’ the number of comments on the post
- “ postComment”对帖子的评论数 li>
- ‘postOrder’ sort by menu order
- “ postOrder”按菜单顺序排序 li>
ul>
li>
ul>
li>
- postSortOrder
- postSortOrder
- Whether post should be sorted in normal or reverse
- 帖子应按正常还是反向排序
order.
订购。
Possible values:
可能的值: p>
- ‘ASC’ normal order (a-z 0-9) (default)
- “ ASC”正常顺序(a-z 0-9)(默认) li>
- ‘DESC’ reverse order (z-a 9-0)
- “ DESC”逆序(z-a 9-0) li>
ul>
li>
ul>
li>
- expand
- 展开
- The symbols to be used to mark expanding and collapsing.
- 用于标记展开和折叠的符号。
Possible values:
可能的值:
- ‘0’ Triangles (default)
- “ 0”个三角形(默认值) li>
- ‘1’ + –
- ‘1’+ – li>
- ‘2’ [+] [-]
- ‘2’[+] [-] li>
- ‘3’ images (you can upload your own if you wish)
- “ 3”张图片(如果需要,您可以上传自己的图片) li>
- ‘4’ custom symbols
- “ 4”个自定义符号 li>
ul>
li>
ul>
li>
- customExpand
- customExpand
li>
- customCollapse
- customCollapse
li>
- postTitleLength
- postTitleLength
- Truncate post titles to this number of characters (default: 0 = don’t
- 将帖子标题截断为此字符数(默认值:0 =否
truncate)
截断) li>
ul>
li>
- accordion
- 手风琴
- When set to true, expanding one category closes all others at that level
- 设置为true时,扩展一个类别将关闭该级别的所有其他 li>
ul>
li>
- catfeed
- catfeed
- Whether to add a link to the rss feed for a category.
- 是否为类别的rss feed添加链接。
Possible values:
可能的值:
- ‘none’ (default)
- “无”(默认) li>
- ‘text’ shows RSS
- “文字”显示RSS li>
- ‘image’ shows an RSS icon
- “图像”显示一个RSS图标 li>
ul>
li>
ul>
li>
- taxonomy
- 分类
- Type of taxonmy to display.
- 要显示的分类类型。
Possible values:
可能的值:
- ‘category’ (default)
- “类别”(默认) li>
- ‘link_category’
- “ link_category” li>
- ‘post_tag’
- “ post_tag” li>
- ‘both’ (categories and tags)
- “两者”(类别和标签) li>
- any other registered taxononmy (e.g. recipe press uses recipe-categories)
- 任何其他注册分类标准(例如,配方印刷机使用配方分类) li>
ul>
li>
ul>
li>
- showPostDate
- showPostDate
- When true, show the date of each post
- 为true时,显示每个帖子的日期 li>
ul>
li>
- postDateAppend
- postDateAppend
- Show the date before or after the post title.
- 在帖子标题之前或之后显示日期。
Possible values:
可能的值:
- ‘after’ (default)
- “之后”(默认) li>
- ‘before’
- “之前” li>
ul>
li>
ul>
li>
- postDateFormat
- postDateFormat
- What format the post date is in. This uses the standard php date
- 发布日期采用哪种格式。这使用标准的php日期
formatting codes
格式代码 li>
ul>
li>
- useCookies
- useCookies
li>
- showTopLevel
- showTopLevel
li>
- postsBeforeCats
- postsBeforeCats
li>
- expandCatPost
- expandCatPost
li>
- showEmptyCat
- showEmptyCat
- When set to true, empty categories are shown
- 设置为true时,显示空白类别
- 0 (false) (default)
- 0(假)(默认) li>
- 1 (true)
- 1(真实) li>
ul>
li>
ul>
li>
- debug
- 调试
li>
ul>
Examples
示例 h4>
collapsCat('animate=1&catSort=ASC&expand=3&inExcludeCats=general,uncategorized') collapsCat('animate = 1&catSort = ASC&expand = 3&inExcludeCats = general,uncategorized')
code> pre>
This will produce a list with:
这将产生带有以下内容的列表:
* animation on
*动画
* categories shown in alphabetical order
*按字母顺序显示的类别
* using images to mark collapsing and expanding
*使用图像标记折叠和展开
* exclude posts from the categories general and uncategorized
*从常规和未分类类别中排除帖子 p>
Demo
演示 h3>
I use this plugin in my blog at http:/obfelty.com
我在http:/obfelty.com的博客中使用此插件 p>
CAVEAT
CAVEAT h3>
Currently this plugin relies on Javascript to expand and collapse the links.
当前,该插件依赖Javascript来扩展和折叠链接。
If a user’s browser doesn’t support javascript they won’t see the links to the
如果用户的浏览器不支持javascript,则不会看到指向
的链接
posts, but the links to the categories will still work (which is the default
帖子,但指向类别的链接仍然有效(这是默认设置
behavior in wordpress anyways)
反而在wordpress中的行为) p>