Languages: English (English )German (Deutsch )French (Français )
Timezone: Europe/Zagreb (GMT+02:00)
We found that this depends upon _generate_element_display_conditions, _generate_element_exclude_conditions, and _generate_hook that should be set as "copy-once."
To have this working with automatic translation and synchronization, we recommend the following steps:
1. **Change Field Settings:**
- Modify the settings of _generate_element_display_conditions, _generate_element_exclude_conditions, and _generate_hook to "copy" instead of "copy-once."
2. **Code Modification:**
- Open the file `wp-content/plugins/gp-premium/elements/class-conditions.php`.
- Locate the `show_data()` function around line 314.
- Replace:
[php]public static function show_data( $conditionals, $exclude, $roles ) {
$current_location = self::get_current_location();
$show = false;
// Show depending on location conditionals.
if ( ! $show ) {
with:
public static function show_data( $conditionals, $exclude, $roles ) {
$current_location = self::get_current_location();
$show = false;
// WPMl Workaround for compsupp-7109
if ( class_exists('Sitepress') ) {
// Conditionals
foreach ((array) $conditionals as $key => $conditional) {
if (isset( $conditional['object'] ) && ! empty( $conditional['object'] && is_numeric($conditional['object']) )) {
// If ID is a post
if (get_post_status( $conditional['object'] ) ) {
$post_type = get_post_type($conditional['object']);
$conditionals[$key]['object'] = apply_filters( 'wpml_object_id', $conditional['object'], $post_type , TRUE );
}
// If ID is a term
elseif (get_term($conditional['object'])) {
// Terms are automatically translated when using get_term;
$term = get_term($conditional['object']);
$conditionals[$key]['object'] = $term->term_id;
}
}
}
// Exclude conditions
foreach ((array) $exclude as $key => $conditional) {
// Same logic for $exclude, it would be better to have a separate function for that, but I want to simplify the workaround steps
if (isset( $conditional['object'] ) && ! empty( $conditional['object'] && is_numeric($conditional['object']) )) {
// If ID is a post
if (get_post_status( $conditional['object'] ) ) {
$post_type = get_post_type($conditional['object']);
$exclude[$key]['object'] = apply_filters( 'wpml_object_id', $conditional['object'], $post_type , TRUE );
}
// If ID is a term
elseif (get_term($conditional['object'])) {
// Terms are automatically translated when using get_term;
$term = get_term($conditional['object']);
$exclude[$key]['object'] = $term->term_id;
}
}
}
}
// Show depending on location conditionals.
if ( ! $show ) {
Some notes about this though:
- This change will allow condition IDs to be automatically translated
- Please note that the ID translations will occur on the front-end only; the back-end settings will remain unchanged (so will say "vi" e.g. on both languages).
- we are unsure whether this will affect other parts of the site
Please report this to GeneratePress authors so they could have a look.
Languages: English (English )German (Deutsch )French (Français )
Timezone: Europe/Zagreb (GMT+02:00)
Yes, these will be overwritten, that's why you need to contact GeneratePress so they could assist with this, we cannot add this into our plugin.
The topic ‘[Closed] Conflict between "GeneratePress premium" and "WPML String Translation"’ is closed to new replies.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.