Changeset 10528 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/template-parts/component-lesson-filters.php
- Timestamp:
- 12/17/2020 12:13:25 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/template-parts/component-lesson-filters.php
r10513 r10528 2 2 $taxonomies = array( 3 3 array( 4 'label' => get_taxonomy_labels( get_taxonomy( 'audience' ) )->singular_name, 5 'terms' => get_terms( array( 'taxonomy' => 'audience' ) ), 4 'label' => get_taxonomy_labels( get_taxonomy( 'audience' ) )->singular_name, 5 'terms' => get_terms( array( 'taxonomy' => 'audience' ) ), 6 'name' => 'audience', 7 'current' => filter_input( INPUT_GET, 'audience', FILTER_VALIDATE_INT, FILTER_REQUIRE_ARRAY ) ?? array(), 6 8 ), 7 9 array( 8 'label' => get_taxonomy_labels( get_taxonomy( 'duration' ) )->singular_name, 9 'terms' => get_terms( array( 'taxonomy' => 'duration' ) ), 10 'label' => get_taxonomy_labels( get_taxonomy( 'duration' ) )->singular_name, 11 'terms' => get_terms( array( 'taxonomy' => 'duration' ) ), 12 'name' => 'duration', 13 'current' => filter_input( INPUT_GET, 'duration', FILTER_VALIDATE_INT, FILTER_REQUIRE_ARRAY ) ?? array(), 10 14 ), 11 15 array( 12 'label' => get_taxonomy_labels( get_taxonomy( 'instruction_type' ) )->singular_name, 13 'terms' => get_terms( array( 'taxonomy' => 'instruction_type' ) ), 16 'label' => get_taxonomy_labels( get_taxonomy( 'level' ) )->singular_name, 17 'terms' => get_terms( array( 'taxonomy' => 'level' ) ), 18 'name' => 'level', 19 'current' => filter_input( INPUT_GET, 'level', FILTER_VALIDATE_INT, FILTER_REQUIRE_ARRAY ) ?? array(), 14 20 ), 15 21 array( 16 'label' => get_taxonomy_labels( get_taxonomy( 'level' ) )->singular_name, 17 'terms' => get_terms( array( 'taxonomy' => 'level' ) ), 22 'label' => get_taxonomy_labels( get_taxonomy( 'instruction_type' ) )->singular_name, 23 'terms' => get_terms( array( 'taxonomy' => 'instruction_type' ) ), 24 'name' => 'type', 25 'current' => filter_input( INPUT_GET, 'type', FILTER_VALIDATE_INT, FILTER_REQUIRE_ARRAY ) ?? array(), 18 26 ), 19 27 ); 20 21 $current_term = get_query_var( 'term' );22 28 ?> 23 29 24 < div class="lesson-plan-filters col-3">30 <form class="sidebar-filters col-3" method="get" action="<?php echo esc_url( get_post_type_archive_link( 'lesson-plan' ) ); ?>"> 25 31 <h3 class="h4"><?php esc_html_e( 'Filter Lesson Plans', 'wporg-learn' ); ?></h3> 32 33 <div class="filter-buttons"> 34 <button type="submit" class="button button-large button-secondary"> 35 <?php esc_html_e( 'Apply Filters', 'wporg-learn' ); ?> 36 </button> 37 <a href="<?php echo esc_url( get_post_type_archive_link( 'lesson-plan' ) ); ?>" class="clear-filters"> 38 <?php esc_html_e( 'Clear All Filters', 'wporg-learn' ); ?> 39 </a> 40 </div> 26 41 27 42 <?php foreach ( $taxonomies as $txnmy ) : ?> … … 30 45 <?php foreach ( $txnmy['terms'] as $trm ) : ?> 31 46 <li> 32 <a 33 href="<?php echo esc_url( get_term_link( $trm->term_id ) ); ?>" 34 class="<?php echo ( $trm->slug === $current_term ) ? 'current' : ''; ?>" 35 > 47 <label for="<?php echo esc_attr( "{$trm->term_id}-{$trm->slug}" ); ?>"> 48 <input 49 id="<?php echo esc_attr( "{$trm->term_id}-{$trm->slug}" ); ?>" 50 type="checkbox" 51 name="<?php echo esc_attr( $txnmy['name'] ); ?>[]" 52 value="<?php echo esc_attr( $trm->term_id ); ?>" 53 <?php checked( in_array( $trm->term_id, $txnmy['current'], true ) ); ?> 54 /> 36 55 <?php echo esc_html( $trm->name ); ?> 37 </ a>56 </label> 38 57 </li> 39 58 <?php endforeach; ?> 40 59 </ul> 41 60 <?php endforeach; ?> 42 </ div>61 </form>
Note: See TracChangeset
for help on using the changeset viewer.