Skip to content

Commit

Permalink
Add language filter to Lesson Plan archive
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwoodnz committed Apr 19, 2023
1 parent f8be467 commit 226c779
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
'current' => filter_input( INPUT_GET, 'wp_version', FILTER_VALIDATE_INT, FILTER_REQUIRE_ARRAY ) ?: array(),
),
);

$locales = \WPOrg_Learn\Post_Meta\get_available_post_type_locales( 'language', 'lesson-plan', 'native' );
?>

<form class="sidebar-filters col-3" method="get" action="<?php echo esc_url( get_post_type_archive_link( 'lesson-plan' ) ); ?>">
Expand All @@ -45,6 +47,27 @@
</a>
</div>

<h4 class="h5" id="lp-filters-language-heading"><?php esc_html_e( 'Language', 'wporg-learn' ); ?></h4>
<div class="filter-group">
<select
id="<?php echo esc_attr( 'language' ); ?>"
class="filter-group-select"
name="<?php echo esc_attr( 'language' ); ?>"
data-placeholder="<?php esc_attr_e( 'Select', 'wporg-learn' ); ?>"
aria-labelledby="lp-filters-language-heading"
>
<option value=""><?php esc_html_e( 'Select', 'wporg-learn' ); ?></option>
<?php foreach ( $locales as $locale_value => $locale_label ) : ?>
<option
value="<?php echo esc_attr( $locale_value ); ?>"
<?php selected( $locale_value, filter_input( INPUT_GET, 'language' ) ); ?>
>
<?php printf( '%s [%s]', esc_html( $locale_label ), esc_html( $locale_value ) ); ?>
</option>
<?php endforeach; ?>
</select>
</div>

<?php foreach ( $taxonomies as $txnmy ) : ?>
<h4 class="h5"><?php echo esc_html( $txnmy['label'] ); ?></h4>
<ul>
Expand Down

0 comments on commit 226c779

Please sign in to comment.