You need to globalize it before you set the value, so in your header.php
global $myBool;
$myBool = false;
and then in your page.php
global $myBool;
echo $myBool;
just make sure you page.php includes the header.php file either directly or by calling get_header();
Related Posts:
- How to add elements to an empty array in PHP?
- Where to get information about array fields in $_REQUEST?
- Pass a PHP variable to another file
- How to store the_title() into a variable to reutrn the value, not just echo it
- How do I make my function add variables/values to the $post object?
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- where to include a php file
- How do I know what variables are passed in a filter/action and what their meaning is?
- When would you use $_post instead of $post?
- Locating Global Variables
- Pass PHP variable to JavaScript without inline JS
- Count the number of times the search form template gets included on a page
- Putting PHP variables into javascript [duplicate]
- Variable global scope [closed]
- How to rewrite URL with PHP variables with htaccess to a normal looking URL?
- Using a variable in is_page(array())
- Static variable and add_rewrite_rule?
- How to put a variable in a instance in the widget
- Call global variable array() in woocommerce child/template
- get_term_link() returns correct – But illogical error-messages disturb
- How can I Add a variable PHP in the Menu Nav
- Pass variable from one function to another
- Get value from shortcode to do something
- PHP, Creating a dynamic variable
- How to modify a global variable in a function and use it on another function?
- Variable not staying set
- WordPress function and string as variable?
- Create a WordPress shortcode using PHP [duplicate]
- How to pass a PHP $_GET variable and fetch/output it?
- Creating WordPress Shortcode with Variable
- How to put a form with php code into a variable or shortcode?
- Apply class to every third list item? [duplicate]
- persist a variable set in header.php all the way down to footer.php
- Get access to variable from previous pageview, excluding ajax-calls
- How to deal with too many $_POST variable conditions from ajax request at backend? [closed]
- What is the alternative code to if (isset ($_POST) && !empty ($_POST) to avoid warnings?
- How to pass a variable to get_template_part that’s updated every time the template part is called?
- Insert page content into another page with a changed variable
- Pass Variables or Variable Place-Holder from Editor to PHP
- How to access or parse key/values that have “string”
- How Do I Find & Remove H1 From Site-Title-Wrapper? [closed]
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- javascript variable to wordpress php variable
- How to reference PHP in Javascript
- Store and Change Session variable – PHP SESSION VARIABLE
- Overide Variable in Child Theme
- echo var into wp_query
- how can I include some custom variable from functions.php?
- Dynamically adding filters
- PHP variables in a post?
- WordPress is removing query variables like page, p from the URL of a custom static page
- How to send a php var to jQuery Ajax call with two different file
- Unable to display multiple parameters from url by javascript through shortcodes
- How to check a variable Changes
- global $product is empty string when passed into function
- Can’t pass var from php wp_ajax into ajax script : result undefined or null
- Custom global variable not working in function
- WordPress How do I pass a variable from one add_action to another?
- Best way to use variables in multiple functions?
- Trying to add some custom text into WordPress Post title via function.php
- Reduce Stock Based on Custom Variation Field Rather than Attribute (Working Script)
- How do I fix Undefined variable using $_POST in function?
- How to change the value of a variable using input field?
- How to find php variable of wordpress theme settings
- Add class to all meta boxes for a custom post type
- Passing parameter from the current URL to redirect to another url
- Undefined variable & issue with smof_data
- Pulling a variable into the wp_nav_menu function
- Where can I find the declaration of `$_wp_theme_features`?
- Child theme functions.php file change database entries
- Custom Taxonomy Link Text Echo Name Not Slug
- how to add number value in front for variable [closed]
- Create and update Custom Cookie based on multiple GET and POST Values for first time visitors?
- Difference in Get Variable Location
- If I define a variable in header.php, how do I make it available to templates?
- Shortcode not passing variable to included file
- ACF allow zero as a value
- Can’t get options with $data[‘variable’]
- PHP Use Declared array Variable inside already Declared Array
- Import and use a variable in additional settings of Contact Form 7 [closed]
- Use ajax response in PHP function
- WP query with variables gives no result for specific user
- How can one use variables in a template or template part without polluting the global scope?
- How to Add Image to WordPress RSS-Feed with no Plug-in?
- How to execute a simple php script in WP (I don’t think wp_enque_script applies here)
- Delete a WordPress transient from a shortcode on Page/Post update
- Is sanitize_title_with_dashes formatting function too liberal (in terms of accepted characters)?
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- Warning: in_array() null given in PHP function
- Environment to do updates to legacy (4.7) version of WP while staying on php 5.6?
- WordPress add custom search
- Infinite loop when logging out using custom login form
- add custom metabox to media library custom widget
- add_action in wp_head accessible from class
- Let user select the number of posts shown per page jquery error
- Can’t make product images clickable
- wordpress ajax return 0
- Admin bar nodes
- What is the wrong with this function to enqueue the scripts and styles to the theme? [closed]
- ‘This Field is Required.’ is Not Displaying on CF7 [closed]