Related WordPress posts?

The WordPress engine is used by many webmasters, and only a few try to install something new and original on their platforms.

Similar posts with pictures on WordPress are a great way to improve your resource, because images always attract attention.

There are several plugins for installing thumbnails of similar posts, but as you know, a large number of additional extensions have a bad effect on the speed of resource loading. We will tell you how to set pictures to similar posts without using a plugin.

Related WordPress posts?

How to put pictures to similar posts?

In order not to depend on the plug-in developers and not be afraid of possible errors, you can simply add a special The code on the site and similar entries will be accompanied by pictures.
First you need to go to edit the single file. php, responsible for the presentation of the main articles.

There is a special code in the WordPress engine that is responsible for thumbnails, so in most cases the necessary line has already been written:

Related WordPress posts?

Next to this line, there should be another :

Related WordPress posts?

Here you can set thumbnail sizes. Note that if you didn’t mean “Use as thumbnail” when adding images to the article, it will not be displayed. If you checked the availability of the necessary lines, as well as set the use of thumbnails, you can proceed to adding the main code:

Related WordPress posts?

This code must be set to single. php. Please note that the line between 25 and 26 is set to the code responsible for the thumbnail sizes.

After adding this code, you will need to modify the CSS file , which is responsible for styling the block with similar entries. If its total size is 640 pixels, you can use the following code:

Related WordPress posts?

As you can see, two classes are used here. Relatedposts are used to design the block itself, relatedthumb is responsible for thumbnails and links. You can correct this code at your discretion, using different colors, font sizes and background images.

What should happen?

If you did everything correctly, then a new block should appear under each article of your site:

Related WordPress posts?

This example was created exactly according to the above described method, without the use of plug-ins. After reading this material, you should have realized that installing such functionality on your site is not so difficult and as you can see from the example, it looks great.

You will also be interested in:
- Feedback for WordPress
- WordPress caching plugin
- Website for earnings, what is it?

Search

Related Articles