I have implemented and seen php scripts inside html code. The web server requires to be instructed to parse the html for PHP scripts, then execute them on the server and then serve the content to the client.
For apache servers, there are a few ways of doing this, one common way is using these apache’s handlers:
AddType application/x-httpd-php .php .htm .html
RemoveHandler .html .htm
Though for wordpress, I would like also to add php scripts or any server side scripting, to deliver content on post and other wordpress pages so to maximize SEO.