I'm currently working with the Redux Framework to allow users of my theme to add additional CSS and JS code to their theme's header and footer, respectively. Redux stores this code in a global variable, so it's easy to access.

However, this means I must call the global variable in the header.php or footer.php file and then echo the code from Redux there. This doesn't seem ideal. I was wondering if there is any way to enqueue these blocks of code in the function.php file rather than trying to code it directly into the template files.

For example:

    margin: 0 auto;

Is typed into my CSS box inside of Redux. I can then access it in header.php with something like:

global $redux_global;
echo $redux_global['css-block'];

...and it'll spit out the above CSS. That's all well and good, but if I do this its not properly enqueued. Per my understanding I can only use a URL with wp_enqueue_style and wp_enqueue_script so I'm at a loss.

Thank you for your help!

1 Answer 1


Lead dev of Redux here.

If you declare global $redux_global in your header.php file, it will be accessible by all other template files within your theme.

You can also use $GLOBALS['redux_global']['css-block'] to bypass the need for $global $redux_global.

  • Thanks Dovy! I ended up doing it this way: docs.reduxframework.com/redux-framework/advanced/… so that I could just enqueue a style-custom.css file. It seems to be working well for me so far, though I still need to learn some of the nuances associated with this approach. Cheers! Apr 16, 2014 at 17:14

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.