PHP page templates in modern WordPress?

I’m working on a project that uses custom PHP page templates for some of the pages. I switched the theme from 2019 to 2023, then copied over the templates to the 2023 templates directory.

Oh no! They don’t work anymore! What’s this? The templates are HTML and if you add PHP code to one, the PHP is not executed.

Okay so I’m a little behind on FSE and blocks. But this was a surprise.

So my question is, is there a way to execute PHP code in custom page templates in modern WordPress? If not, does anyone have any ideas about how porting custom page templates from PHP templates to HTML ones can be accomplished?

Or is the solution to stick with an older theme that still supports PHP?

Any advice very much appreciated.

1 Comment
  1. Don’t use 2023 if you want to use PHP templates. There’s literally no need to use that theme if you already have a working custom theme.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer