For some reason, you don’t want to use our booking system but still use the search form. So you want to redirect to another website when clicking the Check Availability button.
I’ll guide you on how to custom this:
Setup Child theme
Hotel WP provides a child theme after you import demo data. Install Hotel WP Child in Dashboard > Hotel WP > Child Themes.
Why a Child Theme? Using a child theme is crucial for safe customization. It inherits the appearance and functions of the parent (Hotel Booking) theme but allows you to make changes without directly editing the plugin’s original files. This way, your modifications won’t be overwritten when the plugin is updated.
Deploy In the Child theme
In Hotel WP child theme:
Copy the search.php
File:
- Locate the original
search.php
file within the Hotel Booking plugin’s directory (usually inwp-content/plugins/hotel-wp/templates
). - Make a copy of this file and place it inside the
search
folder you just created in your child theme. The path should look like this:wp-content/themes/your-child-theme-name/wp-hotel-booking/search/search.php
Edit the search.php
File:
- Open the copied
search.php
file in a text editor. - Find line 56 (or line 67 if you’re using Hotel Booking version 1.9.7.x).
- Replace this line: <button type=”submit”><?php esc_html_e( ‘Check Availability’, ‘hotel-wp’ ); ?></button>
- With this line: <a target=”_blank” href=”link-website”><?php esc_html_e(‘Check Availability’, ‘hotel-wp’); ?></a>
Make sure to replace link-website
with the actual URL you want the “Check Availability” link to direct users to and Save your changes.
Deploy In Plugin Hotel Shortcodes
Locate the file:
- Go to your WordPress website’s plugin directory. You can find it by navigating to
/wp-content/plugins/
. - Look for the “thim-hotel-wp-shortcodes” folder.
- Inside this folder, go to
hb-rooms-search/tpl/
. - Open the file named
default.php
.
Find and edit line 179:
- Around line 179, you’ll see this code: $html .= ‘<button type=”submit”>’ . esc_html__( ‘Check Availability’, ‘hotel-wp’ ) . ‘</button>’;
- Replace that entire line with this modified code: $html .= ‘<button><a target=”_blank” href=”your-link-here”>’ . esc_html__( ‘Check Availability’, ‘hotel-wp’ ) . ‘</a></button>’;
Be sure to replace “your-link-here” with the actual web address you want the button to link to and Save the default.php
file.
Now your site will redirect to another website when click the Check Availability button.
Learn More from ThimPress Knowledge Base Articles:
- Translate Rooms in Multilingual with WPML
- LearnPress Translation Using The Loco Translate Plugin
- LearnPress: List of Some Issues and Best Ways to Fix Them
- Schedule Your Auto Posting Pipes with Cron Job
- WP Pipes System Requirements
- How to Use Custom CSS in Your Online Course
- Create a Child Theme in Resca: A Step-by-Step Guide
- One-Click Resca Theme Installation Guide (Video)
- Step-by-Step Video Tutorial: Installing Resca Theme
- Create A Child Theme in Squareroot: Step-by-step Guide
Contact US | ThimPress:
Website: https://thimpress.com/
Fanpage: https://www.facebook.com/ThimPress
YouTube: https://www.youtube.com/c/ThimPressDesign
Twitter (X): https://twitter.com/thimpress