php - Writing a good Wordpress template -


I was asked to write a custom template for a WordPress based site, and I see that the theme is usually a The big unreadable PHP code is mixed with HTML, with a horrible indentation above it - even the default template also follows this type.

Now what I am doing, I've put all the PHP code first, then markup is at least PHP only for control structures and variables - what kind of controller do you have & lt; -> System will see, only one file.

What is a good way for people to write templates while keeping logic code separate from markup? This is a nominal high traffic location, so I want to keep the unnecessary overhead minimal.

Try to get the default template and instead of using it to use.

I agree that Wordpress does not have MVC, but you do not need to mix a lot of logic in your templates just use it accordingly and you will not have too much spaghetti code May be really light subjects.

When you know that you are mixing too much logic with the presentation in your template files, move the logic into a function, go to the function. Create Php or a plugin, which you can call from your template and go ahead.

Not strictly OO or MVC, but it is worth the handle.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -