| @@ -11,23 +11,30 @@ | ||
| 11 | 11 | |
| 12 | 12 | if ( ! defined('ABSPATH') ) { |
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | -global $chips_count; | |
| 16 | -// Iterate global chips widget count | |
| 15 | +// Unique index of this chips list on the page | |
| 16 | +$chips_count = \FilterEverything\Filter\Container::instance()->getFilterContext()->nextChipsIndex(); | |
| 17 | 17 | $selected_and_above_status = (isset($filter['selected_and_above']) && $filter['selected_and_above'] === 'yes') ? true : false; |
| 18 | -$chips_count++; | |
| 19 | 18 | ?> |
| 20 | 19 | <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 | 20 | <?php if( $chips ) : ?> |
| 22 | 21 | <?php foreach( $chips as $chip ): ?> |
| 23 | - <li class="wpc-filter-chip <?php echo esc_attr( $chip['class'] ); ?>"><a href="<?php echo esc_url( $chip['link'] ); ?>" title="<?php if( $chip['name'] !== esc_html__('Reset all', 'filter-everything') ){ | |
| 22 | + <?php | |
| 23 | + // Smart spans: a chip whose removal target is not indexable must | |
| 24 | + // not expose a crawlable link (missing 'crawlable' means a link) | |
| 25 | + $chip_is_link = ! isset( $chip['crawlable'] ) || $chip['crawlable']; | |
| 26 | + $chip_tag = $chip_is_link ? 'a' : 'span'; | |
| 27 | + $chip_link_att = $chip_is_link ? 'href' : 'data-wpc-span-link'; | |
| 28 | + ?> | |
| 29 | + <li class="wpc-filter-chip <?php echo esc_attr( $chip['class'] ); ?>"> | |
| 30 | + <<?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') ){ | |
| 24 | 31 | if ( $chip['class'] === 'wpc-chip-search' ) { |
| 25 | 32 | echo esc_attr( sprintf( __('Remove %s from results', 'filter-everything'), '«'.$chip['label'].'»' ) ); |
| 26 | 33 | } else { |
| 27 | 34 | echo esc_attr( sprintf( __('Remove %s from results', 'filter-everything'), '«'.$chip['label'] .': '.$chip['name'].'»' ) ); |
| 28 | 35 | } |
| 29 | - } ?>"><span class="wpc-chip-content"><?php if(isset($chip['rating'])) : ?><span class="wpc-chip-stars"><?php | |
| 36 | + } ?>"<?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 | |
| 30 | 37 | for ($i = 1; $i <= $chip['rating']; $i++){ |
| 31 | 38 | echo '<span>' . flrt_rating_star() . '</span>'; |
| 32 | 39 | } |
| 33 | 40 | ?></span><?php |
| @@ -33,8 +40,8 @@ | ||
| 33 | 40 | ?></span><?php |
| 34 | 41 | else : |
| 35 | 42 | ?><span class="wpc-filter-chip-name"><?php echo esc_html( $chip['name'] ); ?></span><?php |
| 36 | 43 | endif; |
| 37 | - ?><span class="wpc-chip-remove-icon">×</span></a></span></li> | |
| 44 | + ?><span class="wpc-chip-remove-icon">×</span></span></<?php echo $chip_tag; ?>></li> | |
| 38 | 45 | <?php endforeach; ?> |
| 39 | 46 | <?php endif; ?> |
| 40 | 47 | </ul> |