I have tried to attach images to post by selecting it from the media and inserting it to the post. But when using the has_post_thumbnail() function, I am not getting the result as expected. Can anyone tell me how to attach a file to the post and get the source url of the attached file.
Share
are you JUST using the
has_post_thumbnail()function?has_post_thumbnail()returns a boolean (True/False) value depending on whether or not there exists a thumbnail for said post. You want to add the function:the_post_thumbnail()after that. Here is the code I use for post thumbnails: