Forums › Forums › Search & Filter Pro › CoAuthors Plus plugin secondary authors not appearing in search results
Tagged: coauthorsplus
- This topic has 27 replies, 2 voices, and was last updated 5 years, 8 months ago by Trevor.
-
Anonymous(Private) March 27, 2019 at 12:30 pm #206479
Dropdown list is correct, results are correct, but the author names listed within the results are limited to only the first one (does not include the additional authors that are added within the post using the CoAuthors plugin).
For example, here is Wael’s author page. The two results listed there are the same ones returned if you select Wael from the dropdown. However, the only authors listed for those two articles are the ones listed first in the plugin (does not show additional authors for the post).
Also, if you search Wael in the search field, neither of the correct results show up. The dropdown seems to be at least displaying the correct results, but the search field itself is not generating the same ones.
Anonymous(Private) March 27, 2019 at 3:24 pm #206571FINAL code:
Okay, so the code required included that original bit. Here is the final code in the inc/template-tags.php file:
if ( ! function_exists( 'visual_posted_on' ) ) : /** * Integrate Co-Authors Plus with TwentyTen by replacing twentyten_posted_on() with this function */ function visual_posted_on() { if ( function_exists( 'coauthors_posts_links' ) ) : printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ), 'meta-prep meta-prep-author', sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>', get_permalink(), esc_attr( get_the_time() ), get_the_date() ), coauthors_posts_links( null, null, null, null, false ) ); else: printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ), 'meta-prep meta-prep-author', sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>', get_permalink(), esc_attr( get_the_time() ), get_the_date() ), sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>', get_author_posts_url( get_the_author_meta( 'ID' ) ), esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author() ) ), get_the_author() ) ); endif; } endif; function filter_function_name($input_object, $sfid) { if ($input_object['name'] == '_sft_author') { global $coauthors_plus; foreach($input_object['options'] as $key => $option) { if($option->value=="") { $option->label = "Search by Author"; } else { $user = $coauthors_plus->get_coauthor_by( 'user_nicename', $option->value ); $input_object['options'][$key]->label = $user->display_name . ' (' . $option->count . ')'; } } } return $input_object; } add_filter('sf_input_object_pre', 'filter_function_name', 10, 2);
Also, added Relevanssi plugin per your guidance and enabled it within SF Pro search form > Advanced settings.
Really appreciate your continued support on this issue! Glad to have it resolved now.
-
AuthorPosts