Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TC.K

    (@wp_dummy)

    Please refer to this thread.

    Thread Starter Pinoss

    (@pinoss)

    Thanks for response.

    Now, I’m trying to show the number of results when a search is realized. I have searched across 9-sec support forum but haven’t seen any related topic. Furthermore, I want to print applied filters. I saw one code in a topic and I’m using print_r($getdata['taxo']).
    Working together, when a search is realized, it would print something like this:
    “Search results of example category and example tag : 18”.

    Another question that I have is : how to show a category dropdown filter with hierarquical categorys? I use this snippet found in a topic:

    add_filter('uwpqsf_tax_field_dropdown','custom_dropdown_output','',12);
    function custom_dropdown_output($html,$type,$exc,$hide,$taxname,$taxlabel,$taxall,$opt,$c,$defaultclass,$formid,$divclass){
    
    $args = array('hide_empty'=>$hide,'exclude'=>$eid );
    $taxoargs = apply_filters('uwpqsf_taxonomy_arg',$args,$taxname,$formid);
    $terms = get_terms($taxname,$taxoargs); $count = count($terms);
    
    			 if($type == 'dropdown'){
    			$html  = '<div class="'.$defaultclass.' '.$divclass.' tax-select-'.$c.'"><span class="taxolabel-'.$c.'">'.$taxlabel.'</span>';
    			$html .= '<input  type="hidden" name="taxo['.$c.'][name]" value="'.$taxname.'">';
    			$html .= '<input  type="hidden" name="taxo['.$c.'][opt]" value="'.$opt.'">';
    			$html .=  '<select id="tdp-'.$c.'" name="taxo['.$c.'][term]">';
    			if(!empty($taxall)){
    				$html .= '<option selected value="uwpqsftaxoall">'.$taxall.'</option>';
    			}
    					if ( $count > 0 ){
    						foreach ( $terms as $term ) {
    					 $selected = $terms[0]->term_id;
    $html .= '<option value="'.$term->slug.'">'.$term->name.'</option>';
    
        $args = array(
            'hide_empty'    => false,
            'hierarchical'  => true,
            'parent'        => $term->term_id
        );
        $childterms = get_terms($taxname, $args);
    
        foreach ( $childterms as $childterm ) {
                $selected = $childterms[0]->term_id;
    
            $html .= "<option value='".$childterm->slug."'"."> ?? >"  . $childterm->name . '</option>';
    
        }}
    			}
    			$html .= '</select>';
    			$html .= '</div>';
    			return  apply_filters( 'custom_dropdown_output', $html,$type,$exc,$hide,$taxname,$taxlabel,$taxall,$opt,$c,$defaultclass,$formid,$divclass);
    		}
    
    }

    but only shows 1 category depth. I have more categories inside subcategories. I tried with depth argument in $args but don’t work. How can I do it?

    Thanks in advance.

    Plugin Author TC.K

    (@wp_dummy)

    For first question, you need to customize the result. It is depend on what result template you using.
    For default result template you need do it in the search.php template.

    For Ajax result, you can use uwpqsf_result_tempt filter to customize the result (refer this post). In the If loop, you can use $wp_query->found_posts() property to display total number of posts found matching the current query parameters. (Refer here for other properties.)

    For second question, You just need to loop again in the foreach ( $childterms as $childterm ) .

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show Post Count next to Fields’ is closed to new replies.