How to Add Related Posts With a Thumbnail Without Using Plugins

How to Add Related Posts With a Thumbnail Without Using
How to Add Related Posts With a Thumbnail Without Using Plugin

Adding related posts to your blog can help keep readers engaged. It can also reduce your bounce rate. This means visitors stay on your site longer.

Usually, people use plugins for this. But you can do it without a plugin. This guide will show you how. It is simple and easy.

How to Add Related Posts With a Thumbnail Without Using Plugins

Credit: pluginsforwp.com

How to Add Related Posts With a Thumbnail Without Using Plugins

Credit: www.jodineufelddesign.com

Why Add Related Posts?

Related posts help readers find more content they like. They improve user experience. They also help with SEO. Google likes it when visitors stay longer on your site. <pRelated posts are a win-win. They help you and your readers.

Steps to Add Related Posts With Thumbnails

Follow these steps to add related posts with thumbnails to your blog.

Step 1: Edit Your Theme

First, you need to edit your theme. This step is crucial. You must access your theme files. You can do this from your WordPress dashboard.

  • Go to Appearance.
  • Click on Theme Editor.
  • Select your theme.
  • Find the single.php file. This file controls single post pages.

Be careful while editing theme files. Always back up your files before making changes.

Step 2: Add Code To Display Related Posts

Next, add code to display related posts. You need to add this code to your single.php file. Here is a simple code snippet:


php
    $orig_post = $post;
    global $post;
    $tags = wp_get_post_tags($post-ID);
    
    if ($tags) {
        $tag_ids = array();
        foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
        $args = array(
            'tag__in' => $tag_ids,
            'post__not_in' => array($post->ID),
            'posts_per_page'=> 3, // Number of related posts to display.
            'caller_get_posts'=> 1
        );
        
        $my_query = new wp_query( $args );
        
        if( $my_query->have_posts() ) {
            echo '

Related Posts

php } echo ''; } } $post = $orig_post; wp_reset_query(); ?> </code

This code does the following:

  • Gets the tags of the current post.
  • Finds other posts with the same tags.
  • Displays the related posts with thumbnails.

Step 3: Style Your Related Posts

Next, style your related posts. You want them to look good. Add CSS to your theme’s style.css file.


    .related-posts {
        list-style: none;
        margin: 20px 0;
        padding: 0;
    }
    .related-posts li {
        display: inline-block;
        margin: 0 10px;
        text-align: center;
    }
    .related-posts img {
        width: 150px;
        height: auto;
    }
    .related-posts h3 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    

This CSS will make your related posts look neat. You can adjust the CSS to fit your theme.

Step 4: Test Your Changes

Finally, test your changes. Make sure everything works. Check a few posts on your site. Look for the related posts section. Make sure the thumbnails are showing.

If you do not see the related posts, check your code. Make sure you copied it correctly. Look for any errors.

Benefits of Adding Related Posts

Adding related posts has many benefits. Here are a few:

  • Improves user experience.
  • Helps readers find more content.
  • Increases page views.
  • Reduces bounce rate.
  • Helps with SEO.

Related posts keep readers on your site longer. This is good for your blog.

Frequently Asked Questions

How Do I Add Related Posts With A Thumbnail?

Use a plugin or a widget to add related posts with thumbnails. Many options are available.

What Are The Best Plugins For Related Posts Thumbnails?

Popular plugins include YARPP, Related Posts Thumbnails, and Jetpack. They are easy to use.

Can I Add Related Posts Without A Plugin?

Yes. Use custom code in your theme’s files. It requires some coding knowledge.

Are Related Posts Good For Seo?

Yes. They improve user engagement and reduce bounce rates. This can positively impact SEO.

Conclusion

Adding related posts with thumbnails is easy. You do not need a plugin. Just follow the steps in this guide. Edit your theme. Add the code. Style your related posts. Test your changes.

Related posts can improve your blog. They keep readers engaged. They help with SEO. They are worth the effort.

Try adding related posts to your blog today. See the benefits for yourself.

Leave a Reply

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

Iqbal hossen Juel

A seasoned marketing professional with over a decade of experience in digital and traditional marketing. Currently serving as Digital Experience Lead at Starcom, He brings a unique blend of strategic marketing expertise and technical knowledge to the table. With a passion for programming and design, he offers a distinctive perspective that bridges the gap between marketing strategy and technical implementation.

Our Review Process:

We test and review software products based on an independent, multi-point methodology. If you use our links to purchase something, we earn a commission. Read our editorial process and disclosures.

Ultimate Collection Of

Business Tools

A collection of business related Tools and resources that every business owner should have!

Table of Contents

Related Posts

Best Ai Chatbot
Best Ai Chatbot: Revolutionizing Customer Engagement
Best AI Chatbot What is an AI Chatbot? An AI chatbot is a computer program. It talks with humans using...
Read More
Best Comic Making App
Best Comic Making App: Unleash Your Creativity Today!
Best Comic Making App Do you love comics? Do you want to make your own? Today, we will talk about the...
Read More
Content Optimization: Boost Your Rankings with Proven Strategies
Ever wonder why some pages skyrocket on Google while others flop? Content optimization is the secret...
Read More
Best Clothes Editor
Best Clothes Editor: Transform Your Wardrobe Instantly
Best Clothes Editor Editing clothes in photos can be fun. It can also be useful. Many apps and tools...
Read More