Hello to everyone hope to find all well, I am new to this so please forgive in case anything of the following sounds silly, but would really appreciate any tips and feedback. What I am trying is to extract an i-frame code from the " $tour_option['form-custom-code'] " in the "custom form" option of tourmaster booking bar CPT combo field "tourmaster-tour-option". Below is the field php:
echo '<div class="tourmaster-template-wrapper" >';
// tourmaster booking bar
if( !post_password_required() && $tour_option['form-settings'] != 'none' ){
echo '<div class="tourmaster-tour-booking-bar-container tourmaster-container" >';
echo '<div class="tourmaster-tour-booking-bar-container-inner" >';
echo '<div class="tourmaster-tour-booking-bar-anchor tourmaster-item-mglr" ></div>';
echo '<div class="tourmaster-tour-booking-bar-wrap tourmaster-item-mglr" id="tourmaster-tour-booking-bar-wrap" >';
echo '<div class="tourmaster-tour-booking-bar-outer" >';
echo $header_price;
echo '<div class="tourmaster-tour-booking-bar-inner" >';
if( $tour_option['form-settings'] == 'both' ){
echo '<div class="tourmaster-booking-tab-title clearfix" id="tourmaster-booking-tab-title" >';
echo '<div class="tourmaster-booking-tab-title-item tourmaster-active" data-tourmaster-tab="booking" >' . esc_html__('Booking Form', 'tourmaster') . '</div>';
echo '<div class="tourmaster-booking-tab-title-item" data-tourmaster-tab="enquiry" >' . esc_html__('Enquiry Form', 'tourmaster') . '</div>';
echo '</div>';
}
// custom form
if( $tour_option['form-settings'] == 'custom' && !empty($tour_option['form-custom-code']) ){
echo '<div class="tourmaster-tour-booking-custom-code-wrap" >';
echo tourmaster_text_filter($tour_option['form-custom-code']);
echo '</div>';
}
// enquiry form
if( $tour_option['form-settings'] == 'enquiry' || $tour_option['form-settings'] == 'both' ){
echo ($tour_option['form-settings'] == 'both')? '<div class="tourmaster-booking-tab-content" data-tourmaster-tab="enquiry" >': '';
echo '<div class="tourmaster-tour-booking-enquiry-wrap" >';
echo tourmaster_get_enquiry_form(get_the_ID());
echo '</div>';
echo ($tour_option['form-settings'] == 'both')? '</div>': '';
}
// booking form
if( $tour_option['form-settings'] == 'booking' || $tour_option['form-settings'] == 'both' ){
echo ($tour_option['form-settings'] == 'both')? '<div class="tourmaster-booking-tab-content tourmaster-active" data-tourmaster-tab="booking" >': '';
// external url ( referer )
if( !empty($tour_option['link-proceed-booking-to-external-url']) ){
echo '<div class="tourmaster-single-tour-booking-referral" >';
if( !empty($tour_option['external-url-text']) ){
echo '<div class="tourmaster-single-tour-booking-referral-text" >';
echo tourmaster_content_filter($tour_option['external-url-text']);
echo '</div>';
}
echo '<a class="tourmaster-button" href="' . esc_html($tour_option['link-proceed-booking-to-external-url']) . '" target="_blank" >' . esc_html__('Proceed Booking', 'tourmaster') . '</a>';
echo '</div>';
// normal form
}else{
$update_header_price = tourmaster_get_option('general', 'update-header-price', 'enable');
$form_class = ($update_header_price == 'enable')? 'tourmaster-update-header-price': '';
echo '<form class="tourmaster-single-tour-booking-fields ' . esc_attr($form_class) . ' tourmaster-form-field tourmaster-with-border" method="post" ';
echo 'action="' . esc_url(tourmaster_get_template_url('payment')) . '" ';
echo 'id="tourmaster-single-tour-booking-fields" data-ajax-url="' . esc_url(TOURMASTER_AJAX_URL) . '" >';
echo '<input type="hidden" name="tour-id" value="' . esc_attr(get_the_ID()) . '" />';
$available_date = get_post_meta(get_the_ID(), 'tourmaster-tour-date-avail', true);
if( !empty($available_date) ){
$available_date = explode(',', $available_date);
echo '<div class="tourmaster-tour-booking-date clearfix" data-step="1" >';
echo '<i class="fa fa-calendar" ></i>';
echo '<div class="tourmaster-tour-booking-date-input" >';
$selected_date = $available_date[0];
if( !empty($temp_data['tour-date']) ){
$selected_date = $temp_data['tour-date'];
unset($temp_data['tour-date']);
}
if( sizeof($available_date) == 1 ){
echo '<div class="tourmaster-tour-booking-date-display" >' . tourmaster_date_format($selected_date) . '</div>';
echo '<input type="hidden" name="tour-date" value="' . esc_attr($selected_date) . '" />';
}else{
$date_selection_type = empty($tour_option['date-selection-type'])? 'calendar': $tour_option['date-selection-type'];
if( $date_selection_type == 'calendar' ){
echo '<div class="tourmaster-datepicker-wrap" >';
echo '<input type="text" class="tourmaster-datepicker" readonly ';
echo 'value="' . esc_attr($selected_date) . '" ';
echo 'data-date-format="' . esc_attr(tourmaster_get_option('general', 'datepicker-date-format', 'd M yy')) . '" ';
echo 'data-tour-range="' . (empty($tour_option['multiple-duration'])? 1: intval($tour_option['multiple-duration'])) . '" ';
echo 'data-tour-date="' . esc_attr(json_encode($available_date)) . '" />';
echo '<input type="hidden" name="tour-date" class="tourmaster-datepicker-alt" />';
echo '</div>';
}else if( $date_selection_type == 'date-list'){
echo '<div class="tourmaster-combobox-wrap tourmaster-tour-date-combobox" >';
echo '<select name="tour-date" >';
foreach( $available_date as $available_date_single ){
echo '<option value="' . esc_attr($available_date_single) . '" ' . ($selected_date == $available_date_single? 'selected': '') . ' >';
echo tourmaster_date_format($available_date_single);
echo '</option>';
}
echo '</select>';
echo '</div>';
}
}
echo '</div>';
echo '</div>'; // tourmaster-tour-booking-date
$booking_value = array();
if( !empty($temp_data) ){
$booking_value = array(
'tour-people' => empty($temp_data['tour-people'])? '': $temp_data['tour-people'],
'tour-room' => empty($temp_data['tour-room'])? '': $temp_data['tour-room'],
'tour-adult' => empty($temp_data['tour-adult'])? '': $temp_data['tour-adult'],
'tour-children' => empty($temp_data['tour-children'])? '': $temp_data['tour-children'],
'tour-student' => empty($temp_data['tour-student'])? '': $temp_data['tour-student'],
'tour-infant' => empty($temp_data['tour-infant'])? '': $temp_data['tour-infant'],
'package' => empty($temp_data['package'])? '': $temp_data['package'],
);
unset($temp_data['tour-people']);
unset($temp_data['tour-room']);
unset($temp_data['tour-adult']);
unset($temp_data['tour-children']);
unset($temp_data['tour-student']);
unset($temp_data['tour-infant']);
unset($temp_data['tour-infant']);
unset($temp_data['package']);
}else{
$date_price = tourmaster_get_tour_date_price($tour_option, get_the_ID(), $selected_date);
if( !empty($date_price['package']) ){
foreach( $date_price['package'] as $package ){
if( !empty($package['default-package']) && $package['default-package'] == 'enable' ){
$booking_value['package'] = $package['title'];
break;
}
}
}
}
echo tourmaster_get_tour_booking_fields(array(
'tour-id' => get_the_ID(),
'tour-date' => $selected_date,
'step' => 1
), $booking_value);
}else{
echo '<div class="tourmaster-tour-booking-bar-error" data-step="999" >';
echo apply_filters('tourmaster_tour_not_available_text', esc_html__('The tour is not available yet.', 'tourmaster'));
echo '</div>';
}
// carry over data
if( !empty($temp_data) ){
foreach( $temp_data as $field_name => $field_value ){
if( is_array($field_value) ){
foreach( $field_value as $field_single_value ){
echo '<input type="hidden" name="' . esc_attr($field_name) . '[]" value="' . esc_attr($field_single_value) . '" />';
}
}else{
echo '<input type="hidden" name="' . esc_attr($field_name) . '" value="' . esc_attr($field_value) . '" />';
}
}
}
echo '</form>'; // tourmaster-tour-booking-fields
} // normal form
// if not logging in print the login before proceed form
if( !is_user_logged_in() ){
$guest_booking = tourmaster_get_option('general', 'enable-guest-booking', 'enable');
$guest_booking = ($guest_booking == 'enable')? true: false;
echo tourmaster_lightbox_content(array(
'id' => 'proceed-without-login',
'title' => esc_html__('Proceed Booking', 'tourmaster'),
'content' => tourmaster_get_login_form2(false, array(
'continue-as-guest'=>$guest_booking,
'redirect'=>'payment'
))
));
}
echo ($tour_option['form-settings'] == 'both')? '</div>': '';
} // booking form
// bottom bar for wish list and view count
echo '<div class="tourmaster-booking-bottom clearfix" >';
// wishlist section
$logged_in = is_user_logged_in();
if( !$logged_in ){
echo '<div class="tourmaster-save-wish-list" data-tmlb="wish-list-login" >';
}else{
$wish_list = get_user_meta($current_user->ID, 'tourmaster-wish-list', true);
$wish_list = empty($wish_list)? array(): $wish_list;
$wish_list_active = in_array(get_the_ID(), $wish_list);
if( !$wish_list_active ){
echo '<div class="tourmaster-save-wish-list" ';
echo 'id="tourmaster-save-wish-list" ';
echo 'data-ajax-url="' . esc_url(TOURMASTER_AJAX_URL) . '" ';
echo 'data-tour-id="' . esc_attr(get_the_ID()) . '" ';
echo '>';
}else{
echo '<div class="tourmaster-save-wish-list tourmaster-active" >';
}
}
echo '<span class="tourmaster-save-wish-list-icon-wrap" >';
echo '<i class="tourmaster-icon-active fa fa-heart" ></i>';
echo '<i class="tourmaster-icon-inactive fa fa-heart-o" ></i>';
echo '</span>';
echo esc_html__('Save To Wish List', 'tourmaster');
echo '</div>'; // tourmaster-save-wish-list
if( !$logged_in ){
echo tourmaster_lightbox_content(array(
'id' => 'wish-list-login',
'title' => esc_html__('Adding item to wishlist requires an account', 'tourmaster'),
'content' => tourmaster_get_login_form2(false)
));
}
echo '<div class="tourmaster-view-count" >';
echo '<i class="fa fa-eye" ></i>';
echo '<span class="tourmaster-view-count-text" >' . $view_count . '</span>';
echo '</div>'; // tourmaster-view-count
echo '</div>'; // tourmaster-booking-bottom
echo '</div>'; // tourmaster-tour-booking-bar-inner
echo '</div>'; // tourmaster-tour-booking-bar-outer
// sidebar widget
if( !empty($tour_option['sidebar-widget']) && $tour_option['sidebar-widget'] != 'none' ){
$sidebar_class = apply_filters('gdlr_core_sidebar_class', '');
$mobile_widget = tourmaster_get_option('general', 'enable-single-sidebar-widget-on-mobile', 'enable');
if( $mobile_widget == 'disable' ){
$sidebar_class .= ' tourmaster-hide-on-mobile';
}
echo '<div class="tourmaster-tour-booking-bar-widget ' . esc_attr($sidebar_class) . '" >';
if( $tour_option['sidebar-widget'] == 'default' ){
$sidebar_name = tourmaster_get_option('general', 'single-tour-default-sidebar', 'none');
if( $sidebar_name != 'none' && is_active_sidebar($sidebar_name) ){
dynamic_sidebar($sidebar_name);
}
}else{
if( is_active_sidebar($tour_option['sidebar-widget']) ){
dynamic_sidebar($tour_option['sidebar-widget']);
}
}
echo '</div>';
}
echo '</div>'; // tourmaster-tour-booking-bar-wrap
echo '</div>'; // tourmaster-tour-booking-bar-container-inner
echo '</div>'; // tourmaster-tour-booking-bar-container
}
Been trying the following with no luck as the result displays the iframe code and the rest of unwanted data; Wp all import print screen