PHP code in page template vs functions

I’ve made numerous WordPress sites, and learned PHP practices that I believe to be right, i.e. functions go in functions.php file, nearly everything in functions.php should be wrapped in a function, page templates can have straight up PHP in them, etc.

But I’m a little shaky on the ‘why’. What is it about the page templates vs the functions file that changes what works and doesn’t work in each? I’m assuming it’s the loading order but any more advanced guidance / direction would be appreciated.

Read more here:: PHP code in page template vs functions

Leave a Reply

Your email address will not be published. Required fields are marked *