למשתמש זה אין נושאים מועדפים.
נושאי הפורום המועדפים
נושאי הפורום נוצרו
מצב |
נוֹשֵׂא
|
תוֹמֵך | קולות | פוסטים | טְרִיוּת |
---|---|---|---|---|---|
Taxonomy translation access for Editor role
התחיל על ידי: johnH-55 ב: Chat Support |
1 | 2 | לפני 5 ימים | ||
WPML String Translation Version 3.2.14 at our website is , while at WPML v 3.2.15 available., same w…
התחיל על ידי: johnH-55 ב: Chat Support |
0 | 2 | לפני חודש 1, 3 שבועות | ||
I need to retrieve posts in different language than current
התחיל על ידי: johnH-55
ב: English Support
Problem: get_terms function returns terms from all WPML languages instead of just the desired one. get_terms returns terms only for the desired WPML language, follow these steps: do_action('wpml_switch_language', $language_code) function to switch to the desired language. get_terms call to filter by the desired language using apply_filters('wpml_object_id', $term->term_id, 'category', true, $language_code) . function get_terms_for_language($taxonomy, $language_code) {<br /> if (function_exists('apply_filters')) {<br /> do_action('wpml_switch_language', $language_code);<br /> $terms = get_terms(array(<br /> 'taxonomy' => $taxonomy,<br /> 'hide_empty' => false,<br /> ));<br /> $filtered_terms = array();<br /> foreach ($terms as $term) {<br /> $translated_term_id = apply_filters('wpml_object_id', $term->term_id, $taxonomy, true, $language_code);<br /> if ($translated_term_id) {<br /> $translated_term = get_term($translated_term_id, $taxonomy);<br /> if ($translated_term) {<br /> $filtered_terms[] = $translated_term;<br /> }<br /> }<br /> }<br /> return $filtered_terms;<br /> } else {<br /> return get_terms(array(<br /> 'taxonomy' => $taxonomy,<br /> 'hide_empty' => false,<br /> ));<br /> }<br />}<br /><br />// Example usage<br />$site_id = 2; // en-CA site<br />$locale = 'en_CA';<br />$taxonomy = 'category'; // Example taxonomy<br />$language_code = 'en';<br /><br />switch_to_blog($site_id);<br />switch_to_locale($locale);<br /><br />$terms = get_terms_for_language($taxonomy, $language_code);<br /><br />restore_current_blog(); For further details, refer to the WPML documentation. If this solution does not apply to your case, or if it seems outdated, we 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. If further assistance is needed, please open a new support ticket at our support forum. |
2 | 2 | לפני 5 חודשים, 3 שבועות | ||
WPML chat support ticket by johnH-55 – 1714750198
התחיל על ידי: johnH-55 ב: Chat Support |
1 | 2 |
לפני 8 חודשים, שבוע 1
|
||
WPML chat support ticket by johnH-55 – 1713546785
התחיל על ידי: johnH-55 ב: Chat Support |
1 | 2 |
לפני 8 חודשים, 3 שבועות
|
||
Menu sync not working correctly
התחיל על ידי: johnH-55 ב: English Support |
1 | 2 |
לפני 8 חודשים, 3 שבועות
|