feat: add publication status filter to article archive
Added a dropdown to filter articles by publication status in the article archive. This feature enhances user capabilities by allowing them to easily filter articles based on their publication status, improving content accessibility and navigation.
This commit is contained in:
parent
ca3417643a
commit
2fab7b0aee
1 changed files with 19 additions and 0 deletions
|
@ -3,6 +3,25 @@
|
|||
<!-- Archive Content -->
|
||||
<section class="container my-5">
|
||||
<h1 class="display-4 text-center">Articles</h1>
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
<form method="GET" action="">
|
||||
<select name="publication_status" onchange="this.form.submit()">
|
||||
<option value=""><?php _e('All Statuses', 'duck-behavior-journal'); ?></option>
|
||||
<?php
|
||||
$terms = get_terms(array(
|
||||
'taxonomy' => 'publication_status',
|
||||
'hide_empty' => false,
|
||||
));
|
||||
foreach ($terms as $term) {
|
||||
$selected = (isset($_GET['publication_status']) && $_GET['publication_status'] == $term->slug) ? 'selected' : '';
|
||||
echo '<option value="' . esc_attr($term->slug) . '" ' . $selected . '>' . esc_html($term->name) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||
<div class="col-md-4">
|
||||
|
|
Loading…
Reference in a new issue