This is a very simple plugin that uses Javascript to form a collapsable set of
这是一个非常简单的插件,使用Javascript构成了一组可折叠的
links in the sidebar for the pages.
页面侧边栏中的链接。
Every page corresponding to a given
每个页面对应一个给定的
parent page will be expanded.
父页面将被展开。 p>
It is largely based off of my Collapsing Pages and Collapsing Archives
它主要基于我的折叠页面和折叠存档
plugins.
插件。 p>
What’s new?
有什么新消息? h3>
1.0.1 (2016.05.09)
1.0.1(2016.05.09) p>
- Fixed bug where sometimes setting accordion to false broke javascript
- 修复了有时将手风琴设置为false会破坏javascript的错误 li>
ul>
li>
1.0 (2015.08.12)
1.0(2015.08.12) p>
li>
ul>
Options
选项 h3>
If using the manual version, you can pass options either as an array, or using
如果使用手动版本,则可以将选项作为数组或使用
进行传递
the query style, just like for other wordpress functions such as
查询样式,就像其他wordpress函数一样,例如
wp_list_pages
wp_list_pages p>
$defaults=array( $ defaults = array( 'title' => __('Pages', 'collapsing-pages'),
'title'=> __('Pages','collapsing-pages'),
'sortOrder'=> 'ASC' ,
'sortOrder'=>'ASC',
'sort'=> 'pageName' ,
'sort'=>'pageName',
'defaultExpand'=> '',
'defaultExpand'=>'',
'expand' => 0,
'expand'=> 0,
'depth' =>-1,
'深度'=>-1,
'inExcludePage' => 'exclude',
'inExcludePage'=>'排除',
'linkToPage' => true,
'linkToPage'=>是,
'inExcludePages' => '',
'inExcludePages'=>'',
'showPosts' => false,
'showPosts'=>否,
'animate' => 0,
'animate'=> 0,
'useCookies' => true,
'useCookies'=>是,
'postTitleLength' => 0,
'postTitleLength'=> 0,
'showTopLevel' => true,
'showTopLevel'=>是,
'currentPageOnly' => false,
'currentPageOnly'=>否,
'debug' => false,
'调试'=>否,
);
);
code> pre>
- inExcludePage
- inExcludePage
- Whether to include or exclude certain pages
- 是包含还是排除某些页面
- ‘exclude’ (default)
- “排除”(默认) li>
- ‘include’
- “包含” li>
ul>
li>
ul>
li>
- inExcludePages
- inExcludePages
- The pages which should be included or excluded
- 应包含或排除的页面 li>
ul>
li>
- showPosts
- showPosts
- Whether or not to include posts as well as pages.
- 是否包括帖子和页面。
Default if false
默认为false li>
ul>
li>
- linkToPage
- linkToPage
- True, clicking on a parent page title will link to that page (default)
- 是的,单击父页面标题将链接到该页面(默认) li>
- False, clicking on a parent page will expand to show sub-pages
- 错误,单击父页面将展开以显示子页面 li>
ul>
li>
- sort
- 排序
- How to sort the pages.
- 如何对页面进行排序。
Possible values:
可能的值:
- ‘pageName’ the title of the page (default)
- “ pageName”页面标题(默认) li>
- ‘pageId’ the Id of the page
- “ pageId”页面的ID li>
- ‘pageSlug’ the url of the page
- “ pageSlug”页面的网址 li>
- ‘menuOrder’ custom order specified in the pages settings
在页面设置中指定的
- “ menuOrder”自定义订单 li>
ul>
li>
ul>
li>
- sortOrder
- sortOrder
- Whether pages 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>
- animate
- 动画
- When set to true, collapsing and expanding will be animated
- 设置为true时,折叠和展开将被动画化 li>
ul>
li>
- useCookies
- useCookies
li>
- showTopLevel
- showTopLevel
- True – show top level pages (default)
- True –显示顶层页面(默认) li>
- False – only display sub-pages and below
- False –仅显示子页面及以下 li>
ul>
li>
- currentPageOnly
- currentPageOnly
- True – show only parent and sub pages of the current page
- True –仅显示当前页面的父页面和子页面 li>
- False – show all pages (subject to the include or exclude parameters
- False –显示所有页面(取决于包含或排除参数
set) (default)
设置)(默认) li>
ul>
li>
- debug
- 调试
li>
ul>
Examples
示例 h4>
collapsPage('animate=true&sort=ASC&expand=3,inExcludePages=about') collapsPage('animate = true&sort = ASC&expand = 3,inExcludePages = about')
code> pre>
This will produce a list with:
这将产生带有以下内容的列表:
* animation on
*动画
* shown in alphabetical order
*以字母顺序显示
* using images to mark collapsing and expanding
*使用图像标记折叠和展开
* exclude page about
*排除有关页面 p>
Demo
演示 h3>
I use this plugin in my blog at http://blog.robfelty.com
我在http://blog.robfelty.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 pages will still work (which is the default
帖子,但指向页面的链接仍然有效(这是默认设置
behavior in wordpress anyways)
反而在wordpress中的行为) p>