| 1 |
<?php |
| 2 |
/** |
| 3 |
* The Template for displaying filter selected terms. |
| 4 |
* |
| 5 |
* This template can be overridden by copying it to yourtheme/filters/chips.php. |
| 6 |
* |
| 7 |
* $chips - array, with the Filter Set parameters |
| 8 |
* |
| 9 |
* @see https://filtereverything.pro/resources/templates-overriding/ |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined('ABSPATH') ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
global $chips_count; |
| 16 |
// Iterate global chips widget count |
| 17 |
$selected_and_above_status = (isset($filter['selected_and_above']) && $filter['selected_and_above'] === 'yes') ? true : false; |
| 18 |
$chips_count++; |
| 19 |
?> |
| 20 |
<ul class="wpc-filter-chips-list wpc-filter-chips-<?php echo esc_attr( $setid .'-' .$chips_count ); ?> wpc-filter-chips-<?php echo esc_attr( $setid ); ?><?php if( ! $chips ){echo ' wpc-empty-chips-container';} ?>" data-set="<?php echo esc_attr( $setid ); ?>" data-setcount="<?php echo $setid .'-' .$chips_count ; ?>"> |
| 21 |
<?php if( $chips ) : ?> |
| 22 |
<?php foreach( $chips as $chip ): ?> |
| 23 |
<?php |
| 24 |
// Smart spans: a chip whose removal target is not indexable must |
| 25 |
// not expose a crawlable link (missing 'crawlable' means a link) |
| 26 |
$chip_is_link = ! isset( $chip['crawlable'] ) || $chip['crawlable']; |
| 27 |
$chip_tag = $chip_is_link ? 'a' : 'span'; |
| 28 |
$chip_link_att = $chip_is_link ? 'href' : 'data-wpc-span-link'; |
| 29 |
?> |
| 30 |
<li class="wpc-filter-chip <?php echo esc_attr( $chip['class'] ); ?>"> |
| 31 |
<<?php echo $chip_tag; ?> <?php echo $chip_link_att; ?>="<?php echo esc_url( $chip['link'] ); ?>" <?php echo (!empty($chip['link_class'])) ? 'class="' . $chip['link_class'] . '"' : ''; ?> title="<?php if( $chip['name'] !== esc_html__('Reset all', 'filter-everything') ){ |
| 32 |
if ( $chip['class'] === 'wpc-chip-search' ) { |
| 33 |
echo esc_attr( sprintf( __('Remove %s from results', 'filter-everything'), '«'.$chip['label'].'»' ) ); |
| 34 |
} else { |
| 35 |
echo esc_attr( sprintf( __('Remove %s from results', 'filter-everything'), '«'.$chip['label'] .': '.$chip['name'].'»' ) ); |
| 36 |
} |
| 37 |
} ?>"<?php echo (!empty($chip['e_name'])) ? ' data-wpc-e-name="' . $chip['e_name'] . '"' : ''; ?><?php echo (!empty($chip['slug'])) ? ' data-wpc-slug="' . $chip['slug'] . '"' : ''; ?>><span class="wpc-chip-content"><?php if(isset($chip['rating'])) : ?><span class="wpc-chip-stars"><?php |
| 38 |
for ($i = 1; $i <= $chip['rating']; $i++){ |
| 39 |
echo '<span>' . flrt_rating_star() . '</span>'; |
| 40 |
} |
| 41 |
?></span><?php |
| 42 |
else : |
| 43 |
?><span class="wpc-filter-chip-name"><?php echo esc_html( $chip['name'] ); ?></span><?php |
| 44 |
endif; |
| 45 |
?><span class="wpc-chip-remove-icon">×</span></span></<?php echo $chip_tag; ?>></li> |
| 46 |
<?php endforeach; ?> |
| 47 |
<?php endif; ?> |
| 48 |
</ul> |