 Bruno Kos
WPML Supporter since 12/2018
Languages:
English (English )
German (Deutsch )
French (Français )
Timezone:
Europe/Zagreb (GMT+02:00)
|
Thank you, I downloaded the package. I am checking this with our 2nd tier and will keep you posted.
|
 Bruno Kos
WPML Supporter since 12/2018
Languages:
English (English )
German (Deutsch )
French (Français )
Timezone:
Europe/Zagreb (GMT+02:00)
|
Can you please try the following:
1. Make sure the "Adjust IDs for multilingual functionality" option is enabled on the live site. You can find this option by navigating to **WPML -> Languages**.
2. After enabling the option, clear the cache, although this may not be required.
Does it work?
|
 piaP-6
|
Hi Bruno,
Yes, that does actually seem to solve the issue for the products that had the issue. However, should this setting be necessary for a compatible theme as Flatsome? I would prefer not setting that option due to performance.
Best Regards,
P
|
 Bruno Kos
WPML Supporter since 12/2018
Languages:
English (English )
German (Deutsch )
French (Français )
Timezone:
Europe/Zagreb (GMT+02:00)
|
The "Adjust IDs for multilingual functionality" setting in WPML ensures that content elements like posts, pages, media, and taxonomies are correctly linked across different languages, whether they're referenced by themes, plugins, or custom fields. It’s not exclusively related to themes, but applies to any ID-based content across the site. While it may add a slight performance overhead due to additional database queries, proper caching can minimize this impact.
Are you noticing any performance overhead or slower load times since enabling this feature?
|
 piaP-6
|
Hi Bruno,
The links in the post meta section is coming from the theme, so I thought it was related to the theme.
I have not tested how much the setting impacts the performance. However, I generally prefer sticking to the ideal settings for performance. Isn't there another way to fixed the issue in the theme files?
Best Regards,
P
|
 Bruno Kos
WPML Supporter since 12/2018
Languages:
English (English )
German (Deutsch )
French (Français )
Timezone:
Europe/Zagreb (GMT+02:00)
|
To dynamically translate category URLs in Flatsome using WPML, you can utilize the `wpml_object_id()` function. Here’s a code example to guide you:
<?php
if ( class_exists('Sitepress') ) {
// Fetch all categories
$categories = get_categories();
foreach ($categories as $category) {
// Translate the category ID for the current language
$translated_cat_id = apply_filters( 'wpml_object_id', $category->term_id, 'category', TRUE );
// Generate the translated category URL
$translated_cat_link = get_category_link($translated_cat_id);
// Output the translated category link
echo '<a href="' . esc_url($translated_cat_link) . '">' . esc_html($category->name) . '</a>';
}
}
?>
However, note the following:
1. WPML's "Auto adjust IDs" functionality is highly efficient, filtering terms by language directly at retrieval. This minimizes the need for additional requests in your code and is generally preferable unless you encounter specific performance issues. If performance remains unaffected, it’s best to leave this setting enabled.
2. This code requires careful placement in the correct template within Flatsome. While it may work initially, future updates in theme could affect its behavior (e.g., changes in function names or term filtering processes).
3. Adjustments for WPML compatibility can be complex, as various developers have unique approaches to term filtering. If you need further customization, consider checking with the Flatsome developers to see if they can integrate this solution. Alternatively, you may want to consult our https://wpml.org/contractors/ for help in adjusting templates to work without relying on this function.
|