<?php endwhile;
}
+function is_tree( $pid ) {
+ global $post;
+ if ( is_page($pid) )
+ return true;
+
+ $anc = get_post_ancestors( $post->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);
<form method="post">
<div class="row resDropdown">
<div class="small-12 res-search columns resInput">
+ <?php
+ global $post;
+ $properties = array(
+ 187 => "Stafford's Bay View Inn",
+ 188 => "Stafford's Crooked River Lodge",
+ 189 => "Stafford's Perry Hotel"
+ ); ?>
+ <?php $ancestorProperty = setReservationWidgetProperty( $post->ID, $properties ); ?>
<select id="propertyName" name="s">
<option value="" selected disabled>Property</option>
- <option value="Stafford's Bay View Inn">Bay View Inn</option>
- <option value="Stafford's Crooked River Lodge">Crooked River Lodge</option>
- <option value="Stafford's Perry Hotel">Perry Hotel</option>
+ <?php foreach($properties as $id=>$property){
+ $short_name = str_replace("Stafford's", "", $property);
+ if( $ancestorProperty == $property){ ?>
+ <option value="<?php echo $property; ?>" selected><?php echo $short_name; ?></option>
+ <?php } else { ?>
+ <option value="<?php echo $property ;?>"><?php echo $short_name; ?></option>
+ <?php } ?>
+ <?php } ?>
+ <!-- <option value="Stafford's Bay View Inn" >Bay View Inn</option>
+ <option value="Stafford's Crooked River Lodge" >Crooked River Lodge</option>
+ <option value="Stafford's Perry Hotel" >Perry Hotel</option> -->
+
</select>
</div>
<div class="small-12 res-date columns resInput">