diff --git a/public/travel-packages-shortcode.php b/public/travel-packages-shortcode.php index 04e3e67..62aa780 100644 --- a/public/travel-packages-shortcode.php +++ b/public/travel-packages-shortcode.php @@ -6,10 +6,16 @@ function travel_packages_shortcode($atts) $atts = shortcode_atts( array( 'limit' => -1, + 'redirect' => '', ), $atts ); + $on_search_redirect = isset($atts['redirect']) ? $atts['redirect'] : ''; + // Pass the PHP value inline to the JavaScript file + $inline_script = 'var travelPackagesFilter = { redirectValue: "' . esc_js($on_search_redirect) . '" };'; + wp_add_inline_script('travel-packages-shortcode-script', $inline_script); + // Getting the country names for the country filter drop-down $allPackages = new WP_Query([ 'post_type' => 'travel-package', @@ -174,7 +180,7 @@ function travel_packages_shortcode($atts) ) ); - if ($pagination_links) { + if ($pagination_links && !$on_search_redirect) { echo '
'; echo '