Situation:
Is header.php file where is code: if(is_single()){ global $my_global_var; $my_global_var == true; }
Is functions.php file where is code: global $my_global_var; if($my_global_var == true) { echo "OK"; }
But this is not working, what im doing wrong?
In sidebar all is fine.
Fixed 0.2: Must be:
add_filter('the_content','simple_img_tag_search');
function simple_img_tag_search($content){
if(is_single()){
$MYCODE = "<div>My code</div>";
$paragraphs = explode( '</h2>', $content, 2 );
$first_paragraph = $paragraphs[0];
return str_replace($first_paragraph.'</h2>',$first_paragraph.'</h2>'.$MYCODE,$content);
}}
functions.php
is loaded beforeheader.php
. By the time your header file sets it's variable, functions.php has already been executed. You need to post your code -- including what you're trying to accomplish -- to get any more help that that. :)