0

I decided to create my own wordpress theme. Before i begin i wanted to know how Wordpress interprets PHP code. For example:

1) On functions.php, some themes start with wordpress features, some start with styles and scripts, some start to define folder patchs etc...

Is there any standard on how to list on the right way? How does WordPress understand it, does they load all code first and then they list it based on function priority number?

Any suggestion?

1
  • WordPress is written in PHP, it doesn't interpret it.
    – fuxia
    Commented Dec 5, 2016 at 16:50

1 Answer 1

2

functions.php file of a theme gets includeed by WP as any PHP file, there is no special processing or anything.

So the code in the file just runs and what happens happens.

It is considered proper practice in WP that any code that doesn't need to run immediately on boot should be instead hooked to appropriate point in load. Typically that is init (where core/plugins/themes load is considered mostly complete) and later hooks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.