|
3 | 3 | * Plugin Name: Dokan - WPML Integration
|
4 | 4 | * Plugin URI: https://wedevs.com/
|
5 | 5 | * Description: WPML and Dokan compatible package
|
6 |
| - * Version: 1.0.8 |
| 6 | + * Version: 1.0.9 |
7 | 7 | * Author: weDevs
|
8 | 8 | * Author URI: https://wedevs.com/
|
9 | 9 | * Text Domain: dokan-wpml
|
10 | 10 | * WC requires at least: 5.5.0
|
11 |
| - * WC tested up to: 7.7.2 |
| 11 | + * WC tested up to: 8.2.2 |
12 | 12 | * Domain Path: /languages/
|
13 | 13 | * License: GPL2
|
14 | 14 | */
|
@@ -120,6 +120,7 @@ public function plugins_loaded() {
|
120 | 120 | add_filter( 'dokan_get_navigation_url', [ $this, 'load_translated_url' ], 10, 2 );
|
121 | 121 | add_filter( 'body_class', [ $this, 'add_dashboard_template_class_if_wpml' ], 99 );
|
122 | 122 | add_filter( 'dokan_get_current_page_id', [ $this, 'dokan_set_current_page_id' ] );
|
| 123 | + add_filter( 'dokan_get_translated_page_id', [ $this, 'dokan_get_translated_page_id' ] ); |
123 | 124 | add_filter( 'dokan_get_dashboard_nav', [ $this, 'replace_dokan_dashboard_nav_key' ] );
|
124 | 125 | add_action( 'wp_head', [ $this, 'dokan_wpml_remove_fix_fallback_links' ] );
|
125 | 126 |
|
@@ -467,6 +468,23 @@ public function dokan_set_current_page_id( $page_id ) {
|
467 | 468 | return wpml_object_id_filter( $page_id, 'page', true, wpml_get_default_language() );
|
468 | 469 | }
|
469 | 470 |
|
| 471 | + /** |
| 472 | + * Dokan get translated page id. |
| 473 | + * |
| 474 | + * @since 1.0.9 |
| 475 | + * |
| 476 | + * @param int $page_id Page ID to be translated. |
| 477 | + * |
| 478 | + * @return int |
| 479 | + */ |
| 480 | + public function dokan_get_translated_page_id( $page_id ) { |
| 481 | + if ( ! function_exists( 'wpml_object_id_filter' ) ) { |
| 482 | + return $page_id; |
| 483 | + } |
| 484 | + |
| 485 | + return wpml_object_id_filter( $page_id, 'page', true, ICL_LANGUAGE_CODE ); |
| 486 | + } |
| 487 | + |
470 | 488 | /**
|
471 | 489 | * Get raw value from database
|
472 | 490 | *
|
|
0 commit comments