require happens out of order

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

Use a select box to change a php variable

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

How to insert current user ID in a shortcode?

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

Pulling a variable into the wp_nav_menu function

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

Undefined variable & issue with smof_data

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)