Add post category class
-
Hello,
I’m trying to customize the ajax results using the filter from your site, but my php knowledge is low. I want to add the post category to each result as a class. Then show the title, excerpt and meta.Here is where I’m at:
‘add_filter(‘uwpqsf_result_tempt’, ‘customize_output’, ”, 4);
function customize_output($results , $arg, $id, $getdata ){
// The Query
$apiclass = new uwpqsfprocess();
$query = new WP_Query( $arg );
ob_start(); $result = ”;
// The Loopif ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();global $post;
echo ‘<div class=”client-box” WOULD LIKE THE CATEGORY NAME HERE>’;
echo ‘<h1 class=”client-title”>’.get_the_title().'</h1>’;
echo ‘<h2 class=”client-excerpt”>’.get_the_excerpt().'</h2>’;
echo ‘<p>’.the_meta().'</p>’;
echo ‘</div>’;
}
echo $apiclass->ajax_pagination($arg[‘paged’],$query->max_num_pages, 4, $id, $getdata);
} else {
echo ‘No clients fit these criteria’;
}
/* Restore original Post Data */
wp_reset_postdata();$results = ob_get_clean();
return $results;
}’Thanks!!
https://wordpress.org/plugins/ultimate-wp-query-search-filter/
The topic ‘Add post category class’ is closed to new replies.