This may have a simple answer but I would like to store all the variables I've declared ( or cached ) across my theme in a central file and serve then this file globally ( Similar to how get_header()
, get_footer()
and get_sidebar()
works ).
I've tried creating a file called variables.php
and serving it via get_template_part
but without success.
For this particular project, it would be more convenient if the multitude of variables I've created across my theme were housed in a central location in lieu of being scattered throughout various theme files.
Is there a idiomatic way of accomplishing this in WordPress?
wp-config.php
being just a place where constant definitions are dumped) so it's up to you (and generic PHP) how to implement it.