Reply To: Custom field in search results

Ernest Marcinko
Ernest Marcinko


1. Try changing that to this:

<p>Deel van: <?php
  $related_p_ids = get_post_meta($post->ID, 'deel_van', true);
  $to_echo = array();
  foreach ($related_p_ids as $pid) {    
    $to_echo[] = "<a href='".get_permalink($pid)."'>" . get_the_title($pid) . "</a>";
  if ( count($to_echo) > 0 )
    echo implode("<br>", $to_echo);

This puts a line break inbetween items.

2. Well, in this case you can try something like:

add_filter( ‘asp_result_author_after_prostproc’, ‘asp_author_from_cf’, 1, 2);

function asp_author_from_cf($author, $post_id) {

  $authors = get_the_terms( $post_id, "auteur" );
  $author_names = array();
  if ( is_array($authors) ) {
    foreach ($authors as $a) {
      $author_names[] = $a->name;
    $author = implode(" | ", $author_names);
  return $author; 

This should get all authors and if finds any, then adds them all to the author field separated by “I”.

3. As for the term order. I think I have a solution for you 🙂
After researching I found one plugin, that works. Install this plugin:

It’s working great, it lets me re-order every taxonomy term for every post. Here is how I did it:
It’s a bit time consuming to do it for every post, but it works flawelessely.

Ernest Marcinko

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