[wordpress插件] Custom Query Shortcode自定义查询简码

wordpress 插件 文章 2020-04-09 12:00 572 0 全屏看文

AI助手支持GPT4.0

评分
100
描述

This plugin gives you [query] shortcode which enables you to query and output any posts filtered by specific attributes.

此插件为您提供 [query] 短代码,使您可以查询和输出按特定属性过滤的所有帖子。

Usage

用法

You can use all parameters supported by WP_Query class to filter the posts;

您可以使用 WP_Query类支持的所有参数来过滤帖子;

you can query for specific post types, categories, tags, authors, etc.

您可以查询特定的帖子类型,类别,标签,作者等。

Other supported parameters

其他受支持的参数

Aside from WP_Query parameters, the shortcode also supports the following additional parameters:

除了WP_Query参数外,该短代码还支持以下附加参数:

    • featured: to query for sticky posts which by default are excluded from the query.
    • 功能:用于查询默认情况下不包含在查询中的粘性帖子。

    • thumbnail_size: to specify the size of the {THUMBNAIL} images.

    • thumbnail_size :指定{THUMBNAIL}图片的大小。

      You can use built-in image sizes or custom ones you've defined.

      您可以使用内置图像尺寸或您定义的自定义尺寸。

      >

      >

    • content_limit: to limit the number of words of the {CONTENT} var;

    • content_limit :限制{CONTENT}变量的字数;

      by default it’s “0” which means it outputs the whole content.

    • 默认情况下,它为“ 0”,表示它将输出全部内容。

    • posts_separator: text to display between individual posts.
    • posts_separator :在各个帖子之间显示的文本。

    • lens: custom output template – see description below.
    • 镜头:自定义输出模板–请参见下面的说明。

    • twig_template: output template using Twig templating engine – requires the Timber library.
    • twig_template :使用Twig模板引擎的输出模板–需要Timber库。

    Formatting the output

    格式化输出

    You can define how you want to format the output inline within an opening [query] and closing [/query] tag.

    您可以定义如何在开始 [query] 和结束 [/ query] 标记内格式化输出内联格式。

    Available keywords are: TITLE, CONTENT, AUTHOR, AUTHOR_URL, DATE, THUMBNAIL, CONTENT, COMMENT_COUNT.

    可用的关键字是:TITLE,CONTENT,AUTHOR,AUTHOR_URL,DATE,THUMBNAIL,CONTENT,COMMENT_COUNT。

    The following example will display the latest 5 posts from the category with the ID of 3, showing a post title and comment count, with a link to the post:
        

    以下示例将显示该类别中ID为3的最新5条帖子,显示帖子标题和评论数,并带有该帖子的链接:
        

    [query posts_per_page=”5″ cat=”3″]

    [query posts_per_page =“ 5” cat =“ 3”]

    {TITLE} ({COMMENT_COUNT})

    {TITLE}({COMMENT_COUNT})

    [/query]

    [/ query]

    Grid display

    网格显示

    With the “cols” parameter you can display the output in a grid.
        

    使用“ cols”参数可以在网格中显示输出。
        

    [query posts_per_page=”3″ cols=”3″] {THUMBNAIL}

    [query posts_per_page =“ 3” cols =“ 3”] {THUMBNAIL}

    {TITLE}

    {TITLE}

    {CONTENT} [/query]

    {内容} [/查询]

    will display the latest 3 posts in the defined template, in 3 columns.

    将在3列中显示已定义模板中的最新3个帖子。

    The plugin will automatically divide the grid into rows based upon the ‘posts_per_page’ option, divided by the ‘cols’ option.

    该插件将根据“ posts_per_page”选项自动将网格划分为行,再除以“ cols”选项。

    Lenses (output templates)

    镜头(输出模板)

    With the “lens” parameter you can customize the display of the query results using a template.

    使用“ lens”参数,您可以使用模板自定义查询结果的显示。

    Some basic lenses/templates are provided:

    提供了一些基本的镜头/模板:

      • ul: unordered list of linked post titles.
      • ul :链接文章标题的无序列表。

      • ul-title-date: same as ‘ul’, but also displays the posted date.
      • ul-title-date :与“ ul”相同,但还会显示发布日期。

      • article-excerpt: series of articles, with a header containing the linked post title, and the excerpt.
      • 文章摘录:一系列文章,其标题包含链接的文章标题和摘录。

      • article-excerpt-date: same as ‘article-excerpt’, but also displays the posted date.
      • 文章摘录日期:与“ article-excerpt”相同,但也会显示发布日期。

      • cards: displays the post thumb above the header with linked post title, followed by the excerpt.
      • 卡片:在标题上方显示带有链接的帖子标题的帖子缩略图,后跟摘录。

      Bootstrap lenses

      自举眼镜

      Some pre-defined lenses/templates are provided which use JavaScript Components from the Bootstrap CSS framework.

      提供了一些预定义的镜头/模板,它们使用了 Bootstrap CSS框架中的JavaScript组件。

      This feature relies on Bootstrap library to be already loaded on the page, the plugin does not include it.

      此功能依赖于已在页面上加载的Bootstrap库,该插件包含它。

      If you’re using a Bootstrap-based theme, this should work;

      如果您使用的是基于Bootstrap的主题,则此应该有效;

      otherwise you can use the Bootstrap plugin).

      否则,您可以使用 Bootstrap插件)。

      Tabs

      标签

      This will show the latest 3 posts in a tabbed widget.
          

      这将在选项卡式小部件中显示最新的3条帖子。
          

      [query posts_per_page=”3″ lens=”tabs”]

      [query posts_per_page =“ 3”镜头=“ tabs”]

      Accordion

      手风琴

      This will create an accordion widget of all our posts from the “faq” post type.
          

      这将为来自“常见问题”帖子类型的所有帖子创建一个手风琴小部件。
          

      [query posts_per_page=”0″ post_type=”faq” lens=”accordion”]

      [query posts_per_page =“ 0” post_type =“ faq” lens =“手风琴”]

      Carousel

      旋转木马

      This creates a carousel of latest five featured posts:
          

      这会创建一个包含五个最新帖子的轮播:
          

      [query posts_per_page=”5″ featured=”true” lens=”carousel”]

      [query posts_per_page =“ 5” Featured =“ true” lens =“ carousel”]

      Custom Lenses/templates

      自定义镜头/模板

      You can create your own custom templates and put them into one of these pre-defined folder names within your theme:

      您可以创建自己的自定义模板,并将其放入主题中的以下预定义文件夹名称之一:

        • ‘query-shortcode-templates’
        • “ query-shortcode-templates”

        • ‘partials/query-shortcode-lenses/’
        • “ partials / query-shortcode-lenses /”

        • ‘html/lenses/’
        • ‘html / lenses /’

        Or simply specify your own subfolder in the ‘lens’ parameter:
            

        或者只是在“ lens”参数中指定您自己的子文件夹:
            

        [query lens=”folder/template-name”]

        [query lens =“文件夹/模板名称”]

        Twig Template Support

        Twig模板支持

        Starting with version 0.4, you can use Twig templates for your output.

        从0.4版开始,您可以使用Twig模板进行输出。

        Support for Twig is provided by the Timber library.

        木材库提供了对Twig的支持。

        This requires that Timber be be installed as a plugin or

        这要求将Timber作为插件

        href="http://timber.github.io/timber/#getting-started" rel="nofollow">included in your theme.

        主题中包含的href =“ http://timber.github.io/timber/#getting-started” rel =“ nofollow”> 。

        To use a Twig template for your query output, simply use the ‘twig_template’ parameter instead of the ‘lens’ parameter, and provide the path to your template:
            

        要将Twig模板用于查询输出,只需使用“ twig_template”参数而不是“ lens”参数,然后提供模板的路径即可:
            

        [query twig_template=”folder/template-name.twig”]

        [查询twig_template =”文件夹/模板名称.twig”]

下载地址
https://downloads.wordpress.org/plugin/custom-query-shortcode.0.4.0.zip
-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
[wordpress插件] ADD BANNER AF关闭横幅
[wordpress插件] DigitalPUSH notificationsDigitalPUSH通知
[wordpress插件] Checkbox for Taxonomies分类法复选框
[wordpress插件] Content Aware Sidebars – Unlimited Widget Areas内容感知侧栏–无限的小部件区域
[wordpress插件] Custom Category/Post Type Post order自定义类别/帖子类型发布订单
随便看看
企业微信通讯录账号被管理员误/恶意删除,怎么办? 8017
问题? 7254
如何快速搭建抽奖助手小程序(无需代码知识) 5038
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 5992
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 5509
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 5205
如何解决渲染层网络错误Failed to load media? 16560
小程序找号找回 释放昵称? 2425
我的小程序广告主收入5301,实际进账4406,是怎么回事呀? 2505
删除部分微信用户个人数据的通知,怎么删除? 5545