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

Reply To: Show custom field "auteur" as author

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Show custom field "auteur" as author Reply To: Show custom field "auteur" as author

#29052
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Sorry, there was a mistake in the code indeed, I have corrected it via FTP, it is all right now:

add_filter( 'asp_results', 'asp_author_from_cf', 10, 1);
function asp_author_from_cf($results) {
	foreach ( $results as $k => &$r ) {
		$authors = get_the_terms( $r->id, "auteur" );
		$author_names = array();
		if ( is_array($authors) && count($authors) > 0 ) {
			foreach ($authors as $a) {
			  $author_names[] = $a->name;
			}
			$r->author = implode(" | ", $author_names);
		} 
	}
	return $results; 
}