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

Reply To: Comma separated list of custom taxonomy names

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Comma separated list of custom taxonomy names Reply To: Comma separated list of custom taxonomy names

#45778
Ernest MarcinkoErnest Marcinko
Keymaster

Okay, I see how this works now. Without coding this is not possible, but it should not be too difficult whatsoever.
Your code looks surprisingly perfectly fine to me, very good job – but I might be able to suggest a way based on that so you don’t have to use an additional field.

Instead of that code, try this:

add_filter( 'asp_results', 'asp_add_extra_field_data', 10, 1 );
function asp_add_extra_field_data( $results ) {
  foreach ($results as $k=>&$r) {
	  $slug = $r->post_type;
	  $taxname = get_field('published_year', $r->id)->name;
	  $origin = get_field('originator', $r->id)->name;
	  $enjoyed = get_field('date_enjoyed', $r->id);
	  $tipwrit = get_field('writer', $r->id)->name;
	  $enjoydat = get_field('enjoyed_at', $r->id)[0]->post_title;
	  $tippub = get_field('publication', $r->id)->name;
	  
	  $strung = $slug . ": " . $taxname . $enjoyed . $tipwrit . ', ' . $origin . $enjoydat . $tippub
  } 
  return $results;
}

Please be very careful and have backups! I may have made typos, as I am not able to test this.

PS: Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.