Try to use the has_post_thumbnail function.
From the codex:
<?php
//This must be in one loop
if(has_post_thumbnail()) {
the_post_thumbnail();
} else {
echo '<img src="'.get_bloginfo("template_url").'/images/img-default.png" />';
}
?>
Related Posts:
- Can i merge 2 new WP_Query($variable) ‘s?
- Get source from the_post_thumbnail
- why when I try to insert an image attachment along with a post does wp_get_attachment_url give me a very wrong file path?
- How to show only blog-domain instead of the whole permalink in the loop
- the_content not working on one of two Multisite sites
- Remove W3 Total Cache minified files on custom page outside of WordPress [closed]
- featured image metabox MU
- Autoblog posts in wpms(network) into main site including featured images
- Multisite redirect loop for a single www domain
- There is no featured image in my post in wordpress multisite theme [closed]
- Site Redirecting to wp-signup.php
- Are nested subdomains possible with a subdomain multisite?
- Querying posts from multiple sites in a network?
- is_front_page() malfunction?
- How can I diagnose a slow WordPress admin?
- How to enable a site administrator to edit users in a WordPress network/ multisite setup?
- BLOG_ID_CURRENT_SITE vs. SITE_ID_CURRENT_SITE in WordPress Multisite?
- Shared table across network
- Turn off ms-files.php after network setup
- Opinions whether to go multisite VS 3 separate WP installation [closed]
- Multisite: differences between subdomain and subdirectory mode? Can it be switch after installation?
- Ban SiteNames Multisite
- WP MultiSite API – Create new sites
- Multisite – how to remove the root ‘/’ site?
- WordPress multisite with domain mapping and virtual host on local with fake domain
- Don’t allow access to wp-admin but allow admin-ajax requests to be fulfilled on frontend?
- Timeout While Upgrading Network in Multi-site
- Full Domain Mapping with WP3 in Multiuser Mode
- Copy site from one multisite to another
- add_rewrite_rule not registering on Multisite
- How to combine multiple sites to WordPress MU
- how do I configure nginx for wordpress multisite, it occurs ERR_TOO_MANY_REDIRECTS
- Installing multisite network admin on sub-domain
- multisite custom directory
- Changing wp-content to other name? Multisite set up
- Redirect users on logout
- You do not have permission to edit this user
- Rest API Multisite Site List?
- Query users by capability – uninstall/deactivate callback
- Cannot access my first sub-site in a multisite [closed]
- Multisite setup help – plain domain/subsite always redirects to domain with subdir multisite
- Auto creation of multisite blog on user registration
- Memory question on WordPress Multisite
- How to protect post attachments related to a custom post type, from non-logged in users, on 1 subsite of a multisite installation?
- Aggregate multisite RSS and restrict certain content
- WordPress multisite on IIS – can’t open subpages
- Issues with Multisite installation and 403 error for REST API request
- How to run react app and headless WordPress and React App on same server (managed by plesk)?
- Nginx Wildcard SSL with WordPress Multisite Subdomains
- Multisite – Parent site with Polylang with different domains for each language [closed]
- How to disable wordpress cron jobs for a subsite?
- Multisite – create plugin to hide deactivated sites from the sites overview
- network site domain mapping still applied after being removed
- Can WordPress Multisite (MU) subdirectory url/slug/permalink be changed?
- Multisite Subdomain Redirect Mask
- How to use HyperDB plugin in a existing wpmu
- Sort by site/blog column in Multisite
- Possibility of Create Site Specific CSS in a Multisite
- Get post by term from custom taxonomy in another blog on the network?
- Two wordpress mu installs, same settings/plugins/themes?
- Multi Network plugin: “Network not created” [closed]
- Https and Http Login Issue on WordPress Multisite
- How can I use different domains on a WP multisite install?
- Multisite network admin – User’s role not showing up
- Is it possible to install WordPress MU on a subdomain?
- WordPress get post thumbnail url
- WordPress multisite with same content
- Redirecting to page not found mulitiste
- How to check all items in a loop have post thumbnail?
- How many .htaccess files should a WordPress multisite (subdirectory set up) have?
- Multisite and Multidomains WordPress
- mu activate / deactivate plugins in multisite network mode only
- Is there any hook to validate google recaptcha dislayed in wp-signup page [in WordPress Multisite]
- Primary (root) blog of multisite installation forbidden (403)
- Duplicate/Clone a Multi-site But Use Same Images & Resources?
- How do I split a single WPML site with 6 languages (English is Main) into Multisite with 5 subfolders
- WordPress Multisite with Subdomain, make the subdomain look like another domain
- Login issues on WordPress Multisite and domain mapping
- How To Upload Existing WordPress Site To WordPress Multisite Using SSH
- Change header.php of a specific WordPress Multisite
- Multisite htaccess with domain rewrites
- How to get the categories of a selected blog on multisite?
- Proper setup of multi doman site
- fatal Error undefined function switch_to_blog()
- Do “switch_to_blog()” and “restore_current_blog()” re-run the filters?
- Move two independent sites to network
- Why does defining MULTISITE true change the database connection in use
- WordPress Multisite Cron Issue
- New Site URL for Multisite
- How to install wpengine hosted multisite locally
- Different page content for default pages on WordPress Multisite
- WordPress showing strange characters – UTF8
- Nginx Multisite redirects (incorrectly) on Chrome IE and Mobile, but works (correctly) on Firefox
- Permalinks in Multisite not working
- Setting up wordpress on a hosting server for the first time
- Not being allowed to use some terms in Add New Site in WordPress
- How to redirect root blog to a specific one in multilang WP?
- Single installation with sub-domains for admin and separate domains for sites
- Map WP Multisite blog.example.com to anotherdomain.com/blog?
- get_category_link() or get_tag_link() return wrong category/tag base in wordpress multisite