Can’t access a variable defined in another template despite using GLOBAL
Can’t access a variable defined in another template despite using GLOBAL
Can’t access a variable defined in another template despite using GLOBAL
Must be something with your setup. Following works for me (inside child theme – should work for any theme though): single.php: global $post; $bla = $post->post_title; error_log(‘post title is: ‘ . $bla); include(‘included.php’); included.php: error_log(‘i am included file: ‘ . $bla); Output in debug.log: post title is: Hello test i am included file: Hello test … Read more
You shouldn’t need to change anything in the database. If you’ve set up your child theme correctly, and it appears in the list of installed themes, activating that child theme, should make any updates necessary. The customizations you made back in the day should go in the child functions.php and child style.css. As long as … Read more
Where can I find the declaration of `$_wp_theme_features`?
To store the user defined value into the DB you can use the update_user_meta() function. And retrieve back the info with get_user_meta(). You could update the the user meta key with an AJAX call on your select change or put your select in a form and update on form submit either with $_GET or $_POST … Read more
Simple solution- use GLOBAL variables.. $GLOBALS[‘my_categories_list’] = array(1,2,3,4); then you can everywhere access $GLOBALS[‘my_categories_list’].
You didn’t say how you were going to implement the code: If you are using page templates or custom post pages, you could do this: <?php $user_id = get_current_user_id(); if ($user_id == 0) { echo ‘You are currently not logged in.’; } else { echo do_shortcode(‘[pods-form name=”user” id=”‘.$user_id.'” fields=”my_field, my_field_2, my_field_3″]’); } ?> are you … Read more
I think your scope is not the same. You are defining the $menu_name in one scope and calling it in another scope. So you can do it with global variable like below- $GLOBALS[ ‘menu_name’ ] = ‘Section 1 Menu’; And call it like- <div id=”nav”> <div class=”close-menu”></div> <?php wp_nav_menu( array( ‘menu’ => $GLOBALS[ ‘menu_name’ ], … Read more
Changed the query and with the direction kaiser gave I got it working. $area = $_GET[‘area’]; $persons = $_GET[‘persons’]; $query = new WP_Query( array( ‘tag’ => “$area+$persons” ) );
The variable $alignment is only being set conditionally by the following lines: if ( metadata_exists( ‘post’, $post_id, ‘pyre_page_title_text_alignment’ ) && get_post_meta( get_queried_object_id(), ‘pyre_page_title_text_alignment’, TRUE ) != ‘default’ ) { $alignment = get_post_meta( $post_id, ‘pyre_page_title_text_alignment’, TRUE ); } elseif ( $smof_data[‘page_title_alignment’] ) { $alignment = $smof_data[‘page_title_alignment’]; } If neither the if() nor the elseif() conditions are … Read more