| @@ -121,14 +121,16 @@ | ||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // For All Post type archive pages |
| 124 | 124 | if (isset($theSet['post_name']['value']) && $theSet['post_name']['value'] === '1' && $query_to_check->is_main_query()) { |
| 125 | - if( isset( $theSet['use_apply_button']['value'] ) && $theSet['use_apply_button']['value'] === 'yes' ){ | |
| 125 | + /* if( isset( $theSet['use_apply_button']['value'] ) && $theSet['use_apply_button']['value'] === 'yes' ){ | |
| 126 | 126 | continue; |
| 127 | 127 | }else{ |
| 128 | 128 | $result[] = $set['ID']; |
| 129 | 129 | break; |
| 130 | - } | |
| 130 | + }*/ | |
| 131 | + $result[] = $set['ID']; | |
| 132 | + break; | |
| 131 | 133 | } |
| 132 | 134 | } |
| 133 | 135 | } |
| 134 | 136 | } |
| @@ -324,10 +326,33 @@ | ||
| 324 | 326 | |
| 325 | 327 | $wpPageType = isset( $unserialized['wp_page_type'] ) ? $unserialized['wp_page_type'] : $this->detectWpPageTypeByLocation( $set_post->post_name ); |
| 326 | 328 | $applyButtonPageType = isset( $unserialized['apply_button_page_type'] ) ? $unserialized['apply_button_page_type'] : 'no_page___no_page'; |
| 327 | 329 | |
| 330 | + // Location preview URLs (option 'data-link') are language-sensitive under Polylang: | |
| 331 | + // flrt_get_common_location_terms() resolves the language from the global $post_id. | |
| 332 | + // On the edit screen post.php sets that global, but the Filter Set list table does | |
| 333 | + // not — so previews there lost their language prefix (e.g. /shop/ instead of | |
| 334 | + // /en/shop/). Anchor the global to this set's own post while the options are built | |
| 335 | + // so both screens agree. An AJAX $_POST['postId'] still takes priority inside | |
| 336 | + // flrt_get_common_location_terms(). | |
| 337 | + $flrt_had_global_post_id = array_key_exists( 'post_id', $GLOBALS ); | |
| 338 | + $flrt_prev_global_post_id = $flrt_had_global_post_id ? $GLOBALS['post_id'] : null; | |
| 339 | + if ( is_object( $set_post ) && ! empty( $set_post->ID ) ) { | |
| 340 | + $GLOBALS['post_id'] = $set_post->ID; | |
| 341 | + } | |
| 342 | + | |
| 328 | 343 | $defaults['post_name']['options'] = flrt_get_set_location_terms( $wpPageType, $postType ); |
| 329 | - $defaults['apply_button_post_name']['options'] = flrt_get_set_location_terms( $applyButtonPageType, $postType, false ); | |
| 344 | + | |
| 345 | + // The field is defined in PRO only — don't create a value-less stub of it in the free version | |
| 346 | + if ( isset( $defaults['apply_button_post_name'] ) ) { | |
| 347 | + $defaults['apply_button_post_name']['options'] = flrt_get_set_location_terms( $applyButtonPageType, $postType, false ); | |
| 348 | + } | |
| 349 | + | |
| 350 | + if ( $flrt_had_global_post_id ) { | |
| 351 | + $GLOBALS['post_id'] = $flrt_prev_global_post_id; | |
| 352 | + } else { | |
| 353 | + unset( $GLOBALS['post_id'] ); | |
| 354 | + } | |
| 330 | 355 | |
| 331 | 356 | return $defaults; |
| 332 | 357 | } |
| 333 | 358 | |