Passing variables from functions.php to sidebar.php
I have defined some variables not directly in functions.php but there is a
file which is included into functions php with variables:
setup.php:
$background = 'red';
$font = 'something';
$foo = 'bar';
functions.php:
include('setup.php');
index.php:
get_header();
get_sidebar();
get_footer();
sidebar.php:
var_dump($foo); // returns 'null'
Why are these variables not accessible in sidebar.php? If I try in
index.php it works fine. In header.php they work as well
No comments:
Post a Comment