function wpv_render_taxonomy_control( $atts ) {

    // We need to know what attribute url format are we using
    // to make the control filter use values of names or slugs for values.
    // If using names, $url_format=false and if using slugs, $url_format=true
	//printf('$taxonomy %s, $type %s, $url_param %s, $default_label %s, $taxonomy_orderby %s, $taxonomy_order %s, $format %s', $taxonomy, $type, $url_param, $default_label, $taxonomy_orderby, $taxonomy_order, $format);
    global $WP_Views;
    
    extract(
		shortcode_atts(array(
				'taxonomy' => '',
				'type' => '',
				'url_param' => '',
				'default_label' => '',
				'taxonomy_orderby' => '',
				'taxonomy_order' => '',
				'format' => '',
				'hide_empty' => '',
                'style' => '', // input inline styles
                'class' => '', // input classes
                'label_style' => '', // inline styles for input label
                'label_class' => '' // classes for input label
			), $atts)
	);
    
    if ( !taxonomy_exists( $taxonomy ) ) {
		return;
    }
    
	$url_format = true;
    
    $view_settings = $WP_Views->get_view_settings();
    
    if (isset($view_settings['taxonomy-'. $taxonomy .'-attribute-url-format']) && 'slug' != $view_settings['taxonomy-'.$taxonomy . '-attribute-url-format'][0]) $url_format = false;
    
    $terms = array();
    $get_value = ( $hide_empty == 'true' ) ? '' : 'all';
    $default_selected = '';
    
    if (isset($_GET[$url_param])) {
        if (is_array($_GET[$url_param])) {
            $terms = $_GET[$url_param];
        } else {
            // support csv terms
            $terms = explode(',', $_GET[$url_param]);
        }
    }    
    
    ob_start();
    ?>
		<?php
            if ( $type == 'select' || $type == 'multi-select' ) {
                $name = $taxonomy;
                if ( $name == 'category' ) {
                    $name = 'post_category';
                }
                
				if ( $type == 'select' ) {
					echo '<select name="' . $name . '"'. ( !empty($style) ? ' style="' . $style . '"' : '' ) .' class="js-wpv-filter-trigger'. ( !empty($class) ? ' '. $class : '' ) .'">';// maybe it is $name and not $taxonomy, and maybe slug-**; we need to add the influencers here
					if ( empty( $terms ) || in_array( (string) 0, $terms ) ) {
						$default_selected = " selected='selected'";
					}
					// TODO we do not add counters nor any format here, as we do for custom fields. WE might need to review this.
					echo '<option' . $default_selected . ' value="0">' . $default_label . '</option>'; // set the label for the default option
				} else if ( $type == 'multi-select' ) {
					echo '<select name="' . $name . '[]" multiple="multiple"'. ( !empty($style) ? ' style="' . $style . '"' : '' ) .' class="js-wpv-filter-trigger'. ( !empty($class) ? ' '. $class : '' ) .'" size="10">';
				}
				$temp_slug = '0';
				if ( count( $terms ) ) {
					$temp_slug = $terms;
				}
				$my_walker = new Walker_Category_select($temp_slug, $url_format, $format, $taxonomy, $type);
				wpv_terms_checklist(0, array('taxonomy' => $taxonomy, 'selected_cats' => $terms, 'walker' => $my_walker, 'taxonomy_orderby' => $taxonomy_orderby, 'taxonomy_order' => $taxonomy_order, 'get_value' => $get_value));
                echo '</select>';
            } 
			elseif ($type == 'radios' || $type == 'radio' ) {

			    $name = $taxonomy;
			    if ($name == 'category') {
			        $name = 'post_category';
			    }
				
			    $temp_slug = '0';
			    if ( count( $terms ) ) {
			        $temp_slug = $terms;
			    }
			    if ( isset( $default_label ) ) {
					if ( empty( $terms ) || in_array( (string) 0, $terms ) ) {
						$default_selected = " checked='checked'";
					}
					echo '<input id="' . $name . '-"'. ( !empty($style) ? ' style="' . $style . '"' : '' ) .' class="js-wpv-filter-trigger'. ( !empty($class) ? ' '. $class : '' ) .'" name="'.$name.'" type="radio" value="0"' . $default_selected . '/>
                    <label for="' . $name . '-"'. ( !empty($label_style) ? ' style="' . $label_style . '"' : '' ) .' class="radios-taxonomies-title'. ( !empty($label_class) ? ' '. $label_class : '' ) .'">' . $default_label . '</label>';
				}
				$my_walker = new Walker_Category_radios($temp_slug, $url_format, $format, $taxonomy, $style, $class, $label_style, $label_class);
			    wpv_terms_checklist(0, array('taxonomy' => $taxonomy, 'selected_cats' => $terms, 'walker' => $my_walker, 'taxonomy_orderby' => $taxonomy_orderby, 'taxonomy_order' => $taxonomy_order, 'get_value' => $get_value));
			} else {
				echo '<ul class="categorychecklist form-no-clear">';
			    wpv_terms_checklist(0, array('taxonomy' => $taxonomy, 'selected_cats' => $terms, 'url_format' => $url_format, 'format' => $format, 'taxonomy_orderby' => $taxonomy_orderby, 'taxonomy_order' => $taxonomy_order, 'get_value' => $get_value, 'style' => $style, 'class' => $class, 'label_style' => $label_style, 'label_class' => $label_class ));
				echo '</ul>';
			}
            
        ?>
		
    <?php
    
    $taxonomy_check_list = ob_get_clean();
    
    if ($taxonomy == 'category') {
        $taxonomy_check_list = str_replace('name="post_category', 'name="' . $url_param, $taxonomy_check_list);
    } else {
        $taxonomy_check_list = str_replace('name="' . $taxonomy, 'name="' . $url_param, $taxonomy_check_list);
    }
    
    return $taxonomy_check_list;
    
}
function _wpv_render_taxonomy_control($taxonomy, $type, $url_param, $default_label, $taxonomy_orderby, $taxonomy_order, $format, $hide_empty)
{
    // We need to know what attribute url format are we using
    // to make the control filter use values of names or slugs for values.
    // If using names, $url_format=false and if using slugs, $url_format=true
    //printf('$taxonomy %s, $type %s, $url_param %s, $default_label %s, $taxonomy_orderby %s, $taxonomy_order %s, $format %s', $taxonomy, $type, $url_param, $default_label, $taxonomy_orderby, $taxonomy_order, $format);
    global $WP_Views;
    $aux_array = $WP_Views->view_used_ids;
    $view_settings = $WP_Views->get_view_settings(end($aux_array));
    $url_format = false;
    if (!taxonomy_exists($taxonomy)) {
        return;
    }
    if (isset($view_settings['taxonomy-' . $taxonomy . '-attribute-url-format']) && 'slug' == $view_settings['taxonomy-' . $taxonomy . '-attribute-url-format'][0]) {
        $url_format = true;
    }
    $terms = array();
    $get_value = $hide_empty == 'true' ? '' : 'all';
    if (isset($_GET[$url_param])) {
        if (is_array($_GET[$url_param])) {
            $terms = $_GET[$url_param];
        } else {
            // support csv terms
            $terms = explode(',', $_GET[$url_param]);
        }
    }
    ob_start();
    ?>
        

		<?php 
    if ($type == 'select' || $type == 'multi-select') {
        $name = $taxonomy;
        if ($name == 'category') {
            $name = 'post_category';
        }
        if ($type == 'select') {
            echo '<select name="' . $name . '">';
            echo "<option selected='selected' value='0'>{$default_label}</option>";
            // set the label for the default option
        } else {
            if ($type == 'multi-select') {
                echo '<select name="' . $name . '[]" multiple >';
            }
        }
        $temp_slug = '0';
        if (count($terms)) {
            $temp_slug = $terms;
        }
        $my_walker = new Walker_Category_select($temp_slug, $url_format, $format);
        wpv_terms_checklist(0, array('taxonomy' => $taxonomy, 'selected_cats' => $terms, 'walker' => $my_walker, 'taxonomy_orderby' => $taxonomy_orderby, 'taxonomy_order' => $taxonomy_order, 'get_value' => $get_value));
        echo '</select>';
    } elseif ($type == 'radios' || $type == 'radio') {
        $name = $taxonomy;
        if ($name == 'category') {
            $name = 'post_category';
        }
        $temp_slug = '0';
        if (count($terms)) {
            $temp_slug = $terms;
        }
        $my_walker = new Walker_Category_radios($temp_slug, $url_format, $format);
        wpv_terms_checklist(0, array('taxonomy' => $taxonomy, 'selected_cats' => $terms, 'walker' => $my_walker, 'taxonomy_orderby' => $taxonomy_orderby, 'taxonomy_order' => $taxonomy_order, 'get_value' => $get_value));
    } else {
        echo '<ul class="categorychecklist form-no-clear">';
        wpv_terms_checklist(0, array('taxonomy' => $taxonomy, 'selected_cats' => $terms, 'url_format' => $url_format, 'format' => $format, 'taxonomy_orderby' => $taxonomy_orderby, 'taxonomy_order' => $taxonomy_order, 'get_value' => $get_value));
        echo '</ul>';
    }
    ?>
		
    <?php 
    $taxonomy_check_list = ob_get_clean();
    if ($taxonomy == 'category') {
        $taxonomy_check_list = str_replace('name="post_category', 'name="' . $url_param, $taxonomy_check_list);
    } else {
        $taxonomy_check_list = str_replace('name="' . $taxonomy, 'name="' . $url_param, $taxonomy_check_list);
    }
    return $taxonomy_check_list;
}