Use this code instead of has_post_thumbnail()
if ( '' != get_the_post_thumbnail() ) {
// some code
}
Please refer below link for more information
http://codex.wordpress.org/Function_Reference/has_post_thumbnail
Related Posts:
- Why use if function_exists?
- What’s the difference between esc_html, esc_attr, esc_html_e, and so on?
- Include files in child theme functions file
- Check if post is being published for the first time, or is an already published post being updated
- Is it possible to rename a post format?
- How to get woocommerce inventory status [closed]
- Is there a hook or function I can use to display all theme files being used on a current page?
- Implementing DNS Prefetching with WordPress
- How can I remove the title “leave a reply” in the comment box in twentyeleven?
- Child theme – overriding add_image_size by a child theme [duplicate]
- Why do I get Fatal error: Call to undefined function get_most_recent_post_of_user()?
- Check if has any sidebar active on current page
- Login using the password from protected pages
- Remove tag on my RSS Feed
- Automated mark posts as featured every day
- Enqueuing External Javascript functions.php
- Child Theme Not Overriding Parent Theme
- Function to wrap the_content in a div
- How to run a function once on every post in database?
- Checked() showing up twice in custom fields
- Date/time limitation of posts where function must be executed
- Custom image size in Media Dropdown
- Trouble using antispambot()
- Gravity Forms field entries into wp_query loop [closed]
- Post Pagination Showing Same Posts Every Page
- Update Content based on expiration time or queued processing
- How to filter a table in post content without plugins? [closed]
- Adding to fontawesome-webfont.woff2 to boost website speed
- How to enable template page only for a post id page
- Having issues with a foreach inside of a shortcode with ACF gallery
- Don’t delete a page if it holds users
- WooCommerce – Want to show multiple currency for a single product [closed]
- How add various functions within 1 conditional?
- Disable auto-resizing of uploaded images, but only for certain filename
- Function only on a specific page
- Add to cart php not working [closed]
- Create cron job for update translations automatically
- Login Redirect if Logged in from Specific Page
- get_next_posts_link not working without parameter max_num_pages
- create filter in functions.php
- Logout Shortcode URL
- Add Custom Background Properties to Customizer
- Override the function twentytwelve_scripts_styles in a child theme
- Custom taxonomy widget in admin area
- WordPress functions.php – Execute plugin specific user online
- What is the Difference in bones_comments() and comments.php
- Custom Sidebar only on single post
- Trying to register script in footer
- Do I need to use wp_reset_postdata for my function?
- Can I have an additional functions.php file in WordPress?
- Shotcode argument issues
- Split Media Queries in different files!
- functions.php and conditional tags
- how to make has_block() see inside blocks too
- add_theme_support( ‘title_tag’ ) is not showing title on index.php
- Tracking the number of shortcodes for a list?
- Need help with customalert that it would read on a normal page, but not in WordPress
- Child theme function.php causes fatal error
- Best way to disable sidebars on posts (only)?
- How to print the current post depth as update notification?
- How to safely edit functions.php
- Linking Javascript in functions.php file
- Enqueueing scripts selectively & activation where needed
- Changing the text of Upload/Insert on Posts and Pages Screen
- Using One Function To Create Two Different Shortcodes
- remove edit link only for published post and pending post
- Change Page Title
- How to Not Show posts on Category page?
- Put images in the media from url functions
- Paragraph spaces in email template function
- When are the user meta fields created in the database? Admin vs Woo API REST
- Including Font Awesome in a Custom Theme
- How to automatically add counted number to navigation menu items?
- Insert Modal on user first login
- Trying to load JavaScript only on pages within a PODS category/ custom post type
- How would I correctly implement a new if statement in a child functions file?
- Correct way of Enqueue self hosted fonts in sass project
- function syntax is off,
- How To Show Shortcodes In WordPress Custom Fields?
- Language Switch Function
- How to debug function file causing white screen
- Change category checkbox into radio button [duplicate]
- Author info does not show up when author has no posts
- How can I include user meta information in the resulting array of a WP_User_Query?
- How to add next height number in Order Attributes inside the Add new page. [duplicate]
- Load CSS conditional on custom field is present
- Modify sub_menu function to show pages below a specifically set page
- Add custom class to all URLs on entire site
- Show the online status of the current post’s author
- Functions.php in child theme that loads CSS file breaks website
- Unregistering custom tinymce plugin?
- How does child theme functions.php work with parent theme functions.php? Is it like CSS? [duplicate]
- restrict access to specific urls on a specific period of time
- Change conditional tag in wordpress without editing the core files
- Need a functions that adds (adm)/(mod) if current user is admin/moderator right after their username
- site_url is not honoring scheme
- clickable title of 2 post on mainpage USING functions.php
- Custom Post Type Search
- How do i set global variable in a function in wordpress functions.php
- How to add more than one menu for logged in members?