added company based filter and user meta
This commit is contained in:
@@ -70,6 +70,15 @@ class Partnerexpo_Core_Public {
|
||||
$params['tags'] = str_replace(',', '+', $params['tags']);
|
||||
}
|
||||
|
||||
$companies = explode(',', $params['companies'] ?? '');
|
||||
|
||||
$authors = get_users([
|
||||
'meta_key' => 'company',
|
||||
'meta_value' => $companies,
|
||||
'meta_compare' => 'IN',
|
||||
'fields' => 'ID',
|
||||
]);
|
||||
|
||||
$args = [
|
||||
'post_type' => 'pexpo_partners',
|
||||
'posts_per_page' => $params['resultsPerPage'] ?? 10,
|
||||
@@ -79,6 +88,10 @@ class Partnerexpo_Core_Public {
|
||||
'pexpo_tags' => $params['tags'] ?? '',
|
||||
];
|
||||
|
||||
if (!empty($authors)) {
|
||||
$args['author__in'] = array_values($authors);
|
||||
}
|
||||
|
||||
if ( ! empty( $params['tags'] ) ) {
|
||||
$tag_string = $params['tags'];
|
||||
$operator = 'IN';
|
||||
|
||||
Reference in New Issue
Block a user