[wordpress插件] Collapsing Categories折叠类别

wordpress 插件 文章 2020-03-27 12:30 0 79 全屏看文
评分
84
描述

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)

安装说明)

Options

选项

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()函数

style, in the same manner as the wp_list_categories function.

样式,与 wp_list_categories 函数的方式相同。

$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'

);

);

    • inExclude

    • in排除

        • Whether to include or exclude certain categories

        • 是否包括或排除某些类别

            • ‘exclude’ (default)
            • “排除”(默认)

            • ‘include’
            • “包含”

        • inExcludeCats

        • inExcludeCats

            • The categories which should be included or excluded
            • 应包括或排除的类别

          • showPages

          • showPages

              • Whether or not to include pages as well as posts.

              • 是否包括页面和帖子。

                Default if false

              • 默认为false

            • linkToCat

            • linkToCat

                • 1 (true), clicking on a category title will link to the category archive (default)
                • 1(true),单击类别标题将链接到类别存档(默认)

                • 0 (false), clicking on a category title expands and collapses
                • 0(否),单击类别标题将展开和折叠

              • catSort

              • catSort

                  • How to sort the categorys.

                  • 如何对类别进行排序。

                    Possible values:

                    可能的值:

                      • ‘catName’ the title of the category (default)
                      • “ catName”类别的标题(默认)

                      • ‘catId’ the Id of the category
                      • “ catId”类别的ID

                      • ‘catSlug’ the url of the category
                      • “ catSlug”类别的网址

                      • ‘catCount’ the number of posts in the category
                      • “ catCount”类别中的帖子数

                      • ‘catOrder’ custom order specified in the categorys settings
                      • 在类别设置中指定的

                      • “ catOrder”自定义订单

                  • catSortOrder

                  • catSortOrder

                      • Whether categories should be sorted in normal or reverse

                      • 类别应按正序还是反向排序

                        order.

                        订购。

                        Possible values:

                        可能的值:

                          • ‘ASC’ normal order (a-z 0-9) (default)
                          • “ ASC”正常顺序(a-z 0-9)(默认)

                          • ‘DESC’ reverse order (z-a 9-0)
                          • “ DESC”逆序(z-a 9-0)

                      • postSort

                      • postSort

                          • How to sort the posts.

                          • 如何对帖子进行排序。

                            Possible values:

                            可能的值:

                              • ‘postDate’ the date of the post (default)
                              • “ postDate”发布日期(默认)

                              • ‘postId’ the Id of the post
                              • “ postId”帖子的ID

                              • ‘postTitle’ the title of the post
                              • “ postTitle”帖子标题

                              • ‘postComment’ the number of comments on the post
                              • “ postComment”对帖子的评论数

                              • ‘postOrder’ sort by menu order
                              • “ postOrder”按菜单顺序排序

                          • postSortOrder

                          • postSortOrder

                              • Whether post should be sorted in normal or reverse

                              • 帖子应按正常还是反向排序

                                order.

                                订购。

                                Possible values:

                                可能的值:

                                  • ‘ASC’ normal order (a-z 0-9) (default)
                                  • “ ASC”正常顺序(a-z 0-9)(默认)

                                  • ‘DESC’ reverse order (z-a 9-0)
                                  • “ DESC”逆序(z-a 9-0)

                              • expand

                              • 展开

                                  • The symbols to be used to mark expanding and collapsing.

                                  • 用于标记展开和折叠的符号。

                                    Possible values:

                                    可能的值:

                                      • ‘0’ Triangles (default)
                                      • “ 0”个三角形(默认值)

                                      • ‘1’ + –
                                      • ‘1’+ –

                                      • ‘2’ [+] [-]
                                      • ‘2’[+] [-]

                                      • ‘3’ images (you can upload your own if you wish)
                                      • “ 3”张图片(如果需要,您可以上传自己的图片)

                                      • ‘4’ custom symbols
                                      • “ 4”个自定义符号

                                  • customExpand

                                  • customExpand

                                      • If you have selected ‘4’ for the expand option, this character will be

                                      • 如果您为扩展选项选择了“ 4”,则此字符将为

                                        used to mark expandable link categories

                                      • 用于标记可扩展链接类别

                                    • customCollapse

                                    • customCollapse

                                        • If you have selected ‘4’ for the expand option, this character will be

                                        • 如果您为扩展选项选择了“ 4”,则此字符将为

                                          used to mark collapsible link categories

                                        • 用于标记可折叠的链接类别

                                      • postTitleLength

                                      • postTitleLength

                                          • Truncate post titles to this number of characters (default: 0 = don’t

                                          • 将帖子标题截断为此字符数(默认值:0 =否

                                            truncate)

                                          • 截断)

                                        • accordion

                                        • 手风琴

                                            • When set to true, expanding one category closes all others at that level
                                            • 设置为true时,扩展一个类别将关闭该级别的所有其他

                                          • catfeed

                                          • catfeed

                                              • Whether to add a link to the rss feed for a category.

                                              • 是否为类别的rss feed添加链接。

                                                Possible values:

                                                可能的值:

                                                  • ‘none’ (default)
                                                  • “无”(默认)

                                                  • ‘text’ shows RSS
                                                  • “文字”显示RSS

                                                  • ‘image’ shows an RSS icon
                                                  • “图像”显示一个RSS图标

                                              • taxonomy

                                              • 分类

                                                  • Type of taxonmy to display.

                                                  • 要显示的分类类型。

                                                    Possible values:

                                                    可能的值:

                                                      • ‘category’ (default)
                                                      • “类别”(默认)

                                                      • ‘link_category’
                                                      • “ link_category”

                                                      • ‘post_tag’
                                                      • “ post_tag”

                                                      • ‘both’ (categories and tags)
                                                      • “两者”(类别和标签)

                                                      • any other registered taxononmy (e.g. recipe press uses recipe-categories)
                                                      • 任何其他注册分类标准(例如,配方印刷机使用配方分类)

                                                  • showPostDate

                                                  • showPostDate

                                                      • When true, show the date of each post
                                                      • 为true时,显示每个帖子的日期

                                                    • postDateAppend

                                                    • postDateAppend

                                                        • Show the date before or after the post title.

                                                        • 在帖子标题之前或之后显示日期。

                                                          Possible values:

                                                          可能的值:

                                                            • ‘after’ (default)
                                                            • “之后”(默认)

                                                            • ‘before’
                                                            • “之前”

                                                        • postDateFormat

                                                        • postDateFormat

                                                            • What format the post date is in. This uses the standard php date

                                                            • 发布日期采用哪种格式。这使用标准的php日期

                                                              formatting codes

                                                            • 格式代码

                                                          • useCookies

                                                          • useCookies

                                                              • When true, expanding and collapsing of categories is remembered for each

                                                              • 为true时,会记住每个类别的扩展和折叠

                                                                visitor.

                                                                游客。

                                                                When false, categories are always display collapsed (unless

                                                                如果为false,则类别始终显示为折叠状态(除非

                                                                explicitly set to auto-expand).

                                                                明确设置为自动展开)。

                                                                Possible values:

                                                                可能的值:

                                                                  • 1 (true) (default)
                                                                  • 1(真)(默认)

                                                                  • 0 (false)
                                                                  • 0(假)

                                                              • showTopLevel

                                                              • showTopLevel

                                                                  • When set to false, the top level category will not be shown.

                                                                  • 设置为false时,不会显示顶级类别。

                                                                    This could

                                                                    这可能

                                                                    be useful if you only want to show subcategories from one particular

                                                                    如果只想显示某一特定类别的子类别,则很有用

                                                                    top-level category

                                                                    顶级类别

                                                                      • 1 (true) (default)
                                                                      • 1(真)(默认)

                                                                      • 0 (false)
                                                                      • 0(假)

                                                                  • postsBeforeCats

                                                                  • postsBeforeCats

                                                                      • When set to true, posts in category X will be ordered before

                                                                      • 设置为true时,类别X中的帖子将在之前排序

                                                                        subcategories of category X

                                                                        X类别的子类别

                                                                          • 1 (true)
                                                                          • 1(是)

                                                                          • 0 (false) (default)
                                                                          • 0(假)(默认)

                                                                      • expandCatPost

                                                                      • expandCatPost

                                                                          • When set to true, any category to which a post is assigned will

                                                                          • 设置为true时,将为其分配帖子的任何类别

                                                                            automatically be expanded on a single post page.

                                                                            自动在单个帖子页面上展开。

                                                                              • 1 (true) (default)
                                                                              • 1(真)(默认)

                                                                              • 0 (false)
                                                                              • 0(假)

                                                                          • showEmptyCat

                                                                          • showEmptyCat

                                                                              • When set to true, empty categories are shown

                                                                              • 设置为true时,显示空白类别

                                                                                  • 0 (false) (default)
                                                                                  • 0(假)(默认)

                                                                                  • 1 (true)
                                                                                  • 1(真实)

                                                                              • debug

                                                                              • 调试

                                                                                  • When set to true, extra debugging information will be displayed in the

                                                                                  • 设置为true时,其他调试信息将显示在

                                                                                    underlying code of your page (but not visible from the browser).

                                                                                    页面的基础代码(但在浏览器中不可见)。

                                                                                    Use

                                                                                    使用

                                                                                    this option if you are having problems

                                                                                  • 如果您遇到问题,请选择此选项

                                                                                Examples

                                                                                示例

                                                                                collapsCat('animate=1&catSort=ASC&expand=3&inExcludeCats=general,uncategorized')

                                                                                  collapsCat('animate = 1&catSort = ASC&expand = 3&inExcludeCats = general,uncategorized')

                                                                                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

                                                                                *从常规和未分类类别中排除帖子

                                                                                Demo

                                                                                演示

                                                                                I use this plugin in my blog at http:/obfelty.com

                                                                                我在http:/obfelty.com的博客中使用此插件

                                                                                CAVEAT

                                                                                CAVEAT

                                                                                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中的行为)

安装步骤

IMPORTANT!

重要!

Please deactivate before upgrading, then re-activate the plugin.

请在升级之前先停用它,然后重新激活该插件。

Unpackage contents to wp-content/plugins/ so that the files are in a

将内容解压缩到wp-content / plugins /中,以便文件位于

collapsing-categories directory.

崩溃类别目录。

Widget installation

小部件安装

Activate the plugin, then simply go the

激活插件,然后只需

Presentation > Widgets section and drag over the Collapsing Categories Widget.

演示>窗口小部件部分,然后将鼠标悬停在折叠类别窗口小部件上。

Manual installation

手动安装

Activate the plugin, then insert the following into your template: (probably

激活插件,然后将以下内容插入模板:(可能

in sidebar.php).

在sidebar.php中)。

See the Options section for more information on specifying

有关指定
的更多信息,请参见“选项”部分。

options.

选项。

  <?php

echo "

    \n";

    回声“

      \ n”;

      if (function_exists('collapsCat')) {  

      如果(function_exists('collapsCat')){  

      collapsCat();

      collapsCat();

      } else {  

      }其他{  

      wp_get_categories('your_options_here');

      wp_get_categories('your_options_here');

      }

      }

      echo "

    \n";

    回显“ \ n”;

    ?>

    ?>

下载地址
https://downloads.wordpress.org/plugin/collapsing-categories.zip
-EOF-