From d67dd77ec1e79d8284dd8cfc70e4595a07c08dc1 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Mon, 13 Aug 2018 15:29:28 -0400 Subject: [PATCH] automatically setting the reservation widget to the correct property when landing on that page --- functions.php | 23 +++++++++++++++++++++++ parts/reservation-form-main.php | 23 ++++++++++++++++++++--- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/functions.php b/functions.php index 16199db..2016f2d 100644 --- a/functions.php +++ b/functions.php @@ -137,7 +137,30 @@ function mytheme_search_loop() { ID ); + foreach ( $anc as $ancestor ) { + if( is_page() && $ancestor == $pid ) { + return true; + } + } + return false; +} +function setReservationWidgetProperty($page_id, $props_array){ + $post = get_post($page_id); + $property_name = ''; + foreach($props_array as $id=>$property){ + if( is_page($id) || $id == $post->post_parent || is_tree($id) ){ + $property_name = $property; + } + } + return $property_name; +} add_action('thematic_searchloop', 'mytheme_search_loop'); // End of the Contextual/Highlight Search functions add_image_size('glm_blocks', '257', '257', true); diff --git a/parts/reservation-form-main.php b/parts/reservation-form-main.php index 9cefd48..0ca5709 100644 --- a/parts/reservation-form-main.php +++ b/parts/reservation-form-main.php @@ -4,11 +4,28 @@
-- 2.17.1