diff --git a/templates/filter-form.php b/templates/filter-form.php index d985a93..f772eef 100644 --- a/templates/filter-form.php +++ b/templates/filter-form.php @@ -5,10 +5,12 @@ $resource_types = get_terms(['taxonomy' => 'resource_type', 'hide_empty' => t $resource_subjects = get_terms(['taxonomy' => 'resource_subject', 'hide_empty' => true]); ?> +
- +
- + +
@@ -20,7 +22,8 @@ $resource_subjects = get_terms(['taxonomy' => 'resource_subject', 'hide_empty' =
diff --git a/templates/filter-homepage.php b/templates/filter-homepage.php index 5928de0..b4af00d 100644 --- a/templates/filter-homepage.php +++ b/templates/filter-homepage.php @@ -1,12 +1,12 @@ - + 'resource_type']); if (!empty($resource_types)) : ?> - @@ -14,7 +14,7 @@ - + - + diff --git a/templates/filter-summary.php b/templates/filter-summary.php index b265100..59430ac 100644 --- a/templates/filter-summary.php +++ b/templates/filter-summary.php @@ -1,8 +1,77 @@ 'search', + 'value' => esc_html($_POST['search']), + 'label' => 'Search: "' . esc_html($_POST['search']) . '"' + ]; +} + +// Handle the "Resource Type" filter +if (!empty($_POST['resource_type'])) { + $selected_types = is_array($_POST['resource_type']) ? $_POST['resource_type'] : [$_POST['resource_type']]; + $filters[] = [ + 'type' => 'resource_type', + 'value' => esc_html(implode(',', $selected_types)), + 'label' => 'Type: ' . esc_html(implode(', ', $selected_types)) + ]; +} + +// Handle the "Resource Subject" filter +if (!empty($_POST['resource_subject'])) { + $selected_subjects = is_array($_POST['resource_subject']) ? $_POST['resource_subject'] : [$_POST['resource_subject']]; + $filters[] = [ + 'type' => 'resource_subject', + 'value' => esc_html(implode(',', $selected_subjects)), + 'label' => 'Subject: ' . esc_html(implode(', ', $selected_subjects)) + ]; +} + +// Display filters as HTML +$filter_html = ''; +if (!empty($filters)) { + foreach ($filters as $filter) { + $filter_html .= '' + . $filter['label'] + . ' ' + . ' '; + } +} else { + $filter_html = 'None'; +} ?> -
-

Showing resources

-

Filters applied:
None

+
+ +

Showing resource(s)

+ +
+ +
+ + +
+ + +

+ Filters applied:
+ +

+
diff --git a/templates/resource-results.php b/templates/resource-results.php index e5f4e11..1915e25 100644 --- a/templates/resource-results.php +++ b/templates/resource-results.php @@ -1,14 +1,37 @@ - ID; - $post_title = get_the_title($post_id); - $post_link = get_permalink($post_id); + $postID = $resource->ID; + $postTitle = get_the_title($postID); + $postLink = get_permalink($postID); ?> -
+
+

+ +
+

Resource Type: name); ?>

+

+ Resource Subject(s): + name); + } else { + echo esc_html($subject->name) . ', '; + } + + $i++; + } + ?> +

+
+

No resources found.