Customizing category/tag results
-
Under the uajax_result function:
function uajax_result($arg, $id,$pagenumber,$getdata){ $query = new WP_Query( $arg ); $html = ''; //print_r($query); // The Loop if ( $query->have_posts() ) { $html .= '<h1>'.__('Search Results :', 'UWPQSF' ).'</h1>'; $html .= '<article role="article">'; $html .= '<section class="entry-content cf">'; $html .= '<div class="post">'; $html .= '<div class="entry">'; $html .= '<ol class="test">'; while ( $query->have_posts() ) { $query->the_post(); global $post; $result = apply_filters('uwpqsf_result_template', $output = '', $post); if( empty($result) ){ $html .= '<li>'; $html .= '<a href="'. get_permalink() .'"><img src="'. get_field('image').'"/><span>' .get_the_title().'</span></a>'; $html .= '</li>'; } else { $html .= $result; } } $html .= $this->ajax_pagination($pagenumber,$query->max_num_pages, 4, $id,$getdata); $html .= '</ol>'; $html .= '</div>'; $html .= '</div>'; $html .= '</section>'; $html .= '</article>'; } else { $html .= __( 'Nothing Found', 'UWPQSF' ); } /* Restore original Post Data */ wp_reset_postdata(); return $html; }//end resultI have every post showing up, but I’d like to sort those posts into their separate categories. Like Below
Search Results:
-Category 1
–result 1
–result 2
-Category 2
— result 1https://wordpress.org/plugins/ultimate-wp-query-search-filter/
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Customizing category/tag results’ is closed to new replies.