Featured Image won’t display on Posts page

When you have the Posts Page: set to “Blog” and then you visit the page directly (via the slug) does the header image display? Setting the static “Posts” page to your “Blog” page overrides the template. WordPress will use the Template Hierarchy to figure out which file to use to display the blog posts. The … Read more

Featured image is not uploading

Switching to the unedited default Theme (Twenty Sixteen, etc.) for a moment using the WP dashboard to rule out any theme-specific issue. Maybe a third party plugin causes a js conflict/error on the admin screen. Please try to deactivate all plugins and check if this solves the issue. If yes activate them one by one … Read more

get custom post type thumbnail

Please update the while loop with this: It will print the thumbnail url for you ** POST FETCHING ARGUMENTS ** <?php /**** Slider Call Function ****/ function callTheSlider() { $args = array(‘post_type’=> ‘expro_slider’, ‘post_status’ => ‘publish’, ‘order’ => ‘DESC’); ?> <ul> <?php wp_reset_query(); $query = new WP_Query($args); while($query->have_posts()) : $query->the_post(); if(has_post_thumbnail()) { ?> <li> <?php … Read more

How to check the array of featured images IDs

This is solely a PHP question. But as birgire mentioned, you can use in_array(). So, change your code to this: $post_thumbnail_id = get_post_thumbnail_id(); if( in_array( $post_thumbnail_id, array(1, 2, 3 ) ) ) { echo ‘<span>Location</span>’; } The first argument is your value, the second one is the array you want to search in.

Display the featured image from the last post

This should work. I’ve modified your $args a little and surrounded your echoed code within the while(have_posts()) : the_post(); loop, then added the the_post_thumbnail() function and, finally, the wp_query_reset(); at the bottom: <?php $limit = 999; $counter = 0; $categories = get_categories(); foreach ( $categories as $category ): if ( $counter < $limit ) { … Read more

has_post_thumbnail gives always TRUE

Then you’re using it outside of the loop, try this instead: <?php if (has_post_thumbnail( get_the_ID() )) { get_the_post_thumbnail( get_the_ID(), array(80,80) ); } else { ?> <img src=”http://example.org/<?php the_title( get_the_ID() ); ?>” width=”80px” height=”80px” alt=”<?php the_title( get_the_ID() ); ?>”> <?php } ?> If you’re not inside of a WP_Query loop, then post-specific functions like has_post_thumbnail() the_title() … Read more