| @@ -15,8 +15,16 @@ | ||
| 15 | 15 | $horizontal_view = false; |
| 16 | 16 | if(!empty($set['horizontal_view']['value']) && $set['horizontal_view']['value'] === 'yes'){ |
| 17 | 17 | $horizontal_view = true; |
| 18 | 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 : ''; | |
| 19 | 27 | $term_count_hidden_class = ''; |
| 20 | 28 | if(empty($is_filter_request) && !$is_filter_request){ |
| 21 | 29 | $term_count_hidden_class .= ' wpc-hidden-term-count'; |
| 22 | 30 | } |
| @@ -25,13 +33,14 @@ | ||
| 25 | 33 | } |
| 26 | 34 | ?> |
| 27 | 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'; ?>"> |
| 28 | 36 | <div class="wpc-sticky-buttons"> |
| 29 | - <a class="wpc-filters-submit-button" href="<?php echo esc_url( $apply_url ); ?>"><?php | |
| 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 | |
| 30 | 39 | $button_text = isset( $set['apply_button_text']['value'] ) ? esc_html( $set['apply_button_text']['value'] ) : esc_html__('Show', 'filter-everything'); |
| 31 | 40 | echo $button_text . "<span class='wpc-pc-apply-button " . $term_count_hidden_class . "'>(" . esc_html($found_posts) . ")</span>"; |
| 32 | 41 | ?></a> |
| 33 | - <a class="wpc-filters-reset-button" href="<?php echo esc_attr( $reset_url ) ?>"><?php | |
| 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 | |
| 34 | 43 | $reset_button_text = isset( $set['reset_button_text']['value'] ) ? esc_html( $set['reset_button_text']['value'] ) : esc_html__('Reset', 'filter-everything'); |
| 35 | 44 | echo $reset_button_text; |
| 36 | 45 | ?></a> |
| 37 | 46 | </div> |