Skip to content

Commit

Permalink
#92 added condition for category filter
Browse files Browse the repository at this point in the history
  • Loading branch information
debokshi committed Dec 17, 2024
1 parent dd84023 commit aa9cff8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions includes/shortcodes/fau_dir_shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,32 @@ function fetch_and_render_fau_data($atts)
}
// Apply organization and group filters if set
$persons = $filter_persons($persons, $orgnr, $groupid);
} elseif (!empty($category)) {
// Fetch by category
$args = [
'post_type' => 'custom_person',
'tax_query' => [
[
'taxonomy' => 'custom_taxonomy',
'field' => 'slug',
'terms' => $category,
],
],
'posts_per_page' => -1,
];
$person_posts = get_posts($args);
$person_identifiers = array();

foreach ($person_posts as $person_post) {
$person_id = get_post_meta($person_post->ID, 'person_id', true);
if (!empty($person_id)) {
$person_identifiers[] = $person_id;
}
}

if (!empty($person_identifiers)) {
$persons = process_persons_by_identifiers($person_identifiers);
}
} elseif (!empty($orgnr) && empty($post_id) && empty($identifiers) && empty($category) && empty($groupid) && empty($function)) {
$orgData = fetch_fau_organizations(0, 0, ['lq' => 'disambiguatingDescription[eq]=' . urlencode($orgnr)]);
if (!empty($orgData['data'])) {
Expand Down

0 comments on commit aa9cff8

Please sign in to comment.