Reply To: Problem with searching in custom post

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Problem with searching in custom post Reply To: Problem with searching in custom post

#5428
Ernest Marcinko
Ernest Marcinko
Keymaster

Hi!

Well, I think the upper mentioned code won’t work, because the ‘auteur’ is not a meta field, but a taxonomy term.

Try something like:


<?php
// This is the taxonomy
$taxonomy = 'auteur';
 
// We only want to do this on posts/pages/custom post types
if ($r->content_type == 'pagepost') {
  $terms = get_the_terms( $r->id, $taxonomy );
  if (is_array($terms) && count($terms) > 0)
    echo "<div class='author'>" . $terms[0] . "</div>";
}
?>
Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)