1. Overview
The [init_live_search_related_posts] shortcode uses Init Live Search’s internal engine to find relevant posts based on the current title or a custom keyword. The results are rendered as static HTML with optional JSON-LD schema, requiring no JavaScript or REST API.
- No frontend JavaScript or frameworks required
- No AJAX or REST calls — all processing is done before rendering
- SEO- and cache-friendly — rendered directly into HTML
- Template override and custom CSS support
- Supports multiple layouts via the
templateparameter
2. How to use the shortcode
Just insert the shortcode into any post, page, widget, or template:
[init_live_search_related_posts]
By default, it will use the current post title as the keyword for finding related posts.
Supported attributes:
id: Post ID to use as reference (default: current post)count: Number of related posts to show (default: 5)keyword: Override the keyword used for related post detection (default: current title)post_type: Limit results to one or more post types (e.g.post,post,page)template: Display layout template. Supported values:default: Horizontal layout — thumbnail left, title right (default)grid: Responsive grid with large imagesclassic: Blog-style — headline with excerptcompact: Simple text listthumbright: Title and date with thumbnail on the right
css:1or0— enable/disable default CSS (default:1)schema:1or0— enable/disable JSON-LD schema (default:1)
3. Advanced usage example
[init_live_search_related_posts count="8" keyword="SEO tips" template="grid" css="0" schema="0"]
The above shortcode shows 8 related posts based on “SEO tips” using the grid layout, disables default CSS, and skips JSON-LD output.
4. Customizing the layout (template override)
You can override the default HTML layout by creating a custom template file in your theme:
your-theme/init-live-search/related-posts-grid.php
The plugin will automatically use this file based on the selected template value. If not found, it will fall back to the default template.
5. Integration with builders / blocks / widgets
Because the shortcode is fully self-contained, you can use it anywhere shortcodes are allowed, including:
- Shortcode block in Gutenberg
- Text/HTML widgets
- Elementor, Bricks, Oxygen, or any page builder
- PHP templates via
do_shortcode()
6. Comparison with other Related Posts plugins
| Feature | Init Live Search | YARPP / Contextual Related Posts |
|---|---|---|
| No JavaScript required | Yes | No |
| No extra DB queries | Yes | No |
| Performance | Very high | Moderate |
| Template override support | Yes | Yes |
| JSON-LD Schema | Yes | No |
| Smart title matching | Yes | No |
7. Conclusion
[init_live_search_related_posts] is one of the most lightweight yet powerful shortcodes for displaying related posts in WordPress. No JavaScript, no REST calls — fully compatible with static caching systems and deeply customizable via templates. If you’re already using Init Live Search, this is an essential feature to boost on-site time and user retention.
Comments