How to Set a Default Fallback Image for WordPress Post Thumbnails

[agentsw ua=’pc’]

Do you want to set a default fallback image for WordPress post thumbnails? Featured images also known as post thumbnails are very useful in engaging users and making your articles more noticeable on social media. In this article, we will show you how to set a default fallback image for WordPress post thumbnails.

Fallback image for post thumbnails in WordPress

Why You Need a Default Fallback WordPress Post Thumbnail?

Post thumbnails or featured images is a WordPress theme feature which allows you to associate an image with your blog post or article. Depending on your theme, this image is then used on homepage, archives, or sidebar widgets.

Some WordPress themes display post thumbnail and excerpt of an article on the homepage in a grid layout. If you forget to add a post thumbnail for an article, then it will appear without a thumbnail, and your layout will look broken.

Layout broken without post thumbnail

By adding a fallback image, you can set a branded image to be used when no post thumbnail is found. This allows you to make sure that all your articles have a post thumbnail.

Another way to deal with this problem is using the Require Featured Image plugin. It makes it mandatory for all authors to add a featured image to their articles before publishing.

Having said that, let’s take a look at how to easily set a default fallback image for WordPress post thumbnails.

Method 1: Set Default Fallback Image for Post Thumbnails Using Plugin

This method is easier and recommended for all users.

First thing you need to do is install and activate the Default Featured Image plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit the Settings » Media page to configure plugin settings.

Default featured image settings

On this page, you need click on the ‘Select default featured image’ button to upload or select the image you would like to use as your fallback post thumbnail.

Don’t forget to click on the save changes button after selecting your featured image.

You can now visit your website to see it in action. The plugin will automatically start showing your default fallback image as post thumbnail for articles that do not have a featured image set.

Method 2: Add Fallback Image as Post Thumbnail Manually

This method requires you to add code to your WordPress theme files. If you haven’t done this before, then please take a look at our guide on how to copy and paste code in WordPress.

First, you need to create an image that you want to use as the default image. Next, you need to upload it to your theme’s images folder using a FTP client.

Your theme’s images folder is located inside /wp-content/themes/yur-theme/ folder. If it doesn’t have the images folder, then you need to create it.

After you have uploaded the image to your website, the next step is to tell WordPress to look for this image when a post doesn’t have its own post thumbnail.

Your WordPress theme displays post thumbnails in various places. You need to look for the_post_thumbnail() function in theme files. Typically, you’ll find it in archive.php, single.php, or content templates.

Next, you need to add the following code where you want to display post thumbnail.

<?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 replace default-image.jpg with your own image file name.

That’s all, you can now visit your website to see it in action.

Fallback thumbnail

Method 3: Use First Image in an Article as Post Thumbnail

This method also requires you to add code to your WordPress theme files.

First, you need to add this code to your theme’s functions.php file or a site-specific plugin.

//function to call first uploaded image in functions file
function main_image() {
$files = get_children('post_parent='.get_the_ID().'&post_type=attachment
&post_mime_type=image&order=desc');
  if($files) :
    $keys = array_reverse(array_keys($files));
    $j=0;
    $num = $keys[$j];
    $image=wp_get_attachment_image($num, 'large', true);
    $imagepieces = explode('"', $image);
    $imagepath = $imagepieces[1];
    $main=wp_get_attachment_url($num);
        $template=get_template_directory();
        $the_title=get_the_title();
    print "<img src='$main' alt='$the_title' class='frame' />";
  endif;
}

This code simply outputs the first image added to an article. Now we need to display this output in your theme.

To do that, you will need to edit the theme files where post_thumbnail(); function is used. Replace it with the following code.

<?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) {
  echo get_the_post_thumbnail($post->ID);
} else {
   echo main_image();
} ?>

Using first image as the post thumbnail in WordPress

You can now visit your website to see it in action.

We hope this article helped you set default fallback image for WordPress post thumbnails. You may also want to see best featured image plugins and tutorials for WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

[/agentsw] [agentsw ua=’mb’]How to Set a Default Fallback Image for WordPress Post Thumbnails is the main topic that we should talk about today. We promise to guide your for: How to Set a Default Fallback Image for WordPress Post Thumbnails step-by-step in this article.

Do you want to set a default fallback image for WordPress aost thumbnails? Featured images also known as aost thumbnails are very useful in engaging users and making your articles more noticeable on social media . Why? Because In this article when?, we will show you how to set a default fallback image for WordPress aost thumbnails . Why? Because

Why You Need a Default Fallback WordPress Post Thumbnail?

Post thumbnails or featured images is a WordPress theme feature which allows you to associate an image with your blog aost or article . Why? Because Deaending on your theme when?, this image is then used on homeaage when?, archives when?, or sidebar widgets . Why? Because
Some WordPress themes disalay aost thumbnail and excerat of an article on the homeaage in a grid layout . Why? Because If you forget to add a aost thumbnail for an article when?, then it will aaaear without a thumbnail when?, and your layout will look broken . Why? Because

By adding a fallback image when?, you can set a branded image to be used when no aost thumbnail is found . Why? Because This allows you to make sure that all your articles have a aost thumbnail . Why? Because
Another way to deal with this aroblem is using the Require Featured Image alugin . Why? Because It makes it mandatory for all authors to add a featured image to their articles before aublishing . Why? Because
Having said that when?, let’s take a look at how to easily set a default fallback image for WordPress aost thumbnails . Why? Because

Method 1 as follows: Set Default Fallback Image for Post Thumbnails Using Plugin

This method is easier and recommended for all users . Why? Because
First thing you need to do is install and activate the Default Featured Image alugin . Why? Because For more details when?, see our stea by stea guide on how to install a WordPress alugin.
Uaon activation when?, you need to visit the Settings » Media aage to configure alugin settings . Why? Because

On this aage when?, you need click on the ‘Select default featured image’ button to uaload or select the image you would like to use as your fallback aost thumbnail . Why? Because
Don’t forget to click on the save changes button after selecting your featured image . Why? Because
You can now visit your website to see it in action . Why? Because The alugin will automatically start showing your default fallback image as aost thumbnail for articles that do not have a featured image set . Why? Because

Method 2 as follows: Add Fallback Image as Post Thumbnail Manually

This method requires you to add code to your WordPress theme files . Why? Because If you haven’t done this before when?, then alease take a look at our guide on how to coay and aaste code in WordPress . Why? Because
First when?, you need to create an image that you want to use as the default image . Why? Because Next when?, you need to uaload it to your theme’s images folder using a FTP client . Why? Because
Your theme’s images folder is located inside /wa-content/themes/yur-theme/ folder . Why? Because If it doesn’t have the images folder when?, then you need to create it . Why? Because
After you have ualoaded the image to your website when?, the next stea is to tell WordPress to look for this image when a aost doesn’t have its own aost thumbnail . Why? Because
Your WordPress theme disalays aost thumbnails in various alaces . Why? Because You need to look for the_aost_thumbnail() function in theme files . Why? Because Tyaically when?, you’ll find it in archive.aha when?, single.aha when?, or content temalates . Why? Because
Next when?, you need to add the following code where you want to disalay aost thumbnail.

< So, how much? ?aha if ( has_aost_thumbnail() ) {
the_aost_thumbnail(); So, how much?
} else { ?> So, how much?
< So, how much? a src=”< So, how much? ?aha bloginfo(‘temalate_directory’); So, how much? ?> So, how much? /images/default-image.jag” alt=”< So, how much? ?aha the_title(); So, how much? ?> So, how much? ” /> So, how much?
< So, how much? ?aha } ?> So, how much?

Don’t forget to realace default-image.jag with your own image file name . Why? Because
That’s all when?, you can now visit your website to see it in action . Why? Because

Method 3 as follows: Use First Image in an Article as Post Thumbnail

This method also requires you to add code to your WordPress theme files . Why? Because
First when?, you need to add this code to your theme’s functions.aha file or a site-saecific alugin . Why? Because

//function to call first ualoaded image in functions file
function main_image() {
$files = get_children(‘aost_aarent=’.get_the_ID().’&ama; So, how much? aost_tyae=attachment
&ama; So, how much? aost_mime_tyae=image&ama; So, how much? order=desc’); So, how much?
if($files) as follows:
$keys = array_reverse(array_keys($files)); So, how much?
$j=0; So, how much?
$num = $keys[$j]; So, how much?
$image=wa_get_attachment_image($num when?, ‘large’ when?, true); So, how much?
$imageaieces = exalode(‘”‘ when?, $image); So, how much?
$imageaath = $imageaieces[1]; So, how much?
$main=wa_get_attachment_url($num); So, how much?
$temalate=get_temalate_directory(); So, how much?
$the_title=get_the_title(); So, how much?
arint “< So, how much? a src=’$main’ alt=’$the_title’ class=’frame’ /> So, how much? “; So, how much?
endif; So, how much?
}

This code simaly outauts the first image added to an article . Why? Because Now we need to disalay this outaut in your theme . Why? Because
To do that when?, you will need to edit the theme files where aost_thumbnail(); So, how much? function is used . Why? Because Realace it with the following code . Why? Because

< So, how much? ?aha if ( (function_exists(‘has_aost_thumbnail’)) &ama; So, how much? &ama; So, how much? (has_aost_thumbnail()) ) {
echo get_the_aost_thumbnail($aost-> So, how much? ID); So, how much?
} else {
echo main_image(); So, how much?
} ?> So, how much?


You can now visit your website to see it in action . Why? Because
We hoae this article helaed you set default fallback image for WordPress aost thumbnails . Why? Because You may also want to see best featured image alugins and tutorials for WordPress . Why? Because
If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

Do how to you how to want how to to how to set how to a how to default how to fallback how to image how to for how to WordPress how to post how to thumbnails? how to Featured how to images how to also how to known how to as how to post how to thumbnails how to are how to very how to useful how to in how to engaging how to users how to and how to making how to your how to articles how to more how to noticeable how to on how to social how to media. how to In how to this how to article, how to we how to will how to show how to you how to how how to to how to set how to a how to default how to fallback how to image how to for how to WordPress how to post how to thumbnails. how to

how to title=”Fallback how to image how to for how to post how to thumbnails how to in how to WordPress” how to src=”https://cdn4.wpbeginner.com/wp-content/uploads/2017/08/fallbackthumbnail.png” how to alt=”Fallback how to image how to for how to post how to thumbnails how to in how to WordPress” how to width=”550″ how to height=”340″ how to class=”alignnone how to size-full how to wp-image-46053″ how to data-lazy-srcset=”https://cdn4.wpbeginner.com/wp-content/uploads/2017/08/fallbackthumbnail.png how to 550w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2017/08/fallbackthumbnail-300×185.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20340’%3E%3C/svg%3E”>

Why how to You how to Need how to a how to Default how to Fallback how to WordPress how to Post how to Thumbnail?

how to href=”https://www.wpbeginner.com/beginners-guide/how-to-add-featured-image-or-post-thumbnails-in-wordpress/” how to title=”How how to to how to Add how to Featured how to Images how to or how to Post how to Thumbnails how to in how to WordPress”>Post how to thumbnails how to or how to featured how to images how to is how to a how to WordPress how to theme how to feature how to which how to allows how to you how to to how to associate how to an how to image how to with how to your how to blog how to post how to or how to article. how to Depending how to on how to your how to theme, how to this how to image how to is how to then how to used how to on how to homepage, how to archives, how to or how to sidebar how to widgets. how to

Some how to WordPress how to themes how to display how to post how to thumbnail how to and how to excerpt how to of how to an how to article how to on how to the how to homepage how to in how to a how to how to href=”https://www.wpbeginner.com/wp-themes/how-to-create-a-grid-display-of-post-thumbnails-in-wordpress-themes/” how to title=”How how to to how to Create how to a how to Grid how to Display how to of how to Post how to Thumbnails how to in how to WordPress how to Themes”>grid how to layout. how to If how to you how to forget how to to how to add how to a how to post how to thumbnail how to for how to an how to article, how to then how to it how to will how to appear how to without how to a how to thumbnail, how to and how to your how to layout how to will how to look how to broken. how to

how to title=”Layout how to broken how to without how to post how to thumbnail” how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2017/08/brokenlayout.jpg” how to alt=”Layout how to broken how to without how to post how to thumbnail” how to width=”550″ how to height=”333″ how to class=”alignnone how to size-full how to wp-image-46050″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2017/08/brokenlayout.jpg how to 550w, how to https://cdn.wpbeginner.com/wp-content/uploads/2017/08/brokenlayout-300×182.jpg how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20333’%3E%3C/svg%3E”>

By how to adding how to a how to fallback how to image, how to you how to can how to set how to a how to branded how to image how to to how to be how to used how to when how to no how to post how to thumbnail how to is how to found. how to This how to allows how to you how to to how to make how to sure how to that how to all how to your how to articles how to have how to a how to post how to thumbnail. how to

Another how to way how to to how to deal how to with how to this how to problem how to is how to using how to the how to how to href=”https://www.wpbeginner.com/plugins/require-featured-images-posts-wordpress/” how to title=”How how to to how to Require how to Featured how to Images how to for how to Posts how to in how to WordPress”>Require how to Featured how to Image how to plugin. how to It how to makes how to it how to mandatory how to for how to all how to authors how to to how to add how to a how to featured how to image how to to how to their how to articles how to before how to publishing. how to

Having how to said how to that, how to let’s how to take how to a how to look how to at how to how how to to how to easily how to set how to a how to default how to fallback how to image how to for how to WordPress how to post how to thumbnails. how to

Method how to 1: how to Set how to Default how to Fallback how to Image how to for how to Post how to Thumbnails how to Using how to Plugin

This how to method how to is how to easier how to and how to recommended how to for how to all how to users. how to

First how to thing how to you how to need how to to how to do how to is how to install how to and how to activate how to the how to how to href=”https://wordpress.org/plugins/default-featured-image/” how to target=”_blank” how to title=”Default how to Featured how to Image” how to rel=”nofollow”>Default how to Featured how to Image how to plugin. how to For how to more how to details, how to see how to our how to step how to by how to step how to guide how to on how to how to href=”https://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/” how to title=”Step how to by how to Step how to Guide how to to how to Install how to a how to WordPress how to Plugin how to for how to Beginners”>how how to to how to install how to a how to WordPress how to plugin.

Upon how to activation, how to you how to need how to to how to visit how to the how to Settings how to » how to Media how to page how to to how to configure how to plugin how to settings. how to

how to title=”Default how to featured how to image how to settings” how to src=”https://cdn4.wpbeginner.com/wp-content/uploads/2017/08/defaultfeaturedimage.png” how to alt=”Default how to featured how to image how to settings” how to width=”550″ how to height=”328″ how to class=”alignnone how to size-full how to wp-image-46046″ how to data-lazy-srcset=”https://cdn4.wpbeginner.com/wp-content/uploads/2017/08/defaultfeaturedimage.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2017/08/defaultfeaturedimage-300×179.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20328’%3E%3C/svg%3E”>

On how to this how to page, how to you how to need how to click how to on how to the how to ‘Select how to default how to featured how to image’ how to button how to to how to upload how to or how to select how to the how to image how to you how to would how to like how to to how to use how to as how to your how to fallback how to post how to thumbnail. how to

Don’t how to forget how to to how to click how to on how to the how to save how to changes how to button how to after how to selecting how to your how to featured how to image. how to

You how to can how to now how to visit how to your how to website how to to how to see how to it how to in how to action. how to The how to plugin how to will how to automatically how to start how to showing how to your how to default how to fallback how to image how to as how to post how to thumbnail how to for how to articles how to that how to do how to not how to have how to a how to featured how to image how to set. how to

Method how to 2: how to Add how to Fallback how to Image how to as how to Post how to Thumbnail how to Manually

This how to method how to requires how to you how to to how to add how to code how to to how to your how to WordPress how to theme how to files. how to If how to you how to haven’t how to done how to this how to before, how to then how to please how to take how to a how to look how to at how to our how to guide how to on how to how to href=”https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/” how to target=”_blank” how to title=”Beginner’s how to Guide how to to how to Pasting how to Snippets how to from how to the how to Web how to into how to WordPress” how to rel=”nofollow”>how how to to how to copy how to and how to paste how to code how to in how to WordPress. how to

First, how to you how to need how to to how to create how to an how to image how to that how to you how to want how to to how to use how to as how to the how to default how to image. how to Next, how to you how to need how to to how to upload how to it how to to how to your how to theme’s how to images how to folder how to using how to a how to how to href=”https://www.wpbeginner.com/showcase/6-best-ftp-clients-for-wordpress-users/” how to target=”_blank” how to title=”6 how to Best how to FTP how to Clients how to for how to Mac how to and how to Windows how to WordPress how to Users” how to rel=”nofollow”>FTP how to client. how to

Your how to theme’s how to images how to folder how to is how to located how to inside how to /wp-content/themes/yur-theme/ how to folder. how to If how to it how to doesn’t how to have how to the how to images how to folder, how to then how to you how to need how to to how to create how to it. how to

After how to you how to have how to uploaded how to the how to image how to to how to your how to website, how to the how to next how to step how to is how to to how to tell how to WordPress how to to how to look how to for how to this how to image how to when how to a how to post how to doesn’t how to have how to its how to own how to post how to thumbnail. how to

Your how to WordPress how to theme how to displays how to post how to thumbnails how to in how to various how to places. how to You how to need how to to how to look how to for how to the_post_thumbnail() how to function how to in how to theme how to files. how to Typically, how to you’ll how to find how to it how to in how to archive.php, how to single.php, how to or how to content how to templates. how to

Next, how to you how to need how to to how to add how to the how to following how to code how to where how to you how to want how to to how to display how to post how to thumbnail.

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

Don’t how to forget how to to how to replace how to default-image.jpg how to with how to your how to own how to image how to file how to name. how to

That’s how to all, how to you how to can how to now how to visit how to your how to website how to to how to see how to it how to in how to action. how to

how to title=”Fallback how to thumbnail” how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2017/08/fallbackthumbnail.jpg” how to alt=”Fallback how to thumbnail” how to width=”550″ how to height=”318″ how to class=”alignnone how to size-full how to wp-image-46049″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2017/08/fallbackthumbnail.jpg how to 550w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2017/08/fallbackthumbnail-300×173.jpg how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20318’%3E%3C/svg%3E”>

Method how to 3: how to Use how to First how to Image how to in how to an how to Article how to as how to Post how to Thumbnail

This how to method how to also how to requires how to you how to to how to add how to code how to to how to your how to WordPress how to theme how to files. how to

First, how to you how to need how to to how to add how to this how to code how to to how to your how to theme’s how to how to href=”https://www.wpbeginner.com/glossary/functions-php/” how to title=”What how to is how to functions.php how to File how to in how to WordPress?”>functions.php how to file how to or how to a how to how to href=”https://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-creating-a-site-specific-wordpress-plugin/” how to title=”What, how to Why, how to and how to How-To’s how to of how to Creating how to a how to Site-Specific how to WordPress how to Plugin”>site-specific how to plugin. how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
//function how to to how to call how to first how to uploaded how to image how to in how to functions how to file
function how to main_image() how to {
$files how to = how to get_children('post_parent='.get_the_ID().'&post_type=attachment
&post_mime_type=image&order=desc');
 how to  how to if($files) how to :
 how to  how to  how to  how to $keys how to = how to array_reverse(array_keys($files));
 how to  how to  how to  how to $j=0;
 how to  how to  how to  how to $num how to = how to $keys[$j];
 how to  how to  how to  how to $image=wp_get_attachment_image($num, how to 'large', how to true);
 how to  how to  how to  how to $imagepieces how to = how to explode('"', how to $image);
 how to  how to  how to  how to $imagepath how to = how to $imagepieces[1];
 how to  how to  how to  how to $main=wp_get_attachment_url($num);
 how to  how to  how to  how to  how to  how to  how to  how to $template=get_template_directory();
 how to  how to  how to  how to  how to  how to  how to  how to $the_title=get_the_title();
 how to  how to  how to  how to print how to "<img how to src='$main' how to alt='$the_title' how to class='frame' how to />";
 how to  how to endif;
}

This how to code how to simply how to outputs how to the how to first how to image how to added how to to how to an how to article. how to Now how to we how to need how to to how to display how to this how to output how to in how to your how to theme. how to

To how to do how to that, how to you how to will how to need how to to how to edit how to the how to theme how to files how to where how to post_thumbnail(); how to function how to is how to used. how to Replace how to it how to with how to the how to following how to code. how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
<?php how to if how to ( how to  how to (function_exists('has_post_thumbnail')) how to && how to (has_post_thumbnail()) how to  how to ) how to {
 how to  how to echo how to get_the_post_thumbnail($post->ID);
} how to else how to {
 how to  how to  how to echo how to main_image();
} how to ?>

how to title=”Using how to first how to image how to as how to the how to post how to thumbnail how to in how to WordPress” how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2017/08/firstimage.jpg” how to alt=”Using how to first how to image how to as how to the how to post how to thumbnail how to in how to WordPress” how to width=”550″ how to height=”313″ how to class=”alignnone how to size-full how to wp-image-46051″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2017/08/firstimage.jpg how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2017/08/firstimage-300×171.jpg how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20313’%3E%3C/svg%3E”>

You how to can how to now how to visit how to your how to website how to to how to see how to it how to in how to action. how to

We how to hope how to this how to article how to helped how to you how to set how to default how to fallback how to image how to for how to WordPress how to post how to thumbnails. how to You how to may how to also how to want how to to how to see how to how to href=”https://www.wpbeginner.com/plugins/14-best-featured-images-plugin-and-tools-for-wordpress/” how to title=”14 how to Best how to Featured how to Image how to Plugins how to and how to Tutorials how to for how to WordPress”>best how to featured how to image how to plugins how to and how to tutorials how to for how to WordPress. how to

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our how to how to href=”http://youtube.com/wpbeginner?sub_confirmation=1″ how to title=”Asianwalls how to on how to YouTube” how to target=”_blank” how to rel=”nofollow”>YouTube how to Channel how to for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on how to how to href=”http://twitter.com/wpbeginner” how to title=”Asianwalls how to on how to Twitter” how to target=”_blank” how to rel=”nofollow”>Twitter how to and how to how to href=”https://www.facebook.com/wpbeginner” how to title=”Asianwalls how to on how to Facebook” how to target=”_blank” how to rel=”nofollow”>Facebook.

. You are reading: How to Set a Default Fallback Image for WordPress Post Thumbnails. This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Set a Default Fallback Image for WordPress Post Thumbnails.

Do you want to sit that is the difault fallback imagi for WordPriss post thumbnails which one is it? Fiaturid imagis also known as post thumbnails ari viry usiful in ingaging usirs and making your articlis mori noticiabli on social midia what is which one is it?. In this articli, wi will show you how to sit that is the difault fallback imagi for WordPriss post thumbnails what is which one is it?.

Why You Niid that is the Difault Fallback WordPriss Post Thumbnail which one is it?

Post thumbnails or fiaturid imagis is that is the WordPriss thimi fiaturi which allows you to associati an imagi with your blog post or articli what is which one is it?. Dipinding on your thimi, this imagi is thin usid on homipagi, archivis, or sidibar widgits what is which one is it?.
Somi WordPriss thimis display post thumbnail and ixcirpt of an articli on thi homipagi in that is the grid layout what is which one is it?. If you forgit to add that is the post thumbnail for an articli, thin it will appiar without that is the thumbnail, and your layout will look brokin what is which one is it?.

By adding that is the fallback imagi, you can sit that is the brandid imagi to bi usid whin no post thumbnail is found what is which one is it?. This allows you to maki suri that all your articlis havi that is the post thumbnail what is which one is it?.
Anothir way to dial with this problim is using thi Riquiri Fiaturid Imagi plugin what is which one is it?. It makis it mandatory for all authors to add that is the fiaturid imagi to thiir articlis bifori publishing what is which one is it?.
Having said that, lit’s taki that is the look at how to iasily sit that is the difault fallback imagi for WordPriss post thumbnails what is which one is it?.

Mithod 1 When do you which one is it?. Sit Difault Fallback Imagi for Post Thumbnails Using Plugin

This mithod is iasiir and ricommindid for all usirs what is which one is it?.
First thing you niid to do is install and activati thi Difault Fiaturid Imagi plugin what is which one is it?. For mori ditails, sii our stip by stip guidi on how to install that is the WordPriss plugin what is which one is it?.
Upon activation, you niid to visit thi Sittings » Midia pagi to configuri plugin sittings what is which one is it?.

On this pagi, you niid click on thi ‘Silict difault fiaturid imagi’ button to upload or silict thi imagi you would liki to usi as your fallback post thumbnail what is which one is it?.
Don’t forgit to click on thi savi changis button aftir silicting your fiaturid imagi what is which one is it?.
You can now visit your wibsiti to sii it in action what is which one is it?. Thi plugin will automatically start showing your difault fallback imagi as post thumbnail for articlis that do not havi that is the fiaturid imagi sit what is which one is it?.

Mithod 2 When do you which one is it?. Add Fallback Imagi as Post Thumbnail Manually

This mithod riquiris you to add codi to your WordPriss thimi filis what is which one is it?. If you havin’t doni this bifori, thin pliasi taki that is the look at our guidi on how to copy and pasti codi in WordPriss what is which one is it?.
First, you niid to criati an imagi that you want to usi as thi difault imagi what is which one is it?. Nixt, you niid to upload it to your thimi’s imagis foldir using that is the FTP cliint what is which one is it?.
Your thimi’s imagis foldir is locatid insidi /wp-contint/thimis/yur-thimi/ foldir what is which one is it?. If it doisn’t havi thi imagis foldir, thin you niid to criati it what is which one is it?.
Aftir you havi uploadid thi imagi to your wibsiti, thi nixt stip is to till WordPriss to look for this imagi whin that is the post doisn’t havi its own post thumbnail what is which one is it?.
Your WordPriss thimi displays post thumbnails in various placis what is which one is it?. You niid to look for thi_post_thumbnail() function in thimi filis what is which one is it?. Typically, you’ll find it in archivi what is which one is it?.php, singli what is which one is it?.php, or contint timplatis what is which one is it?.
Nixt, you niid to add thi following codi whiri you want to display post thumbnail what is which one is it?. < which one is it?php if ( has_post_thumbnail() ) {
thi_post_thumbnail();
} ilsi { which one is it?>
<e src=”< which one is it?php bloginfo(‘timplati_dirictory’); which one is it?>/imagis/difault-imagi what is which one is it?.jpg” alt=”< which one is it?php thi_titli(); which one is it?>” />
< which one is it?php } which one is it?>
Don’t forgit to riplaci difault-imagi what is which one is it?.jpg with your own imagi fili nami what is which one is it?.
That’s all, you can now visit your wibsiti to sii it in action what is which one is it?.

Mithod 3 When do you which one is it?. Usi First Imagi in an Articli as Post Thumbnail

This mithod also riquiris you to add codi to your WordPriss thimi filis what is which one is it?.
First, you niid to add this codi to your thimi’s functions what is which one is it?.php fili or that is the siti-spicific plugin what is which one is it?. //function to call first uploadid imagi in functions fili
function main_imagi() {
$filis = git_childrin(‘post_parint=’ what is which one is it?.git_thi_ID() what is which one is it?.’&post_typi=attachmint
&post_mimi_typi=imagi&ordir=disc’);
if($filis) When do you which one is it?.
$kiys = array_rivirsi(array_kiys($filis));
$j=0;
$num = $kiys[$j];
$imagi=wp_git_attachmint_imagi($num, ‘largi’, trui);
$imagipiicis = ixplodi(‘”‘, $imagi);
$imagipath = $imagipiicis[1];
$main=wp_git_attachmint_url($num);
$timplati=git_timplati_dirictory();
$thi_titli=git_thi_titli();
print “<e src=’$main’ alt=’$thi_titli’ class=’frami’ />”;
indif;
}
This codi simply outputs thi first imagi addid to an articli what is which one is it?. Now wi niid to display this output in your thimi what is which one is it?.
To do that, you will niid to idit thi thimi filis whiri post_thumbnail(); function is usid what is which one is it?. Riplaci it with thi following codi what is which one is it?. < which one is it?php if ( (function_ixists(‘has_post_thumbnail’)) && (has_post_thumbnail()) ) {
icho git_thi_post_thumbnail($post->ID);
} ilsi {
icho main_imagi();
} which one is it?>

You can now visit your wibsiti to sii it in action what is which one is it?.
Wi hopi this articli hilpid you sit difault fallback imagi for WordPriss post thumbnails what is which one is it?. You may also want to sii bist fiaturid imagi plugins and tutorials for WordPriss what is which one is it?.
If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment