When I write redux framework option into header.php, it is shown.However when I add the same php code into a php file and include the php file from functions.php, it doesn't seem.


<?php global $redux_demo; ?>
<?php echo wp_kses_post( $redux_demo['text-call-header'] );

function.php :

include ( get_template_directory() . '/theme-color.php' );

theme-color.php contains same code above also global redux variable but it doesn't give any output.


as a smiliar second question, also I can't get output from my custom plugin when I include theme-color.php from my custom plugin.

  • 1
    Where in functions.php have you included this file? If it's not inside a hook then I would wager that $redux_demo hasn't been defined yet. Normally you wouldn't echo a value directly from functions.php, so this is not a good way to test whatever you're testing. You should include the file inside a function that runs later. Sep 21, 2021 at 14:57
  • yes, I solved it Sep 21, 2021 at 15:23

1 Answer 1

function theme_color() {
    include ( get_template_directory() . '/theme-color.php' );

so it will be loaded in head

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.