ليس لدى هذا المستخدم أي مواضيع مفضلة.
مواضيع المنتدى المفضلة
مواضيع المنتدى التي تم إنشاؤها
الحالة |
الموضوع
|
داعم | الأصوات | المشاركات | الحداثة |
---|---|---|---|---|---|
Compatibility issue with the events calendar
1
2
بدأه: arianeF-2
في: English Support
Problem: Solution: functions.php file: /*<br />* WPML Workaround for compsupp-6815 (updated version for compsupp-7184)<br />*/<br />add_filter( 'tribe_rewrite_canonical_url', 'wpml_compsupp6815_resolve_missing_urls', 10, 3 );<br /><br />function wpml_compsupp6815_resolve_missing_urls( $resolved, $url, $object ) {<br /><br /> if ( class_exists('Sitepress') ) {<br /> $wpml_default_lang = apply_filters('wpml_default_language', NULL );<br /> $wpml_current_lang = apply_filters( 'wpml_current_language', NULL );<br /> <br /> // Let's register the calendar strings so we can translate and use in the workaround<br /> if ($wpml_default_lang == $wpml_current_lang ) {<br /><br /> $tec_options = get_option('tribe_events_calendar_options'); <br /> $events_slug = $tec_options['eventsSlug']; <br /> $single_events_slug = $tec_options['singleEventSlug']; <br /> <br /> do_action( 'wpml_register_single_string', 'the-events-calendar', 'TEC Calendar Slugs: '.substr($events_slug, 0, 20), $events_slug);<br /> do_action( 'wpml_register_single_string', 'the-events-calendar', 'TEC Calendar Slugs: '.substr($single_events_slug, 0, 20), $single_events_slug );<br /> <br /> foreach ($tec_options['tribeEnableViews'] as $calendar_string) {<br /> do_action( 'wpml_register_single_string', 'the-events-calendar', 'TEC Calendar Slugs: '.substr($calendar_string, 0, 20), $calendar_string);<br /> }<br /> }<br /> <br /> // Check if the URL is not resolved yet. If not, we will resolve it with the translated strings<br /> if ( preg_match( '#\(/\?\:([^)]+)\)#', $resolved ) ) {<br /> <br /> $resolved = preg_replace_callback( '#\(/\?\:([^)]+)\)#', function($matches) use ($url) {<br /> $options = explode('|', trim($matches[0], '/(?:)'));<br /> <br /> $slug = $options[0]; <br /> <br /> $translated_slug = apply_filters('wpml_translate_single_string', $slug , 'the-events-calendar', 'TEC Calendar Slugs: '.substr($slug, 0, 20) );<br /> <br /> // Only apply the translation if the string already exists in the URL. If not, replace with the original. This may avoid possible 404 errors<br /> if (in_array(strtolower($translated_slug), $options) && $translated_slug != '') {<br /> $slug = $translated_slug;<br /> } <br /> <br /> return $slug;<br /> <br /> }, $resolved );<br /><br /> // Check if there are parameters in the final result and correct the first "&" to "?"<br /> if (strpos($resolved, '&') !== false && strpos($resolved, '?') === false) {<br /> $resolved = preg_replace('/&/', '?', $resolved, 1);<br /> }<br /> }<br /> }<br /> <br /> return $resolved;<br />}<br /> After adding the code, navigate to Settings > Permalinks and re-save the settings. If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we encourage you to open a new support ticket. We also highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. |
|
2 | 22 | قبل 1 سنة، 5 أشهر | |
Compatibility issue with the events calendar
بدأه: arianeF-2 في: Chat Support |
|
1 | 2 |
قبل 1 سنة، 7 أشهر
|