Layer post title on top of image WordPress featured thumbnail image
the_post_thumbnail() does not return the path of your image. Instead, it returns the complete HTML markup for that image. You can use this instead: $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ) ); echo $image[0]; If you want a specific size you can pass an additional parameter: $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘full’ ); echo $image[0]; … Read more