Hello, i've been setting up a WordPress site for the first time and things've been pretty smooth so far, but now i'm stuck. I've found a few things on-line regarding this subject, but i guess it hasn't helped, 'cause i can't seem to get it.
What i'm trying to do is get the side bar or header to use a variable declared at the beginning of the page (say index.php) that calls it. In other words, something like:
<?php $myVariable = "something"; get_header(); ?>
(and then obviously there is something in header.php that needs to use that variable)
I understand that it isn't going to be as simple as what i wrote above because of the scope of the variable and all that stuff. I've been trying to use hooks or actions or whatever, but i still can't get it. I can put <?php wp_head(); ?> in my header.php and then put some html inside a function and use add_action() to add that to wp_head()... and that works fine. The HTML gets displayed in the header. But i can not get it to just set a variable. It stays empty.
Does anyone know how i could do this? Thanks!