[/ query] code>标记内格式化输出内联格式。
Available keywords are: TITLE, CONTENT, AUTHOR, AUTHOR_URL, DATE, THUMBNAIL, CONTENT, COMMENT_COUNT.
可用的关键字是:TITLE,CONTENT,AUTHOR,AUTHOR_URL,DATE,THUMBNAIL,CONTENT,COMMENT_COUNT。 p>
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”] p>
[/query]
[/ query] p>
Grid display
网格显示 p>
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} p>
{TITLE}
{TITLE} h3>
{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”选项。 p>
Lenses (output templates)
镜头(输出模板) h4>
With the “lens” parameter you can customize the display of the query results using a template.
使用“ lens”参数,您可以使用模板自定义查询结果的显示。
Some basic lenses/templates are provided:
提供了一些基本的镜头/模板: p>
- ul: unordered list of linked post titles.
- ul strong>:链接文章标题的无序列表。 li>
- ul-title-date: same as ‘ul’, but also displays the posted date.
- ul-title-date strong>:与“ ul”相同,但还会显示发布日期。 li>
- article-excerpt: series of articles, with a header containing the linked post title, and the excerpt.
- 文章摘录 strong>:一系列文章,其标题包含链接的文章标题和摘录。 li>
- article-excerpt-date: same as ‘article-excerpt’, but also displays the posted date.
- 文章摘录日期 strong>:与“ article-excerpt”相同,但也会显示发布日期。 li>
- cards: displays the post thumb above the header with linked post title, followed by the excerpt.
- 卡片 strong>:在标题上方显示带有链接的帖子标题的帖子缩略图,后跟摘录。 li>
ul>
Bootstrap lenses
自举眼镜 p>
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库,该插件不 em>包含它。
If you’re using a Bootstrap-based theme, this should work;
如果您使用的是基于Bootstrap的主题,则此应该 em>有效;otherwise you can use the Bootstrap plugin).
否则,您可以使用 Bootstrap插件)。 p>
Tabs
标签 p>
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”] p>
Accordion
手风琴 p>
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 =“手风琴”] p>
Carousel
旋转木马 p>
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”] p>
Custom Lenses/templates
自定义镜头/模板 p>
You can create your own custom templates and put them into one of these pre-defined folder names within your theme:
您可以创建自己的自定义模板,并将其放入主题中的以下预定义文件夹名称之一: p>
- ‘query-shortcode-templates’
- “ query-shortcode-templates” li>
- ‘partials/query-shortcode-lenses/’
- “ partials / query-shortcode-lenses /” li>
- ‘html/lenses/’
- ‘html / lenses /’ li>
ul>
Or simply specify your own subfolder in the ‘lens’ parameter:
或者只是在“ lens”参数中指定您自己的子文件夹:
[query lens=”folder/template-name”]
[query lens =“文件夹/模板名称”] p>
Twig Template Support
Twig模板支持 h4>
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的支持。 p>
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”> 。 p>
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”] p>