/** * Changes the context for a sidebar * * return void */ function change_sidebar_context() { global $post, $wp_query, $dr_orig_wp_query, $dr_query_modified; $dr_orig_wp_query = $wp_query; // Get relationship field, if exists while (has_sub_field('relationship', 'option')) { if (get_sub_field('post_type') == $post->post_type) { $post = get_sub_field('detail_page'); query_posts(array('p' => $post->ID)); pw_filter_widgets(get_option('sidebars_widgets')); $dr_query_modified = true; } } }
<?php /** * Template Name: Navigation */ // Get Post Data $original_query = $wp_query; wp_reset_postdata(); // Get the navigation page id $nav_page = get_field('navigation_page', 'option'); // Get query posts query_posts(array('p' => $nav_page->ID)); $post = $nav_page; pw_filter_widgets(get_option('sidebars_widgets')); // Get container content $header = get_field('container_information', $post->detail_id); ?> <!-- Mobile Navigation --> <section id="main_mobile_navigation" class="show_on_mobile"> <section class="mobile_container"> <section class="search_area"><?php get_search_form(true); ?> </section> <div class="clear"></div> <section class="menu_section"> <header><?php echo $header[0]['title']; ?> </header> <a href="<?php