跳到内容

List YARPP Block

v3.1.0

Marc Tönsing · 2021年11月30日 上架

Adds a block that lists yarpp related posts.

正在使用
10+
评分
暂无
累计下载
4,694
最近更新
2026年9月24日
需要 WordPress 6.5+已测试到 7.0.9

贡献者

截图

List YARPP block in Gutenberg editor.
List YARPP block in Gutenberg editor.
List YARPP block in the Theme Twenty-Twenty-Two
List YARPP block in the Theme Twenty-Twenty-Two
List YARPP block supports custom width.
List YARPP block supports custom width.

Displays YARPP related posts with the native Query Loop block. YARPP only provides the related post IDs, rendering is done by core blocks like Post Template, Post Featured Image and Post Title, so the layout can be styled in the Site Editor.

The legacy List YARPP block is still included for existing sites.

This block requires the YARPP plugin and relies on the yarpp_get_related() function.

Query Loop integration

Insert the YARPP Related Posts variation of the Query Loop block, or add these optional keys to the query attribute of any Query Loop block:

  • "related": "yarpp" – Shows the YARPP related posts of the current post in YARPP order.
  • "excludeCurrent": true – Excludes the currently viewed post.
  • "excludeDisplayed": true – Excludes posts already shown by Query Loops rendered earlier on the same page.
  • "requireThumbnail": true – Only shows posts with a featured image.
  • "hideEmpty": true – Hides the whole Query Loop, including headings inside it, if no posts are found.
  • "minPosts": 3 – Hides the whole Query Loop if fewer posts are found. Posts of a hidden Query Loop are not excluded by excludeDisplayed.

Example: related posts followed by the latest posts without duplicates.

<!-- wp:query {"queryId":1,"query":{"perPage":3,"postType":"post","inherit":false,"related":"yarpp","excludeCurrent":true,"minPosts":3}} -->
<!-- wp:query {"queryId":2,"query":{"perPage":3,"postType":"post","inherit":false,"excludeCurrent":true,"excludeDisplayed":true}} -->

The editor preview shows regular posts; the related posts are applied on the frontend.

Legacy block features

  • Gutenberg column width support.
  • The block is not visible in the frontend if no related posts are found.
  • Minimum html and css that is based on the standard Gutenberg Latest Posts block.
  • Valid HTML output.
  • Inherits the style of your theme for links and headlines.

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums