phpwordpressredux-framework

Redux option doensn't seem when include from functions.php


When I wrote 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.

header.php:

<?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.

why?

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.


Solution

  • to get output, you should load it on wp_head because redux framework doesn't work before wp_head.it is a timing issue.

    you should wrap your function and fire it on wp_head.

    function theme_color() {
        include ( get_template_directory() . '/theme-color.php' );
    }
    add_action('wp_head','theme_color');
    

    so it will be loaded