I had been requested to create a custom template for any wordpress based site, and I am realizing that styles are often one large unreadable mess of PHP code combined with HTML, having a terrible indenting on the top from it -- the default template follows this style.

What I am doing now's invest the PHP code first, then your markup with minimum PHP only for control structures and variables -- type of what you'd do inside a controller <-> view system, only within the same file.

What's a good idea people use to create templates and keep logic code outside of markup? It is a moderately high traffic site, so Let me keep unnecessary overhead low.

Use a Wordpress Theme Framework rather than obtaining the default template and adapting it.

To be sure Wordpress is not MVC, but you don't have to combine lots of logic inside your templates. Only use Template Tags accordingly and you will have really light styles without an excessive amount of spaghetti code.

When it becomes clear that you are mixing an excessive amount of logic with presentation inside your template files, encapsulate your logic right into a function, move it to functions.php or produce a wordpress plugin that you could call out of your template and move ahead.

Not strictly OO or MVC, but it is maintainable.

Its just a little complicated to get this done without core edits to Wordpress itself. Previously I have used a category that behaved like a controller which i would store all my php code. This causes it to be just a little better to separate your PHP code from those of the vista. The issue with this particular approach is the fact that the scripts which have its very own class. An alternative choice (more procedural) is always to come with an actual file (I.E. footer.corporation.php) that might be incorporated towards the top of the file and would then provide you with all your variables.