PluginProbe
Filter Everything — WordPress & WooCommerce Filters / 1.5.1
Filter Everything — WordPress & WooCommerce Filters v1.5.1
1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2.2 1.9.2.1 trunk 1.2.1 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.1 1.4.4 1.4.5 1.4.8 1.4.9 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 All 52 releases
filter-everything / views / frontend / labels.php

labels.php in Filter Everything — WordPress & WooCommerce Filters 1.5.1, at views/frontend/labels.php

76 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The Template for displaying filter labels.
4 *
5 * This template can be overridden by copying it to yourtheme/filter/labels.php.
6 *
7 * $set - array, with the Filter Set parameters
8 * $filter - array, with the Filter parameters
9 * $url_manager - object, of the UrlManager PHP class
10 * $terms - array, with objects of all filter terms except excluded
11 *
12 * @see https://filtereverything.pro/resources/templates-overriding/
13 */
14
15 if ( ! defined('WPINC') ) {
16 wp_die();
17 }
18
19 ?>
20 <div class="<?php echo flrt_filter_class( $filter ); // Already escaped ?>" data-fid="<?php echo esc_attr( $filter['ID'] ); ?>">
21 <?php flrt_filter_header( $filter, $terms ); // Safe, escaped ?>
22 <div class="<?php echo esc_attr( flrt_filter_content_class( $filter ) ); ?>">
23 <?php if( $filter['search'] === 'yes' ): ?>
24 <div class="wpc-filter-search-wrapper wpc-filter-search-wrapper-<?php echo esc_attr( $filter['ID'] ); ?>">
25 <input class="wpc-filter-search-field" type="text" value="" placeholder="<?php esc_html_e('Search', 'filter-everything' ) ?>" />
26 <button class="wpc-search-clear" type="button" title="<?php esc_html_e('Clear search', 'filter-everything' ) ?>"><span class="wpc-search-clear-icon">&#215;</span></button>
27 </div>
28 <?php endif; ?>
29 <ul class="wpc-filters-ul-list wpc-filters-labels wpc-filters-list-<?php echo esc_attr( $filter['ID'] ); ?>">
30 <?php if( ! empty( $terms ) ):
31 //$set_for_urlManager = isset( $set['ID'] ) ? array( array('ID' => $set['ID'] ) ) : [];
32 ?>
33
34 <?php foreach ( $terms as $id => $term_object ){
35
36 $checked = ( in_array( $term_object->slug, $filter['values'] ) ) ? 1 : 0;
37 $active_class = $checked ? ' wpc-term-selected' : '';
38 $link = $url_manager->getTermUrl( $term_object->slug, $filter['e_name'] /*, $set_for_urlManager */);
39 $link_attributes = 'href="'.esc_url($link).'"';
40
41 ?>
42 <li class="wpc-label-item wpc-term-item<?php echo esc_attr( $active_class ); ?> wpc-term-count-<?php echo esc_attr( $term_object->cross_count ); ?> wpc-term-id-<?php echo esc_attr( $id ); ?>" id="<?php flrt_term_id('term', $filter, $id ); ?>">
43 <div class="wpc-term-item-content-wrapper">
44 <input class="wpc-label-input" <?php checked( 1, $checked ); ?> type="checkbox" data-wpc-link="<?php echo esc_url( $link ); ?>" id="<?php flrt_term_id('checkbox', $filter, $id); ?>" />
45 <label for="<?php flrt_term_id('checkbox', $filter, $id); ?>">
46 <span class="wpc-filter-label-wrapper">
47 <?php
48 /**
49 * Allow developers to change filter terms html
50 */
51 echo apply_filters( 'wpc_filters_label_term_html', '<a '.$link_attributes.'>'.$term_object->name.'</a>', $link_attributes, $term_object, $filter );
52
53 ?>&nbsp;<?php flrt_count( $term_object, $set['show_count']['value'] ); // Safe, escaped?>
54 </span>
55 </label>
56 </div>
57 </li>
58 <?php } ?><!-- end foreach -->
59
60 <?php else:
61 if( ! flrt_is_filter_request() ){
62 ?><li><?php esc_html_e('There are no terms yet', 'filter-everything' );
63 if( flrt_is_debug_mode() ){
64 echo '&nbsp;'.flrt_help_tip(
65 esc_html__('Possible reasons: 1) Filter\'s criteria doesn\'t contain any terms yet and you have to add them 2) Terms may be created, but no one post that should be filtered attached to these terms 3) You excluded all possible terms in Filter\'s options.', 'filter-everything')
66 );
67 }
68 ?></li><?php
69 }else{
70 esc_html_e('N/A', 'filter-everything' );
71 }
72 ?>
73 <?php endif; ?><!-- end if -->
74 </ul>
75 </div>
76 </div>