[wordpress插件] Archivist – Custom Archive Templates档案管理员–自定义存档模板

wordpress 插件 文章 2020-02-20 23:20 464 0 全屏看文

AI助手支持GPT4.0

评分
94
描述

Quick Start

快速入门

The plugin assumes your articles are well categorized.

该插件假定您的文章分类正确。

To display the archive, use the shortcode anywhere in a page or article.

要显示档案,请在页面或文章中的任何位置使用简码。

[archivist category="kitten"]

  [档案管理员category =“ kitten”]

[archivist tag="kitten"]

[档案管理员tag =“ kitten”]

Replace “kitten” with your category/tag.

用类别/标签替换“小猫”。

Watch out, we need the slug here.

注意,我们需要这里的弹头。

That’s the name without capital letters and spaces.

那是名字,没有大写字母和空格。

Placeholders

占位符

You can specify a custom template to display the archive elements.

您可以指定一个自定义模板来显示存档元素。

Go to Settings > Archivist for plugin preferences.

转到 Settings> Archivist 获取插件首选项。

Use HTML and any of the following template placeholders.

使用HTML和以下任何模板占位符。

    • %TITLE% – The post title.
    • %TITLE% –帖子标题。

    • %PERMALINK% – The post permalink.
    • %PERMALINK% –帖子永久链接。

    • %AUTHOR% – The post author.
    • %AUTHOR% –帖子作者。

    • %CATEGORIES% – The post categories as unordered list.
    • %CATEGORIES% –帖子类别为无序列表。

    • %CATEGORIES|...% – The post categories with a custom separator.

    • %CATEGORIES | ...% –具有自定义分隔符的帖子类别。

      Example: %CATEGORIES|, %

    • 示例:%CATEGORIES |,%

    • %TAGS% – The post tags with default separator.
    • %TAGS% –具有默认分隔符的帖子标签。

    • %TAGS|...% – The post tags with a custom separator.

    • %TAGS | ...% –具有自定义分隔符的帖子标签。

      Example: %TAGS|, %

    • 示例:%TAGS |,%

    • %EXCERPT% – The post excerpt.
    • %EXCERPT% –文章摘录。

    • %POST_META|...% – Any post meta.

    • %POST_META | ...% –任何帖子元。

      Example: %POST_META|duration%.

    • 示例:%POST_META |持续时间%

    • %POST_META|...|...% – Any post meta list, separated by custom HTML.

    • %POST_META | ... | ...% –任何帖子元列表,以自定义HTML分隔。

      Example: %POST_META|guest|
      %

    • 示例:%POST_META |来宾|

    • %DATE% – The post date with default format.
    • %DATE% –使用默认格式的发布日期。

    • %DATE|...% – The post date with custom format.

    • %DATE | ...% –具有自定义格式的发布日期。

      Example: %DATE|Y/m/d%

    • 示例:%DATE | Y / m / d%

    • %POST_THUMBNAIL|...x...% – The post thumbnail with certain dimensions.

    • %POST_THUMBNAIL | ... x ...% –具有特定尺寸的帖子缩略图。

      Example: %POST_THUMBNAIL|75x75%

    • 示例:%POST_THUMBNAIL | 75x75%

    • %COMMENTS% – The post comment count.
    • %COMMENTS% –帖子评论数。

    • %ACF|field_name% – Display ACF field.

    • %ACF | field_name% –显示 ACF 字段。

      Uses the get_field() function.

    • 使用 get_field() 函数。

    You can add your own placeholders:

    您可以添加自己的占位符:

    add_filter( 'archivist_template_render', function( $template, $post ) {    

      add_filter('archivist_template_render',function($ template,$ post){    

    // modify $template    

    //修改$ template    

    return $template;

    返回$ template;

    }, 10, 2 );

    },10,2);

    Pagination

    分页

    If you have many entries, you may prefer to paginate.

    如果条目很多,则可能需要分页。

    The archivist comes with asynchronous pagination built-in.

    档案管理员内置了异步分页功能。

    Use the pagination parameter in the shortcode to activate it.

    使用简码中的 pagination 参数将其激活。

    Its value is the amount of items you want to display per page.

    它的值是每页要显示的项目数量。

    [archivist category="kitten" pagination="10"]

      [档案管理员category =“ kitten” pagination =“ 10”]

    Pagination controls are displayed both on top and at the bottom of the archive.

    分页控件同时显示在存档的顶部和底部。

    You can customize this by setting controls to top or bottom.

    您可以通过将 controls 设置为 top bottom 来进行自定义。

    [archivist category="kitten" pagination="10" controls="top"]

      [档案管理员category =“ kitten” pagination =“ 10” controls =“ top”]

    Filter by Query

    按查询过滤

    Are you feeling bold?

    您感到胆大吗?

    Is filtering by category or archive not satisfying you?

    是否按类别或归档进行过滤不满意?

    Read on, I’ve got a challenge for you.

    继续阅读,我为您带来挑战。

    WordPress uses a certain query syntax to define the so called loop which is used to display the archive.

    WordPress使用某种查询语法来定义所谓的循环,该循环用于显示档案。

    You can find the complete documentation at https://codex.wordpress.org/Class_Reference/WP_Query

    您可以在https://codex.wordpress.org/Class_Reference/WP_Query
    上找到完整的文档。

    and you can take advantage of every single parameter or combination of parameters listed there.

    并且您可以利用此处列出的每个单个参数或参数组合。

    Some examples:

    一些例子:

    [archivist query="year=1984&author_name=gorwell"]

      [档案管理员query =“ year = 1984&author_name = gorwell”]

    Lists all entries from the year 1984 by the author with user_nicename gorwell.

    列出作者使用 user_nicename gorwell 的作者从 1984 年开始的所有条目。

    [archivist query="tag=straw+mask&post_status=private&orderby=comment_count&order=DESC"]

      [归档查询=“ tag =秸秆+ mask&post_status = private&orderby = comment_count&order = DESC”]

    Lists all entries marked with post status private which are tagged with both straw and mask, ordered by the amount of comments in a descending

    列出所有标记有帖子状态 private 的条目,这些条目同时标记为 straw mask ,并按注释的顺序降序排列

    order.

    订单。

    Using multiple Templates

    使用多个模板

    When you install the plugin, there is just one templated called “default”.

    安装插件时,只有一个模板称为“默认”。

    If you don’t specify a specific template in the shortcode, this one will be used.

    如果您未在简码中指定特定模板,则将使用此模板。

    Therefore the following two shortcodes yield identical results.

    因此,以下两个短代码会产生相同的结果。

    [archivist category="kitten"]

      [档案管理员category =“ kitten”]

    [archivist category="kitten" template="default"]

    [档案管理员category =“ kitten” template =“ default”]

    You can add as many templates as you like.

    您可以添加任意数量的模板。

    Think twice before deleting one.

    在删除一个之前,请三思。

    If it’s still in use, the archive can’t be displayed.

    如果仍在使用中,则无法显示存档。

安装步骤

    1. Upload the archivist directory to the /wp-content/plugins/ directory
    2. archivist 目录上传到 / wp-content / plugins / 目录

    3. Activate the plugin through the ‘Plugins’ menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

    5. Place [archivist category="kitten"] in your archive post or page
    6. [archivist category =“ kitten”] 放置在您的存档帖子或页面中

下载地址
https://downloads.wordpress.org/plugin/archivist-custom-archive-templates.zip
-EOF-

AI助手支持GPT4.0