Tristan .L Tristan .L - 1 year ago 91
PHP Question

Wordpress childtheme functions.php management

So for most Wordpress users this may sound familiar.

You make an active child-theme and a functions.php. After a while this php file will be filled with many action/filter hooks. Some for Wordpress itself, others for plugins. This makes it (to me) a hot mess. It's hard to keep an overview what's going on without making big blocks of comments.

How can one best approach this? I was considering turning the php into plugins or make separate php files which are included with the functions.php.

What would be the best practice and give the best performance?

Answer Source

make an inc directory within your WordPress child theme's root and add categorized function files within that. Then include them in your functions.php file:

- js
- css
- inc
- ...