| 1 |
<?php |
| 2 |
/** |
| 3 |
* The Template for displaying Apply button. |
| 4 |
* |
| 5 |
* This template can be overridden by copying it to yourtheme/filters/apply-button.php. |
| 6 |
* |
| 7 |
* @see https://filtereverything.pro/resources/templates-overriding/ |
| 8 |
*/ |
| 9 |
|
| 10 |
if ( ! defined('ABSPATH') ) { |
| 11 |
exit; |
| 12 |
} |
| 13 |
|
| 14 |
$set_id = isset( $set['ID'] ) ? esc_html( $set['ID'] ) : 0; |
| 15 |
$horizontal_view = false; |
| 16 |
if(!empty($set['horizontal_view']['value']) && $set['horizontal_view']['value'] === 'yes'){ |
| 17 |
$horizontal_view = true; |
| 18 |
} |
| 19 |
$apply_button_page_type = false; |
| 20 |
if(!empty($set['apply_button_page_type']['value']) && $set['apply_button_page_type']['value'] !== 'no_page___no_page'){ |
| 21 |
$apply_button_page_type = true; |
| 22 |
} |
| 23 |
// Clean permalink of the Apply button location, WITHOUT the current filter |
| 24 |
// segments. The JS appends the freshly selected segments to this base — using |
| 25 |
// $apply_url for that duplicated the segments already present in the page URL. |
| 26 |
$apply_base_url = isset( $apply_base_url ) ? $apply_base_url : ''; |
| 27 |
$term_count_hidden_class = ''; |
| 28 |
if(empty($is_filter_request) && !$is_filter_request){ |
| 29 |
$term_count_hidden_class .= ' wpc-hidden-term-count'; |
| 30 |
} |
| 31 |
if (empty($found_posts)){ |
| 32 |
$found_posts = 0; |
| 33 |
} |
| 34 |
?> |
| 35 |
<div class="wpc-filters-section wpc-filters-section-<?php echo $set_id; ?> wpc-filter-layout-submit-button <?php echo $horizontal_view ? '' : 'wpc-pc-sticky-buttons'; ?>"> |
| 36 |
<div class="wpc-sticky-buttons"> |
| 37 |
<a class="wpc-filters-submit-button" href="<?php echo esc_url( $apply_url ); ?>" data-wpc-apply-url="<?php echo esc_url( $apply_url ); ?>" data-wpc-apply-base-url="<?php echo esc_url( $apply_base_url ); ?>" data-apply-button-page="<?php echo esc_attr( $apply_button_page_type ) ?>"> |
| 38 |
<?php |
| 39 |
$button_text = isset( $set['apply_button_text']['value'] ) ? esc_html( $set['apply_button_text']['value'] ) : esc_html__('Show', 'filter-everything'); |
| 40 |
echo $button_text . "<span class='wpc-pc-apply-button " . $term_count_hidden_class . "'>(" . esc_html($found_posts) . ")</span>"; |
| 41 |
?></a> |
| 42 |
<a class="wpc-filters-reset-button wpc-filters-reset-button-<?php echo $set_id; ?>" href="<?php echo esc_attr( $reset_url ) ?>" data-wpc-apply-reset-url="<?php echo esc_url( $reset_url ); ?>"><?php |
| 43 |
$reset_button_text = isset( $set['reset_button_text']['value'] ) ? esc_html( $set['reset_button_text']['value'] ) : esc_html__('Reset', 'filter-everything'); |
| 44 |
echo $reset_button_text; |
| 45 |
?></a> |
| 46 |
</div> |
| 47 |
</div> |
| 48 |
|