This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Including Taxonomy Name next to Terms in Results

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Including Taxonomy Name next to Terms in Results Reply To: Including Taxonomy Name next to Terms in Results

#10383
Ernest MarcinkoErnest Marcinko
Keymaster

Hi!

Yes, actually it is possible. I’ve put together a small code snippet for you, put it in the functions.php file in your active theme directory:

[php]add_filter( ‘asp_results’, ‘asp_taxonomy_names_in_terms’, 1, 1 );

function asp_taxonomy_names_in_terms( $results ) {
foreach ($results as $k=>$v) {
if ( $v->content_type == ‘term’ ) {
$t = get_taxonomy( $v->taxonomy );
if ( !is_wp_error($t) )
$results[$k]->title = $t->label . ‘ – ‘ . $results[$k]->title;
}
}

return $results;
}[/php]

This should do the trick 🙂