featured image inside post

@PatJ’s answer affords the most control over the placement of the image but involves editing the theme, which may or may not be wise, or possible, depending on the circumstance, so an alternative is to add a filter to the_content. function add_thumb_wpse_100914($content) { // check that we are on a ‘single’ post display and… // … Read more

Post thumbnail outside of loop

Take a look into the function single_post_title() in the general-template.php file and you will find following: $_post = get_queried_object(); and in that function you also see: $_post->post_title which gives you the title of the page outside of the loop. Now to get the Featured Image you simply do the following $_post = get_queried_object(); <br>echo get_the_post_thumbnail($_post->ID);

post thumbnail, conditions, else wont work

Thanks everyone for all the help! I really appreciate it. I was able to make it work by removing [0] in $imgsrc = $img[0]; and using custom_get_meta() like: $img = post_movie_get_meta(‘featured_img’) and: $img = post_movie_get_meta(‘backdrop_img’)

Custom recent-posts shortcode’s thumbnail image not in line with rest of code

The problem is: the_post_thumbnail() outputs its content immediately. It’s basically like echoing instead of returning. To fix it, you should be able to just replace the_post_thumbnail(‘thumbnail’, [‘class’ => ‘droplet-img’, ‘title’ => get_the_title()]) with get_the_post_thumbnail(‘thumbnail’, [‘class’ => ‘droplet-img’, ‘title’ => get_the_title()])

Redirect to another page using contact form 7? [closed]

Redirect to another page using contact form 7? [closed]

get_the_post_thumbnail(‘thumbnail-name’) always returns empty string

You’re using get_the_post_thumbnail() and not the nonexistent get_post_thumbnail() function, right? As JohnG said, you have to pass the ID of the current post to get_the_post_thumbnail() (the the_post_thumbnail() function already handles that for you). The Function Reference in the WordPress Codex has many usage examples: get_the_post_thumbnail($id); // without parameter -> Thumbnail get_the_post_thumbnail($id, ‘thumbnail’); // Thumbnail get_the_post_thumbnail($id, … Read more