Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To show a consistent image when a post has no featured image, add post-thumbnail support, then change the theme template that renders thumbnails to test has_post_thumbnail(). Render the assigned thumbnail when the test passes; otherwise render an image asset you choose as the fallback.

How the fallback works

A WordPress featured image—also called a post thumbnail—is an image attached to a post, page, or supported custom post type. WordPress does not automatically select a site-wide default image in the template logic. Your theme must decide what to output when no thumbnail is attached.

The conditional belongs in the template that actually produces the card, archive item, related-post block, or other thumbnail markup. Editing an unused template will not change the visible result, so first identify the file or block responsible for the output in your active theme.

1. Enable post thumbnails in the theme

Most modern themes already support featured images. If yours does not, add support in the active theme’s functions.php, or in code loaded by the theme, before WordPress initializes:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Nulaxy Ergonomic Adjustable Laptop Stand for Desk, Dual Foldable Computer Riser with Advanced Heat-Vent, Heavy-Duty Portable Notebook Holder for Posture Correction, Compatible with Mac 10-16" Laptops
  • Ergonomic Posture Correction: Designed to elevate your laptop to the perfect eye level, this adjustable laptop stand significantly reduces neck, shoulder, and spinal fatigue. Transform your desk into a healthier workstation, ideal for long hours of typing, Zoom meetings, or gaming.
  • Unshakable Dual-Rod Stability: Unlike single-hinge models, our stand features a highly engineered dual-support rod mechanism. It perfectly distributes weight to ensure a 100% wobble-free typing experience, safely supporting heavy-duty devices up to 22 lbs (10kg).
  • Advanced Thermal Cooling Panel: Maximize your device's performance. The unique geometric heat-vent design on the upper panel provides superior airflow compared to standard solid stands. This continuous heat dissipation prevents your laptop from thermal throttling and hardware damage during intensive tasks.
  • Universal 10-16” Compatibility: A versatile computer riser that seamlessly fits all 10 to 16-inch laptops. Broadly compatible with MacBook Pro/Air, Dell XPS, HP, Lenovo, ASUS, Chromebook, and large gaming laptops. The anti-slip silicone pads firmly grip your device and protect it from scratches.
  • Foldable, Portable & Ready to Go: Maximize your productivity anywhere. The dual-foldable design allows the stand to collapse completely flat in seconds. Easily slip it into your backpack or briefcase, making it the ultimate portable office accessory for business trips, cafes, or hybrid work setups.
add_action( 'after_setup_theme', function () {
    add_theme_support( 'post-thumbnails' );
} );

WordPress documents after_setup_theme as an appropriate hook because theme support must be registered before init. A theme can limit support to selected post types; custom post types can also register thumbnail support when they are registered.

If the Featured image control is still missing after adding support, check that you edited the active theme (preferably a child theme), that the relevant post type supports thumbnails, and that no plugin or theme code removes the support.

Rank #2
Sale
BESIGN LS03 Aluminum Laptop Stand, Ergonomic Detachable Computer Stand, Notebook Riser, Laptop Mount Compatible with Air, Pro, Dell, HP, Lenovo More 10-15.6" Laptops, Silver
  • Broad Compatibility: Besign LS03 Laptop Mount is compatible with all laptops from 10''-15.6'', such as Air 13, Pro 13 / 15 / 2018 / 2017 / 2016, Lenovo ThinkPad, Dell, HP, ASUS, Chromebook, and other notebooks.
  • Ergonomic Design: This LS03 Laptop Stand could elevate your laptop by 6’’ to a perfect viewing level, help you improve your posture and reduce neck and shoulder pain. This laptop stand is super easy to detach and assemble.
  • Stable And Protective: This laptop stand is made of premium Aluminum alloy, it is sturdy, support up to 8.8 lbs(4kg), no worry any wobble at all; the rubber on the holder hands sticks tightly, ensure your laptop stable on the stand and prevent any scratches.
  • Keep Laptop Cool: the open aluminum design provides good ventilation and airflow to prevent your laptop from overheating. It folds flat if you need to store it, create extra space on your desk and keep your desk clean and organized.
  • Easy to Use: thanks to the detachable design, you could assemble it very easily it 3 steps.

2. Add the conditional fallback to the rendering template

Place this logic inside the Loop or component where the thumbnail should appear. The asset path below is an example; create the file there or change the path to your own image.

<?php if ( has_post_thumbnail() ) : ?>
    <?php the_post_thumbnail( 'post-thumbnail' ); ?>
<?php else : ?>
    <img
        src="<?php echo esc_url( get_theme_file_uri( 'assets/images/default-thumbnail.jpg' ) ); ?>"
        alt=""
    >
<?php endif; ?>

has_post_thumbnail() is the branch condition: it returns true when the current post has an attached thumbnail. the_post_thumbnail() outputs the assigned image markup. The fallback branch outputs your own image element, and esc_url() escapes the generated URL before it is inserted into HTML.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LOXP Adjustable Laptop Stand, Computer Stand with 360 Rotating Base
  • ✔️[Foldabe & Protable] - Foldable laptop stand for desk & Protable computer stand, It combines the advantages of market brackets, convenient travel laptop stand. Easy to use. Suitable for working at home, office and outdoor, improve comfort.
  • ✔️[360°Rotation] - The computer stand with 360° rotating base, 360° rotation connected with the base is more flexible, the computer stand allows you to rotate the laptop to any angle.
  • ✔️[Stable & Durable] - The Computer stand is made of one-piece fiber metal material, which is more durable and stable than ordinary aluminum alloy computer stands. The upgraded rotating base makes the stand performance more stable, and the non-slip silicone protects the laptop from sliding.Only supports laptops up to 16 inches.
  • ✔️[Ergonmic Desing] - You can freely adjust the height and angle of the laptop stand to keep it at eye level, which helps to reduce the pressure on your body while working. Whether sitting or standing, there is a comfortable angle.
  • ✔️[Wide Compatibility] - Our laptop stand is compatible with all laptops from 10-16 inches, such as MacBook Air/Pro, Google PixelBook, Dell XPS, HP, ASUS, Lenovo ThinkPad, Acer, Chromebook and Microsoft Surface, etc. It is an ideal companion for computer workers.

Choose the correct alternative text

  • Use an empty alt="" when the fallback is purely decorative and the surrounding text already identifies the post.
  • Use concise, meaningful alternative text when the fallback itself conveys information that users need.

Match the fallback element’s classes, wrapper, and attributes to the existing thumbnail markup if the theme relies on CSS, lazy-loading behavior, or responsive image styling.

3. Return the markup instead of printing it

Use get_the_post_thumbnail() when another function needs the generated HTML as a string—for example, when assembling a larger card before returning it. Use the_post_thumbnail() when the image should be printed immediately.

Rank #4
Gogoonike Adjustable Laptop Stand for Desk, Metal Laptop Riser Holder
  • 【Adjustable & Ergonomic】:This laptop stand can be adjusted to a comfortable height and angle according to your actual needs, letting you fix posture and reduce your neck fatigue, back pain and eye strain. Very comfortable for working in home, office and outdoor.
  • 【Sturdy & Protective】 :Made of sturdy metal, it can support up to 17.6 lbs (8kg) weight on top; With 2 rubber mats on the hook and anti-skid silicone pads on top & bottom, it can secure your laptop in place and maximum protect your device from scratches and sliding. Moreover, smooth edges will never hurt your hands.
  • 【Heat Dissipation】 :The top of the laptop stand is designed with multiple ventilation holes. The open design offers greater ventilation and more airflow to cool your laptop during operation other than it just lays flat on the table.
  • 【Portable & Foldable】:The foldable design allows you to easily slip it in your backpack. Ideal for people who travel for business a lot.
  • 【Broad Compatibility】:Our desktop book stand is compatible with all laptops from 10-15.6 inches, such as MacBook Air/ Pro, Google Pixelbook, Dell XPS, HP, ASUS, Lenovo ThinkPad, Acer, Chromebook and Microsoft Surface, etc.Be your ideal companion in Home, Office & Outdoor.
Function Result Typical use
has_post_thumbnail() Boolean test for an attached thumbnail Choose the assigned-image or fallback branch
the_post_thumbnail( $size ) Prints the thumbnail HTML Direct output in a template
get_the_post_thumbnail( $post, $size ) Returns the thumbnail HTML Store, modify, or combine markup before output
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

4. Select an image size that fits the layout

post-thumbnail is the documented default size when the theme has registered that special size. You can pass another registered image size or a dimensions argument when the layout requires it:

<?php the_post_thumbnail( 'medium_large' ); ?>

The available names and their crops depend on the sizes registered by the site and theme. Choose a size that matches the displayed card or hero area rather than assuming one universal dimension. The fallback asset should have a comparable aspect ratio so cards do not change height when a post lacks a featured image.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Tonmom Adjustable Laptop Stand for Desk, Metal Foldable Laptop Riser
  • ✅【Adjustable & Ergonomic】:This laptop stand can be adjusted to a comfortable height and angle according to your actual needs, letting you fix posture and reduce your neck fatigue, back pain and eye strain. Very comfortable for working in home, office and outdoor.
  • ✅【Sturdy & Protective】 :Made of sturdy metal, it can support up to 17.6 lbs (8kg) weight on top; With 2 rubber mats on the hook and anti-skid silicone pads on top & bottom, it can secure your laptop in place and maximum protect your device from scratches and sliding. Moreover, smooth edges will never hurt your hands.
  • ✅【Heat Dissipation】 :The top of the laptop stand is designed with multiple ventilation holes. The open design offers greater ventilation and more airflow to cool your laptop during operation other than it just lays flat on the table.
  • ✅【Portable & Foldable】:The foldable design allows you to easily slip it in your backpack. Ideal for people who travel for business a lot.
  • ✅【Broad Compatibility】:Our laptop holder is compatible with all laptops from 10-17.3 inches, such as MacBook Air/ Pro, Google Pixelbook, Dell XPS, HP, ASUS, Lenovo ThinkPad, Acer, Chromebook and Microsoft Surface, etc.Be your ideal companion in Home, Office & Outdoor.

Use one fallback or several

  • A single shared asset gives every unassigned post a consistent visual treatment.
  • Separate assets can represent categories or content types, but require additional conditions and maintenance.
  • For a custom post type, verify that both the post type and the template support and render thumbnails.

5. Verify the template and test both paths

  1. Put the fallback image at the path used by your code, or update get_theme_file_uri() to the asset’s real location.
  2. Open an item with a featured image and confirm the assigned image still appears.
  3. Open an item without a featured image and confirm the fallback appears in the same container and size.
  4. Check archive pages, search results, related-post components, and any other templates that render thumbnails; each output location may need the conditional.
  5. Inspect the generated HTML and confirm the URL is correct, the alternative text is intentional, and the image does not break the theme’s responsive or lazy-loading styles.

If nothing changes

  • The edited file may not be used by the active theme, a block template, or a page-builder component.
  • The visible component may use a different thumbnail function or its own image query.
  • Template or page caching may be serving older markup; clear the relevant cache after confirming the code path.
  • The image may exist at a different path, or the browser may be blocking a missing or inaccessible asset.

Block themes and custom layouts

In a block theme, the visible thumbnail may be produced by a Site Editor template or Query Loop block rather than a PHP file you edited. Locate the template part that renders the post featured image and apply the fallback in the component that controls that output, or use the theme’s supported block settings if they provide a fallback option. The same principle remains: test whether a thumbnail exists, then supply an image when it does not.

Keep the implementation maintainable

  • Make changes in a child theme or another update-safe customization layer instead of editing a parent theme directly.
  • Store the fallback in a stable theme asset location and document its expected dimensions for future editors.
  • Reuse the theme’s existing wrapper classes and registered image sizes so assigned and fallback images behave consistently.
  • Apply the conditional everywhere the site presents a thumbnail; a fallback in one archive template does not automatically affect every other component.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.