refactor: Update README for latest release link and enhance filter display with taxonomy names #release
Some checks failed
Add release / Create release (push) Has been cancelled

This commit is contained in:
Keith Solomon
2025-03-29 12:14:34 -05:00
parent 71b8d4261f
commit bf70df2513
2 changed files with 36 additions and 6 deletions

View File

@@ -13,7 +13,7 @@ The Content Filter Plugin is a WordPress plugin designed to enhance content disc
## Installation
1. Clone this repo or download the plugin files and place them in the `wp-content/plugins/resource-filter` directory.
1. Clone this repo or download the [latest release](https://github.com/Vincent-Design-Inc/resource-filter/releases) and place them in the `wp-content/plugins/resource-filter` directory.
2. Log in to your WordPress admin dashboard.
3. Navigate to **Plugins** > **Installed Plugins**.
4. Activate the **Content Filter** plugin.

View File

@@ -28,18 +28,48 @@ jQuery(document).ready(function ($) {
taxonomyFilters[taxonomy] = [];
}
taxonomyFilters[taxonomy].push($(this).val());
taxonomyFilters[taxonomy].push({
value: $(this).val(),
text: $(this).closest('label').text().trim() // Get the text associated with the checkbox
});
});
const toTitleCase = (phrase) => {
return phrase
.toLowerCase()
.split('_')
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ');
};
// Build applied filters for display
let dropdownFilters = [];
let finalFilters = {};
for (let taxonomy in taxonomyFilters) {
taxonomyFilters[taxonomy].forEach(function (term) {
let taxName = toTitleCase(taxonomy);
appliedFilters.push(
`<span class="filter-item" data-type="${taxonomy}" data-value="${term}">
<strong>${taxonomy}:</strong> ${term}
<button class="remove-filter" aria-label="Remove ${term}">×</button>
`<span class="filter-item" data-type="${taxonomy}" data-value="${term.value}">
<strong>${taxName}:</strong> ${term.text}
<button class="remove-filter" aria-label="Remove ${term.text}">×</button>
</span>`
);
dropdownFilters.push(term.text);
if (!finalFilters[taxonomy]) {
finalFilters[taxonomy] = [];
}
finalFilters[taxonomy].push(
term.value,
);
$(`#${taxonomy}_text`).html(
dropdownFilters ? dropdownFilters.join(', ') : taxName
);
});
}
@@ -51,7 +81,7 @@ jQuery(document).ready(function ($) {
search: searchTerm,
paged: paged,
sort_order: $('#sortOrder').val(),
...taxonomyFilters, // Include taxonomy filters dynamically
...finalFilters, // Include taxonomy filters dynamically
};
// Perform AJAX request