ليس لدى هذا المستخدم أي مواضيع مفضلة.
مواضيع المنتدى المفضلة
مواضيع المنتدى التي تم إنشاؤها
| الحالة |
الموضوع
|
داعم | الأصوات | المشاركات | الحداثة |
|---|---|---|---|---|---|
|
Split: JetEngine Post Types and WYSIWYG field issue
بدأه: dimitriosV-4 في: English Support |
|
0 | 2 | قبل 4 أشهر | |
|
Translate Jet Engine Post Types and listings
1
2
بدأه: dimitriosV-4
في: English Support
Problem: Solution: add_filter(
'theme_mod_jupiterx_house_single_template',
'wpml_translate_house_single_template',
10,
1
);
function wpml_translate_house_single_template( $value ) {
$value = apply_filters( 'wpml_object_id', $value, 'post_elementor_library' );
}3. Save the changes and refresh a product page to see the translation. /**
* Translate associative KEYS for JetEngine 'features' post meta via WPML.
* Place in wp-content/mu-plugins/jetengine-features-wpml.php (recommended) or your theme's functions.php.
*/
add_filter( 'jet-engine/listing/data/get-post-meta', 'myproject_translate_features_keys_wpml', 10, 3 );
/**
* @param mixed $value The meta value resolved by JetEngine (array for 'features').
* @param string $key Meta key (we only act on 'features').
* @param int $object_id Post ID.
*
* @return mixed
*/
function myproject_translate_features_keys_wpml( $value, $key, $object_id ) {
// Only handle the 'features' field and only if it's an associative array like ['Pet-Friendly' => 'true', ...].
if ( $key !== 'features' || ! is_array( $value ) ) {
return $value;
}
// Determine current language (WPML). If WPML is missing, calls below no-op and return originals.
$lang = apply_filters( 'wpml_current_language', null );
if ( empty( $lang ) && defined( 'ICL_LANGUAGE_CODE' ) ) {
$lang = ICL_LANGUAGE_CODE;
}
$context = 'Jet Engine Admin Labels';
// Small request-level cache to avoid re-translating the same labels repeatedly.
static $cache = [];
$translated = [];
foreach ( $value as $label => $flag ) {
$label_str = (string) $label;
$name = md5( $label_str ); // stable key as you requested
$ck = $context . '|' . $name . '|' . (string) $lang;
if ( isset( $cache[ $ck ] ) ) {
$new_label = $cache[ $ck ];
} else {
// Register (idempotent) so translators can provide translations in WPML String Translation.
do_action( 'wpml_register_single_string', $context, $name, $label_str );
// Translate. If WPML inactive or no translation yet, this returns the original.
$new_label = apply_filters( 'wpml_translate_single_string', $label_str, $context, $name, $lang );
if ( ! is_string( $new_label ) || $new_label === '' ) {
$new_label = $label_str;
}
$cache[ $ck ] = $new_label;
}
// Keep the same value ('true'/'false') as stored; do NOT coerce unless you want to.
$translated[ $new_label ] = $flag;
}
return $translated;
}
5. Save the changes. If this solution does not resolve your issue or seems outdated, please check for related known issues at https://wpml.org/known-issues/, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. If the problem persists, we recommend opening a new support ticket at WPML support forum. |
|
1 | 31 | قبل 4 أشهر | |
|
Split: How do I show the english version of footer? Because now it keeps showing the greek one.
بدأه: dimitriosV-4 في: English Support |
|
2 | 10 | قبل سنتين، 5 أشهر | |
|
Use different font on different language
بدأه: dimitriosV-4 في: English Support |
|
3 | 4 |
قبل سنتين، 5 أشهر
dimitriosV-4 |