২৭ জুন, ২০২২

add default featured image WordPress

How to add default featured image on your WordPress website

Do you want to add default feature image on your WordPress site? Feature image is also known as post thumbnail. You can attract a visitor with a featured image on your post. In this article, we will learn how to add default featured image on your WordPress website.

Why is Featured image important?

Feature image is a picture/image which is attached with your blog post. It depends on your theme that where your feature image is going to display.

If you are running a community blog then your user may forget to add feature image sometimes. Then it will look bad on your homepage.

You can add default feature image using a plugin or can do it manually.

Using Plugin

Most of the user do this task using a simple plugin.
You can do it using Default Feature Image Plugin.

After the activation of the plugin go to Settings>> Media option.
Here you will find the option to upload an image for feature image.

Don’t forget to click the save button.

Now if you post a content without feature image, it will show the image on a feature that you selected before.

Manually setting up a featured image.

In this method, you need to add some codes.

First, log in to your Cpanel and go to file manager.

Upload your default featured image to the image folder of your theme. You will find the path in this direction.

/wp-content/themes/yourtheme/
Now, this step is important. You need to find out the_post_thumbnail() function. Generally, you will find this function on archive.php or single.php file.

Now post this code in that place.

<?php if ( has_post_thumbnail() ) {
    the_post_thumbnail();
    } else { ?>
    <img src="<?php bloginfo('template_directory'); ?>/images/default-image.jpg" alt="<?php the_title(); ?>" />
    <?php } ?>

Don’t forget to change the filename default-image.jpg with your image name.

সার্চ করুন:

Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
Domain Names
Email Tutorials
How to
Transfer Domain
Web Development
Web Services
Website Design
Wordpress
ডোমেইন
হোস্টিং

সাম্প্রতিক পোস্ট

How to add auto Post…