Error including img in a php file
-
Hello. I am making a new single.php template. When I try to include an image in it:
<img class="img-fluid" src="<?php the_post_thumbnail(); ?>" alt="main picture">
What I get is the picture + “alt=”main picture”>. For any reason, what I write after ?> is shown also in the site. But I need to close img tag, in order to avoid php errors. Am I using a wrong syntax? The result is the same if I write
<img class="img-fluid" src='<?php the_post_thumbnail(); ?>' alt="main picture">
or
<img class="img-fluid" src=<?php the_post_thumbnail(); ?> alt="main picture">
Thanks a lot for your help!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Error including img in a php file’ is closed to new replies.