Free and Premium WordPress Plugins & Themes Forums WordPress Plugins Hotel Booking Change order of fields in the search form
- This topic has 3 replies, 2 voices, and was last updated 3 years, 4 months ago by Andre Flores.
- AuthorPosts
- July 19, 2021 at 11:41 am #1158392Michael CarrierParticipant
I wanted to see if I could put an attribute before the check-in field on the search form.
July 19, 2021 at 11:15 pm #1158535Andre FloresModeratorHello Mochael,
Yes, it is possible by overriding default [mphb_availability_search] shortcode function. In order to do that copy the search-form.php file from /wp-content/plugins/motopress-hotel-booking/templates/shortcodes/search/ directory to /wp-content/themes/your-child-theme/hotel-booking/shortcodes/search/ directory and place the below code:
<?php do_action( 'mphb_sc_search_form_before_attributes' ); ?> <?php foreach ( $attributes as $attributeName => $terms ) { ?> <p class="<?php echo esc_attr( 'mphb_sc_search-' . $attributeName ); ?>"> <label for="<?php echo esc_attr( 'mphb_' . $attributeName . '-' . $uniqid ); ?>"> <?php echo esc_html( mphb_attribute_title( $attributeName ) ); ?> </label> <br /> <select id="<?php echo esc_attr( 'mphb_' . $attributeName . '-' . $uniqid ); ?>" name="<?php echo esc_attr( 'mphb_attributes[' . $attributeName . ']' ); ?>"> <?php foreach ( $terms as $termId => $termLabel ) { ?> <option value="<?php echo esc_attr( $termId ); ?>"><?php echo esc_html( $termLabel ); ?></option> <?php } ?> </select> </p> <?php } ?>
Above the following code:
<p class="mphb_sc_search-check-in-date"> <label for="<?php echo esc_attr( 'mphb_check_in_date-' . $uniqid ); ?>"> <?php _e( 'Check-in', 'motopress-hotel-booking' ); ?> <abbr title="<?php printf( _x( 'Formatted as %s', 'Date format tip', 'motopress-hotel-booking' ), MPHB()->settings()->dateTime()->getDateFormatJS() ); ?>">*</abbr> </label> <br /> <input id="<?php echo esc_attr( 'mphb_check_in_date-' . $uniqid ); ?>" data-datepick-group="<?php echo esc_attr( $uniqid ); ?>" value="<?php echo esc_attr( $checkInDate ); ?>" placeholder="<?php _e( 'Check-in Date', 'motopress-hotel-booking' ); ?>" required="required" type="text" name="mphb_check_in_date" class="mphb-datepick" autocomplete="off" /> </p>
Make sure to perform changes in file copied to your child theme directory in order to prevent changes from being lost after future theme updates.
Regards,
AndreJuly 20, 2021 at 8:51 am #1158906Michael CarrierParticipantOk, thanks for the solution.
July 21, 2021 at 2:33 am #1159219Andre FloresModeratorYou are most welcome. It would be very much appreciated if you share your positive feedback about the Hotel Booking plugin at: https://www.trustpilot.com/evaluate/www.getmotopress.com.
Thank you in advance!
- AuthorPosts
- You must be logged in to reply to this topic.