I would like to add some custom config variables in the wp-config.php
file (not in the functions.php
). Then, I need to access to these variables in my templates.
What is the way to do that ?
I would like to add some custom config variables in the wp-config.php
file (not in the functions.php
). Then, I need to access to these variables in my templates.
What is the way to do that ?
1 Answer
Reset to default 16Why do you need this?
In wp-config you can set defines. They will be accesible everywhere without needing to use globals. Define something: define('MY_DEFINE_NAME', 'THE_VALUE');
.
Then in your templates you can show the value like this: echo MY_DEFINE_NAME;
Or set the value to a variable: $var = MY_DEFINE_NAME;
.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744702269a4588842.html
define
– miko7358 Commented Apr 22, 2014 at 9:34