Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Taxonomies as search results › Reply To: Taxonomies as search results
January 5, 2016 at 5:24 pm
#7228
Hi!
I’m sorry, I’ve missed your ticket by accident.
It’s unfortunately not possible, there is not setting for this type of display. However based on this knowledge base article, you can try this code:
add_filter( 'asp_pagepost_results', 'asp_add_term_titles', 1, 1 );
function asp_add_term_titles( $pageposts ) {
foreach ($pageposts as $k=>$v) {
// Change this to the taxonomy name you want to use
$taxonomy = "my_taxonomy";
// Get the taxonomy terms
$post_terms = wp_get_post_terms( $pageposts[$k]->id, $taxonomy );
$terms = array();
// Concatenate term names to the $cats variable
foreach($post_terms as $t){
if ( !empty($t->name) )
$terms[] = $t->name;
}
// Modify the post content
if ( !empty($t) )
$pageposts[$k]->content = implode(", ", $t);
}
return $pageposts;
}
Try adding this code in your active theme directory to the functions.php file. Then change the $taxonomy variable from “my_taxonomy” to the taxonomy you want to use.
Best,Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)