[wordpress插件] Collapsing Archives崩溃的档案

wordpress 插件 文章 2020-03-27 12:21 393 0 全屏看文

AI助手支持GPT4.0

评分
94
描述

This is a relatively simple plugin that uses Javascript to

这是一个使用Javascript的相对简单的插件,

make the Archive links in the sidebar collapsable by year and/or month.

使边栏中的“存档”链接可以按年份和/或月份折叠。

Demo

演示

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

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

OPTIONS AND CONFIGURATIONS

选项和配置

$defaults=array(  

  $ defaults = array(  

'noTitle' => '',  

'noTitle'=>'',  

'inExcludeCat' => 'exclude',  

'inExcludeCat'=>'排除',  

'inExcludeCats' => '',  

'inExcludeCats'=>'',  

'inExcludeYear' => 'exclude',  

'inExcludeYear'=>'排除',  

'inExcludeYears' => '',  

'inExcludeYears'=>'',  

'sort' => 'DESC',  

'sort'=>'DESC',  

'showPages' => false,  

'showPages'=>否,  

'linkToArch' => true,  

'linkToArch'=>是,  

'showYearCount' => true,  

'showYearCount'=>是,  

'expandCurrentYear' => true,  

'expandCurrentYear'=>是,  

'expandMonths' => true,  

'expandMonths'=>是,  

'expandYears' => true,  

'expandYears'=>是,  

'expandCurrentMonth' => true,  

'expandCurrentMonth'=>是,  

'showMonthCount' => true,  

'showMonthCount'=>是,  

'showPostTitle' => true,  

'showPostTitle'=>是,  

'expand' => '0',  

'展开'=>'0',  

'showPostDate' => false,  

'showPostDate'=>否,  

'postDateFormat' => 'm/d',  

'postDateFormat'=>'m / d',  

'postDateAppenc' => 'after',  

'postDateAppenc'=>'之后',  

'accordion' => 0,  

'手风琴'=> 0,  

'postTitleLength' => '',  

'postTitleLength'=>'',  

'post_type' => 'post',  

'post_type'=>'post',  

'debug' => '0',  

'调试'=>'0',  

);

);

    • noTitle

    • noTitle

        • If your posts don’t have title, specify a string to show in place of the

        • 如果您的帖子没有标题,请指定一个字符串以代替

          title

        • 标题

      • inExcludeCat

      • inExcludeCat

          • Whether to include or exclude certain categories

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

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

              • ‘include’
              • “包含”

          • inExcludeCats

          • inExcludeCats

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

            • inExcludeYear

            • 在ExcludeYear

                • Whether to include or exclude certain years

                • 是否包括或排除某些年份

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

                    • ‘include’
                    • “包含”

                • inExcludeYears

                • 在不包括年份

                    • The years which should be included or excluded
                    • 应包含或排除的年份

                  • showPages

                  • showPages

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

                      • 是否包括页面和帖子。

                        Default if false

                      • 默认为false

                    • showYearCount

                    • showYearCount

                        • When true, the number of posts in the year will be shown in parentheses
                        • 为true时,一年中的帖子数将显示在括号中

                      • showMonthCount

                      • showMonthCount

                          • When true, the number of posts in the month will be shown in parentheses
                          • 为true时,该月的帖子数将显示在括号中

                        • linkToArch

                        • linkToArch

                            • 1 (true), clicking on a the month or year will link to the archive (default)
                            • 1(true),单击月份或年份将链接到存档(默认)

                            • 0 (false), clicking on a month or year expands and collapses
                            • 0(否),单击月份或年份会展开和折叠

                          • sort

                          • 排序

                              • Whether posts should be sorted in chronological or reverse

                              • 帖子应按时间顺序排列还是反向排列

                                chronological order.

                                按时间顺序。

                                Possible values:

                                可能的值:

                                  • ‘DESC’ reverse chronological order (default)
                                  • “ DESC”按时间倒序(默认)

                                  • ‘ASC’ chronological order
                                  • “ ASC”的时间顺序

                              • 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

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

                                      • expandYears

                                        expandYears

                                          • 1 (true): Years collapse and expand to show months (default)
                                          • 1(正确):年折叠并扩展以显示月份(默认)

                                          • 0 (false): Only links to yearly archives are shown
                                          • 0(否):仅显示年度存档的链接

                                        • expandMonths

                                        • expandMonths

                                            • 1 (true): Months collapse and expand to show posts (default)
                                            • 1(true):月折叠并展开以显示帖子(默认)

                                            • 0 (false): Only links to yearly and monthly archives are shown
                                            • 0(假):仅显示年度和每月存档的链接

                                          • expandCurrentMonth

                                          • expandCurrentMonth

                                              • When true, the current month will be expanded by default
                                              • 为true时,默认情况下会扩展当前月份

                                            • expandCurrentYear

                                            • expandCurrentYear

                                                • When true, the current year will be expanded by default
                                                • 为true时,默认情况下将扩展当前年份

                                              • showPostTitle

                                              • showPostTitle

                                                  • 1 (true): The title of each post is shown (default)
                                                  • 1(true):显示每个帖子的标题(默认)

                                                • showPostDate

                                                • showPostDate

                                                    • 1 (true): Show the date of each post
                                                    • 1(true):显示每个帖子的日期

                                                  • postDateFormat

                                                  • postDateFormat

                                                      • The format in which the date should be shown (default: ‘m/d’)
                                                      • 日期显示的格式(默认值:“ m / d”)

                                                    • postDateAppend

                                                    • postDateAppend

                                                        • after: The post date comes after the title (default)
                                                        • 之后:发布日期在标题之后(默认)

                                                        • before: The post date comes before the title
                                                        • 之前:发布日期早于标题

                                                      • postTitleLength

                                                      • postTitleLength

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

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

                                                            truncate)

                                                          • 截断)

                                                        • post_type

                                                        • post_type

                                                            • post (default)
                                                            • 发布(默认)

                                                            • page
                                                            • 页面

                                                            • all (includes regular post types plus any custom post types – excludes

                                                            • 全部(包括常规帖子类型以及任何自定义帖子类型-不包括

                                                              pages, revisions, wp_nav_items, and attachments)

                                                            • 页面,修订,wp_nav_items和附件)

                                                            • custom post type that you have registered (e.g. recipe)
                                                            • 您已注册的自定义帖子类型(例如食谱)

                                                          • accordion

                                                          • 手风琴

                                                              • When set to true, expanding one year will collapse all other years.

                                                              • 设置为true时,扩展一年将折叠其他所有年份。

                                                                Expanding one month will collapse all other months in that year

                                                              • 扩展一个月将使该年的所有其他月份崩溃

                                                            • number

                                                            • 号码

                                                                • If using manually with more than one instance on a page, you can give

                                                                • 如果在页面上手动使用多个实例,则可以给出

                                                                  unique ids to each instance with this option.

                                                                  使用此选项,每个实例的唯一ID。

                                                                  For example, if you had

                                                                  例如,如果您有

                                                                  one instance with number 1 and another with number 2, the ul for March

                                                                  一个实例的编号为1,另一个实例的编号为2,即3月的ul

                                                                  2004 for number 1 would have an id of ‘collapsArch-2004-3:1’, while the

                                                                  1的2004年ID为'collapsArch-2004-3:1',而

                                                                  id for number 2 would be ‘collapsArch-2004-3:2’

                                                                • 2号的ID为“ collapsArch-2004-3:2”

                                                              • 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

                                                                示例

                                                                collapsArch('accordion=1&sort=ASC&expand=3&inExcludeCat=exclude&inExcludeCats=general,uncategorized')

                                                                  collapsArch('accordion = 1&sort = ASC&expand = 3&inExcludeCat = exclude&inExcludeCats = general,uncategorized')

                                                                This will produce a list with:

                                                                这将产生带有以下内容的列表:

                                                                * accordion style expanding and collapsing

                                                                *手风琴样式的扩展和折叠

                                                                * shown in chronological order

                                                                *按时间顺序显示

                                                                * using images to mark collapsing and expanding

                                                                *使用图像标记折叠和展开

                                                                * exclude posts from the categories general and uncategorized

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

                                                                collapsArch('post_type=recipe')

                                                                  collapsArch('post_type = recipe')

                                                                This will produce a list with:

                                                                这将产生带有以下内容的列表:

                                                                * only posts of type ‘recipe’

                                                                *仅类型为“食谱”的帖子

                                                                * shown in chronological order

                                                                *按时间顺序显示

                                                                * using images to mark collapsing and expanding

                                                                *使用图像标记折叠和展开

                                                                * exclude posts from the categories general and uncategorized

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

                                                                CAVEAT

                                                                CAVEAT

                                                                This plugin relies on Javascript, but does degrade

                                                                此插件依赖Javascript,但会降级

                                                                gracefully if it is not present/enabled to show all of the

                                                                如果不存在/未启用,则不能显示所有

                                                                archive links as usual.

                                                                照常存档链接。

安装步骤

IMPORTANT!

重要!

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

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

MANUAL INSTALLATION

手动安装

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

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

collapsing-archives directory.

collapsing-archives目录。

Now enable the plugin.

现在启用插件。

To use the plugin,

要使用该插件,

change the following here appropriate (most likely sidebar.php):

在此处更改以下内容(最可能是sidebar.php):

Change From:

更改自:

         

      
           

      <?php wp_get_archives();

      ?>

      ?>

    To something of the following:

    针对以下情况:

        

      <?php     

    if( function_exists('collapsArch') ) {      

    if(function_exists('collapsArch')){      

    collapsArch();     

    collapsArch();     

    } else {      

    }其他{      

    echo "

      \n";      

      回声“

        \ n”;      

        wp_get_archives();      

        wp_get_archives();      

        echo "

      \n";     

      回显“ \ n”;     

      }    

      }    

      ?>

      ?>

    You can specify options for collapsArch.

    您可以为collapsArch指定选项。

    See options section.

    请参阅选项部分。

    WIDGET INSTALLATION

    小部件安装

    For those who have widget capabilities, (default in WordPress 2.3+), installation is easier.

    对于那些具有小部件功能的用户(WordPress 2.3+中的默认设置),安装更加容易。

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

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

    collapsing-archives directory.

    collapsing-archives目录。

    You must enable the Collapsing Archives

    您必须启用“崩溃存档”

    plugin, then simply go the Presentation > Widgets section and add the

    插件,然后只需转到Presentation> Widgets部分并添加

    Collapsing Archives Widget.

    折叠档案小部件。

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

AI助手支持GPT4.0