echo __('Desc', 'cactusthemes');
?>
 </option>
				</select>
				</label>
			</span>
		</div>
		<?php 
if ($show_tag_filter) {
    ?>
		<div class="asf-tags">
			<?php 
    if ($search_cat == '') {
        $search_cat = 0;
    }
    $tags = asf_get_all_tags_in_category($search_cat);
    if (count($tags > 0)) {
        ?>
				<span class="search_tags">
					<a href="javascript:void(0)" <?php 
        if (isset($_GET['tag']) && $_GET['tag'] == '') {
            echo 'class="filtered"';
        }
        ?>
 onclick="jQuery('.ss_tag_name',jQuery(this).parent().parent().parent()).val('');jQuery(this).parent().parent().parent().submit()"><?php 
        echo __('Any tag', 'cactusthemes');
        ?>
</a>
				<?php 
        foreach ($tags as $tag) {
            $count_tags++;
function asf_get_all_tags_in_category($id)
{
    global $wpdb;
    // get child categories is has any
    if ($id != 0) {
        // get category taxonomy
        $childs = get_categories(array('parent' => $id));
    } else {
        $childs = get_categories(array('hierarchical' => false));
    }
    $tags = array();
    if (count($childs) > 0) {
        foreach ($childs as $child) {
            $tags = array_merge($tags, asf_get_all_tags_in_category($child->cat_ID));
        }
    }
    if ($id != 0) {
        $tags1 = $wpdb->get_results("\r\n\t\t\tSELECT DISTINCT terms2.term_id as tag_id, terms2.name as tag_name, terms2.slug as tag_slug, null as tag_link\r\n\t\t\tFROM\r\n\t\t\t\twp_posts as p1\r\n\t\t\t\tLEFT JOIN wp_term_relationships as r1 ON p1.ID = r1.object_ID\r\n\t\t\t\tLEFT JOIN wp_term_taxonomy as t1 ON r1.term_taxonomy_id = t1.term_taxonomy_id\r\n\t\t\t\tLEFT JOIN wp_terms as terms1 ON t1.term_id = terms1.term_id,\r\n\r\n\t\t\t\twp_posts as p2\r\n\t\t\t\tLEFT JOIN wp_term_relationships as r2 ON p2.ID = r2.object_ID\r\n\t\t\t\tLEFT JOIN wp_term_taxonomy as t2 ON r2.term_taxonomy_id = t2.term_taxonomy_id\r\n\t\t\t\tLEFT JOIN wp_terms as terms2 ON t2.term_id = terms2.term_id\r\n\t\t\tWHERE\r\n\t\t\t\tt1.taxonomy = 'category' AND p1.post_status = 'publish' AND terms1.term_id = " . $id . " AND\r\n\t\t\t\tt2.taxonomy = 'post_tag' AND p2.post_status = 'publish'\r\n\t\t\t\tAND p1.ID = p2.ID\r\n\t\t\tORDER by tag_name\r\n\t\t");
        $count = 0;
        foreach ($tags1 as $tag) {
            $tags1[$count]->tag_link = get_tag_link($tag->tag_id);
            $count++;
        }
        $tags = array_merge($tags, $tags1);
    }
    // filter duplicate tags
    $result = array();
    foreach ($tags as $tag) {
        $not_added = true;
        foreach ($result as $res) {
            if ($tag->tag_name == $res->tag_name) {
                $not_added = false;
                break;
            }
        }
        if ($not_added) {
            $result[] = $tag;
        }
    }
    return $result;
}