How to Add Related Posts in GeneratePress (Free Guide)

Showing related posts under your blog articles is one of the best ways to increase engagement, reduce bounce rate, and keep visitors reading more content. If your site uses the GeneratePress theme (free or premium), you can add a related posts section using free tools like GenerateBlocks, the Query Loop Block, plugins, or even custom code — without slowing your site down.


🚀 Why Related Posts Matter

Including a related posts section helps:

✔ Boost page views per session
✔ Improve on-site SEO signals
✔ Encourage deeper content discovery
✔ Give readers more relevant content to engage with

Unlike big, bloated “related posts” plugins that slow down your site, GeneratePress methods can be fast and lightweight.

AI-generated image

🛠 Method 1 — Use GenerateBlocks + Query Loop (Free)

GeneratePress pairs excellently with GenerateBlocks — a free plugin that lets you build custom blocks, including dynamic post lists. Using the Query Loop Block, you can automatically show posts from the same category (or tags) as the current article:

Steps

  1. Install and activate GenerateBlocks (free from WP.org).
  2. Open any post template or the post editor.
  3. Add a Query Loop Block where you want related posts.
  4. Click Add Parameter → Taxonomies → Category.
  5. Set Category = Current Post Categories.
  6. Add Exclude Posts → Exclude Current Post so the same post doesn’t appear.
  7. Adjust Posts Per Page and layout (grid/list).
  8. Style the block with featured images/titles as desired.

This creates a dynamic related post section that updates based on each article’s category.


🧩 Method 2 — Use a Related Posts Plugin

If you prefer a plugin that does the work for you (and your site isn’t ultra-performance sensitive), you can use a related posts plugin from the WordPress repository. Some lightweight choices:

Inline Related Posts — inserts contextual related links into content automatically.
Contextual Related Posts — classic plugin with thumbnails and shortcode support.

Steps:

  1. Go to Plugins → Add New.
  2. Search for your chosen related posts plugin.
  3. Install and activate.
  4. Configure how and where related posts appear (below content, via shortcode, etc.).

This approach works well if you want an automated solution without building blocks.


🧠 Method 3 — Add Related Posts with Custom Code

For developers or those comfortable with PHP, you can insert related posts manually using a custom function and a theme hook:

function custom_related_posts_by_category() {
    if ( ! is_single() ) return;

    $categories = get_the_category(get_the_ID());
    $args = array(
        'category__in'   => wp_list_pluck($categories, 'term_id'),
        'post__not_in'   => array(get_the_ID()),
        'posts_per_page' => 4,
        'orderby'        => 'rand'
    );

    $related_query = new WP_Query($args);

    if ( $related_query->have_posts() ) {
        echo '<div class="related-posts"><h3>Related Posts</h3><ul>';
        while ( $related_query->have_posts() ) {
            $related_query->the_post();
            echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
        }
        echo '</ul></div>';
        wp_reset_postdata();
    }
}
add_action('generate_after_content', 'custom_related_posts_by_category');

This snippet fetches posts from the same categories (excluding the current one) and displays them after the post content.

AI-generated image

📌 Free vs Premium Options

MethodRequires Paid PluginProsCons
Query Loop Block (GenerateBlocks)NoFree, dynamic, lightweightTakes some setup
Related Posts PluginNoEasy install & configureMight add extra load
Custom PHP CodeNoFull control, fastRequires coding

GeneratePress itself doesn’t include a built-in related posts feature in the free theme, but these methods give you full flexibility without performance sacrifices.


🎨 Styling Your Related Posts

Once your related posts section is working, you can style it with CSS or block settings:

✔ Set columns (2–4 posts per row)
✔ Show featured images
✔ Add spacing, borders, background colors
✔ Control text size and hover effects

This keeps related posts looking professional and matching your theme.


❓ FAQ – Related Posts in GeneratePress

Can I show related posts by tags instead of categories?
Yes — when using blocks or custom queries, you can change the taxonomy to tags instead of categories in your query parameters.

Will related posts slow down my site?
Using lightweight blocks like Query Loop (GenerateBlocks) or optimized plugins keeps performance impact minimal. Avoid heavy plugins that load extra scripts.

Do I need GeneratePress Premium?
No — all methods above work with the free GeneratePress theme. Premium adds convenience features like Elements and Hooks, but aren’t required.


🏁 Conclusion

Adding related posts to your GeneratePress site doesn’t have to be complicated or slow. Whether you choose a dynamic block built with GenerateBlocks, a light related posts plugin, or custom PHP, you can show relevant posts that increase engagement and help keep readers on your site longer.

Experiment with layouts, show featured images, and tune how many related posts you display to fit your design — all without bloated code or performance hits. Happy building!


Using essential tools for Linux and homelab?
Explore more Tools & Utilities tutorials →

Leave a Comment

Your email address will not be published. Required fields are marked *


Scroll to Top