fix: clarify fixed CHRNX archive filters

This commit is contained in:
chrnx committed 2026-08-11 18:32:09 -05:00
1 parent 2230731e1b
commit ff1c64ae48
4 files changed
+160 -39

No files matched your search

+46 -32
View File
@@ -16,46 +16,60 @@ $chrnx_language = chrnx_validate_editorial_term_slug( $chrnx_request['chrnx_lang
$chrnx_search = $chrnx_args['s'] ?? '';
$chrnx_form_url = chrnx_get_journal_base_url();
$chrnx_title_id = wp_unique_id( 'chrnx-journal-title-' );
$chrnx_fixed = chrnx_get_journal_archive_filter();
?>
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-journal-stream' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> aria-labelledby="<?php echo esc_attr( $chrnx_title_id ); ?>">
<h<?php echo esc_attr( $chrnx_heading ); ?> id="<?php echo esc_attr( $chrnx_title_id ); ?>"><?php echo esc_html__( 'Journal', 'chrnx' ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>>
<form class="chrnx-journal-stream__filters" method="get" action="<?php echo esc_url( $chrnx_form_url ); ?>">
<label>
<span><?php echo esc_html__( 'Topic', 'chrnx' ); ?></span>
<select name="chrnx_topic">
<option value=""><?php echo esc_html__( 'All topics', 'chrnx' ); ?></option>
<?php
foreach ( get_terms(
array(
'taxonomy' => 'chrnx_topic',
'hide_empty' => false,
)
) as $chrnx_term ) :
?>
<option value="<?php echo esc_attr( $chrnx_term->slug ); ?>" <?php selected( $chrnx_topic, $chrnx_term->slug ); ?>><?php echo esc_html( $chrnx_term->name ); ?></option>
<?php endforeach; ?>
</select>
</label>
<label>
<span><?php echo esc_html__( 'Language', 'chrnx' ); ?></span>
<select name="chrnx_language">
<option value=""><?php echo esc_html__( 'All languages', 'chrnx' ); ?></option>
<?php
foreach ( get_terms(
array(
'taxonomy' => 'chrnx_language',
'hide_empty' => false,
)
) as $chrnx_term ) :
?>
<option value="<?php echo esc_attr( $chrnx_term->slug ); ?>" <?php selected( $chrnx_language, $chrnx_term->slug ); ?>><?php echo esc_html( $chrnx_term->name ); ?></option>
<?php endforeach; ?>
</select>
</label>
<?php if ( isset( $chrnx_fixed['taxonomy'] ) && 'chrnx_topic' === $chrnx_fixed['taxonomy'] ) : ?>
<p class="chrnx-journal-stream__fixed-filter"><span><?php echo esc_html__( 'Topic', 'chrnx' ); ?></span> <strong><?php echo esc_html( $chrnx_fixed['label'] ); ?></strong></p>
<input type="hidden" name="chrnx_topic" value="<?php echo esc_attr( $chrnx_fixed['slug'] ); ?>">
<?php else : ?>
<label>
<span><?php echo esc_html__( 'Topic', 'chrnx' ); ?></span>
<select name="chrnx_topic">
<option value=""><?php echo esc_html__( 'All topics', 'chrnx' ); ?></option>
<?php
foreach ( get_terms(
array(
'taxonomy' => 'chrnx_topic',
'hide_empty' => false,
)
) as $chrnx_term ) :
?>
<option value="<?php echo esc_attr( $chrnx_term->slug ); ?>" <?php selected( $chrnx_topic, $chrnx_term->slug ); ?>><?php echo esc_html( $chrnx_term->name ); ?></option>
<?php endforeach; ?>
</select>
</label>
<?php endif; ?>
<?php if ( isset( $chrnx_fixed['taxonomy'] ) && 'chrnx_language' === $chrnx_fixed['taxonomy'] ) : ?>
<p class="chrnx-journal-stream__fixed-filter"><span><?php echo esc_html__( 'Language', 'chrnx' ); ?></span> <strong><?php echo esc_html( $chrnx_fixed['label'] ); ?></strong></p>
<input type="hidden" name="chrnx_language" value="<?php echo esc_attr( $chrnx_fixed['slug'] ); ?>">
<?php else : ?>
<label>
<span><?php echo esc_html__( 'Language', 'chrnx' ); ?></span>
<select name="chrnx_language">
<option value=""><?php echo esc_html__( 'All languages', 'chrnx' ); ?></option>
<?php
foreach ( get_terms(
array(
'taxonomy' => 'chrnx_language',
'hide_empty' => false,
)
) as $chrnx_term ) :
?>
<option value="<?php echo esc_attr( $chrnx_term->slug ); ?>" <?php selected( $chrnx_language, $chrnx_term->slug ); ?>><?php echo esc_html( $chrnx_term->name ); ?></option>
<?php endforeach; ?>
</select>
</label>
<?php endif; ?>
<label>
<span><?php echo esc_html__( 'Search', 'chrnx' ); ?></span>
<input type="search" name="s" value="<?php echo esc_attr( $chrnx_search ); ?>">
</label>
<?php if ( ! empty( $chrnx_fixed ) ) : ?>
<a class="chrnx-journal-stream__clear" href="<?php echo esc_url( chrnx_get_full_journal_url() ); ?>"><?php echo esc_html__( 'View all Journal entries', 'chrnx' ); ?></a>
<?php endif; ?>
<button type="submit"><?php echo esc_html__( 'Filter', 'chrnx' ); ?></button>
</form>
<?php if ( $chrnx_query->have_posts() ) : ?>