I have a views parametric search and when the results are displayed it should only be possible for each author to have one result show up for a give criteria as all fields of the search have been made required. So the only way there would be multiple for one author is if they entered the same categories more than once. Unfortunately this would be a way for people to make their results fill up the first page of results so I need to limit the output to one per author. hoping there is a way with conditional output to perform this filter?
Hi, unfortunately our conditional HTML feature isn't designed to help you hide results this way. If you want to limit the post results to only one per author, then it will require custom code. That falls outside the scope of support we provide here in the forums. A skilled developer might be able to offer a solution using our wpv_filter_query or wpv_filter_query_post_process APIs. We have documentation about those filters here:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query_post_process
We also have a portal available where you may connect with developers with Toolset knowledge here:
https://toolset.com/contractors/
Thanks, turned out because I always needed only one result in any query on the site I was able to just use a global groupby function however I will probably use the hook you provided to only attach it to that query for best practice.
function filter_authors($groupby) {
global $wpdb;
$groupby = " {$wpdb->posts}.post_author";
return $groupby;
}
add_filter('posts_groupby','filter_authors');