Exemplo n.º 1
0
 /**
  * Returns field configs for tour search form.
  *
  * @param  boolean $only_allowed_in_settings if set to true only fields allwed in Tours > Search Form > Additional Fields option.
  * @param  boolean $clear_empty_values
  * @return array
  */
 public static function get_search_form_fields_html($only_allowed_in_settings = true, $clear_empty_values = false)
 {
     $result = array();
     $form_taxonomies = self::get_search_form_fields($only_allowed_in_settings);
     if (!$form_taxonomies) {
         return $result;
     }
     $tour_tax_request = isset($_REQUEST['tourtax']) ? $_REQUEST['tourtax'] : array();
     foreach ($form_taxonomies as $name => $list) {
         if ('__tour_categories_filter' === $name) {
             if (!adventure_tours_check('tour_category_taxonomy_exists')) {
                 continue;
             }
             $current_term_id = !empty($_REQUEST['tour_category']) ? $_REQUEST['tour_category'] : '';
             /*
             				// For WP < 4.3
             				$current_term_id = 0;
             				$tour_cat_slug = ! empty( $_REQUEST['tour_category'] ) ? $_REQUEST['tour_category'] : '';
             				if ( $tour_cat_slug ) {
             					$cur_cat_term = get_term_by( 'slug', $tour_cat_slug, 'tour_category' );
             					if ( $cur_cat_term ) {
             						$current_term_id = $cur_cat_term->term_id;
             					}
             				}*/
             $use_parent_cat_name_as_title = true;
             $parent_term_id = adventure_tours_get_option('tours_search_form_start_category');
             $show_all_title = esc_html__('Category', 'adventure-tours');
             if ($use_parent_cat_name_as_title && $parent_term_id) {
                 $parent_term_obj = get_term($parent_term_id, 'tour_category');
                 if ($parent_term_obj) {
                     $show_all_title = $parent_term_obj->name;
                 }
             }
             $drop_down_html = wp_dropdown_categories(array('show_option_all' => $clear_empty_values ? ' ' : $show_all_title, 'hide_if_empty' => true, 'taxonomy' => 'tour_category', 'hierarchical' => true, 'echo' => false, 'name' => 'tour_category', 'value_field' => 'slug', 'hide_if_empty' => true, 'class' => 'selectpicker', 'show_count' => true, 'selected' => $current_term_id, 'child_of' => $parent_term_id));
             if ($drop_down_html) {
                 // to replace value='0' with value='' - as options with empty string value are hidhlighted with placeholder color only
                 $drop_down_html = preg_replace('`(\\s+value=(?:\\"|\'))0(\\"|\')`', '$1$2', $drop_down_html);
                 $icon_class = $parent_term_id ? AtTourHelper::get_tour_category_icon_class($parent_term_id) : '';
                 $result[] = array('icon' => $icon_class ? $icon_class : 'td-network', 'html' => $drop_down_html, 'label' => $show_all_title);
             }
         } else {
             $selected_value = isset($tour_tax_request[$name]) ? $tour_tax_request[$name] : '';
             $attribute_title = wc_attribute_label($name);
             $list_options = array();
             foreach ($list as $value => $title) {
                 /*if ( $is_show_label ) {
                 			if ( $attribute_title == $title ) {
                 				continue;
                 			}
                 		}*/
                 if ($clear_empty_values && !$value) {
                     $title = ' ';
                 }
                 $list_options[] = sprintf('<option value="%s"%s>%s</option>', esc_attr($value), $selected_value == $value ? ' selected="selected"' : '', esc_html($title));
             }
             $result[] = array('icon' => AtTourHelper::get_product_attribute_icon_class($name), 'html' => '<select name="tourtax[' . esc_attr($name) . ']" class="selectpicker">' . join('', $list_options) . '</select>', 'label' => $attribute_title);
         }
     }
     return $result;
 }
Exemplo n.º 2
0
if ($title || $sub_title) {
    echo do_shortcode('[title text="' . addslashes($title) . '" subtitle="' . addslashes($sub_title) . '" size="big" position="center" decoration="on" underline="' . addslashes($title_underline) . '" style="light"]');
}
?>
		<div class="tours-type-icons__slider">
			<div class="tours-type-icons__slider__controls">
				<a class="tours-type-icons__slider__prev" href="#"><i class="fa fa-chevron-left"></i></a>
				<a class="tours-type-icons__slider__next" href="#"><i class="fa fa-chevron-right"></i></a>
			</div>
			<div class="swiper-container swiper-slider">
				<div class="swiper-wrapper">
				<?php 
foreach ($items as $item) {
    ?>
					<?php 
    $icon_class = AtTourHelper::get_tour_category_icon_class($item->term_id);
    $detail_url = get_term_link($item->slug, 'tour_category');
    ?>
					<div class="swiper-slide tours-type-icons__item">
						<a href="<?php 
    echo esc_url($detail_url);
    ?>
" class="tours-type-icons__item__container">
							<span class="tours-type-icons__item__content">
								<i class="<?php 
    echo esc_attr($icon_class);
    ?>
"></i><?php 
    echo esc_html($item->name);
    ?>
							</span>
Exemplo n.º 3
0
 /**
  * Renders tour categories related to current tour item.
  *
  * @param  array $args   assoc that contains rendering settings.
  * @param  int   $postId optional post id.
  * @return void
  */
 function adventure_tours_render_tour_icons($args = array(), $postId = null)
 {
     if (!adventure_tours_check('tour_category_taxonomy_exists')) {
         return;
     }
     $defaults = array('before' => '', 'after' => '');
     $args = wp_parse_args($args, $defaults);
     if (null === $postId) {
         $postId = get_the_ID();
     }
     $items = $postId ? wp_get_object_terms($postId, 'tour_category') : null;
     if (!$items) {
         return;
     }
     $items_html = '';
     foreach ($items as $tourType) {
         $icon_class = AtTourHelper::get_tour_category_icon_class($tourType);
         if ($icon_class) {
             $items_html .= sprintf('<a href="%s"><i data-toggle="tooltip" title="%s" class="%s"></i></a>', esc_url(get_term_link($tourType->slug, 'tour_category')), esc_attr($tourType->name), esc_attr($icon_class));
         }
     }
     if ($items_html) {
         printf('%s%s%s', $args['before'], $items_html, $args['after']);
     }
 }