Blog · Gutenberg

Related Posts block for WordPress

Shows posts sharing the category or tag with the current post via AJAX on the frontend.

Get Blockenberg

Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.

Get Blockenberg

What it actually does

Shows posts sharing the category or tag with the current post via AJAX on the frontend.

Inspector panels on this block: Query, Display. Those titles come from index.js, not from a shared template.

Behavior controls: “Relation” options: Category, Tag, Both (and); “Layout” options: Grid, List, Carousel; “Image Ratio” options: 16:9, 4:3, 1:1, 3:2.

Where to find it

Gutenberg inserter → Blog → search “Related Posts” (block name `blockenberg/related-posts` in block.json). Style it in the sidebar after insert.

How to use Related Posts block for WordPress

  1. Install Blockenberg. Install from WordPress.org and activate the plugin.
  2. Insert the block. Edit a page, click +, search for “Related Posts”, insert it. Category: Blog.
  3. Configure inspector controls that exist on this block. Open Query. Set “Relation”, “Number of Posts”, “Section Heading”, “Heading Tag”.
  4. Check the published page. The view script reads HTML data attributes: data-count, data-image-ratio, data-relation, data-show-date, data-show-excerpt, data-show-image. The block editor preview may not run the same view script.

Inspector controls from this block’s code

ControlWhat the code does
RelationSelect control; the chosen value is saved on the block. Options: Category; Tag; Both (and). block.json default: category. Saved as `relation`.
Number of PostsNumeric range control in the inspector. Range 1–12. block.json default: 3. Saved as `count`.
Section HeadingText field in the inspector. block.json default: Related Posts. Saved as `heading`.
Heading TagSelect control; the chosen value is saved on the block. block.json default: h3. Saved as `headingTag`.
LayoutSelect control; the chosen value is saved on the block. Options: Grid; List; Carousel. block.json default: grid. Saved as `layout`.
ColumnsNumeric range control in the inspector. Range 1–4. block.json default: 3. Saved as `columns`.
Gap (px)Numeric range control in the inspector. Range 8–48. block.json default: 20. Saved as `gap`.
Show ImageOn/off toggle in the inspector. On by default. Saved as `showImage`.
Show ExcerptOn/off toggle in the inspector. Off by default. Saved as `showExcerpt`.
Show DateOn/off toggle in the inspector. On by default. Saved as `showDate`.
Image RatioSelect control; the chosen value is saved on the block. Options: 16:9; 4:3; 1:1; 3:2. block.json default: 16/9. Saved as `imageRatio`.
Card Radius (px)Numeric range control in the inspector. Range 0–24. block.json default: 10. Saved as `cardRadius`.
Card ShadowOn/off toggle in the inspector. On by default. Saved as `cardShadow`.
HeadingShared Blockenberg typography popover (family, size, weight, spacing). Saved as `headingTypo`.
Card BackgroundColor control in the inspector. block.json default: #ffffff. Saved as `cardBg`.
Card BorderColor control in the inspector. block.json default: #e5e7eb. Saved as `cardBorder`.
Placeholder ShimmerColor control in the inspector. block.json default: #e5e7eb. Saved as `placeholderColor`.

What the front-end script actually does

When this is the right block

Notes from the implementation

viewScript: this folder’s frontend.js is enqueued on the front end for this block.

FAQ

How do I add the Related Posts block in WordPress?

Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “Related Posts”. It sits under Blog. After insert, open Query and set “Relation”, “Number of Posts”, “Section Heading”, “Heading Tag”.

What makes Related Posts different from other Blockenberg blocks?

Shows posts sharing the category or tag with the current post via AJAX on the frontend. Inspector labels on this block include “Relation”, “Number of Posts”, “Section Heading”, “Heading Tag”.

Is the Related Posts Gutenberg block free?

Yes. Related Posts ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.

Can I style Related Posts to match my theme?

Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: Query, Display).

Related blog blocks

Get Blockenberg

Install Blockenberg from WordPress.org, then insert Related Posts from the Gutenberg inserter.

Get Blockenberg