Home›Support›English Support›[Resolved] BeTheme - Global Sections translation not displaying on secondary language
[Resolved] BeTheme - Global Sections translation not displaying on secondary language
This thread is resolved. Here is a description of the problem and solution.
Problem: The client was unable to display the translated version of global sections in BeTheme using WPML.
Solution: We recommended the following steps: 1- Open the "/wp-content/themes/betheme/functions/builder/class-mfn-builder-front.php" file
2- Replace the following snippet:
public function show_sections($mfn_items, $vbtoolsoff = false){
if( !is_array($mfn_items) ) return;
foreach ($mfn_items as $s => $section) {
$section_class = [];
3- Open the "wp-content/themes/betheme/functions/post-types/class-mfn-post-type-template.php" file
4- Replace the following snippet (around line 21):
public function __construct(){
if( !apply_filters('bebuilder_access', false) ){
return false;
}
if( !current_user_can('editor') && !current_user_can('administrator') ){
return false;
}
parent::__construct();
// fires after WordPress has finished loading but before any headers are sent
add_action('init', array($this, 'register'));
With
public function __construct(){
// WPML Workaround for compsupp-7262 (Part 2)
if ( ! class_exists('Sitepress') ) {
if( !apply_filters('bebuilder_access', false) ){
return false;
}
if( !current_user_can('editor') && !current_user_can('administrator') ){
return false;
}
}
parent::__construct();
// fires after WordPress has finished loading but before any headers are sent
add_action('init', array($this, 'register'));
If you're experiencing this issue, we recommend you try the steps above. However, please note that the solution might be irrelevant due to being outdated or not applicable to your case. If the problem persists, 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. Should you need further assistance, please open a new support ticket at our support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Thanks for contacting WPML forums support. I'll be glad to help you today.
1) Please login to this sandbox site and install your theme. (hidden link)
After that, create a test global section and translate it to replicate the issue. If the issue is replicable, please let me know how to reproduce it.
2) It's unrelated to the issue, but according to your Debug.info, the WP memory limit needs to be increased. PHP memory is fine, but WordPress uses 40Mb as default. The minimum requirements for WPML are 128 MB. (Kindly check this page https://wpml.org/home/minimum-requirements/)
You can increase it by adding the following code in your wp-config.php file right before the /* That's all, stop editing! Happy publishing. */ line:
1. I changed BeBuilder data storage to Serialized readable format
2. I changed Custom field mfn-page-items from Don't translate to Translate
3. I created test page with two sections, first text and second with text, then saved second section as global section then delete section and add saved global section
4. Then i go to Betheme templates and added translate for english for global section
And as you see here global section is not shown for translated language
polish → hidden link
english → hidden link
Hi,
I checked it and it's working only for logged/admin users.
If you are normal user there is still only polish version shown.
Please check it in incognito hidden link
3- Open the "wp-content/themes/betheme/functions/post-types/class-mfn-post-type-template.php" file
4- Replace the following snippet (around line 21):
public function __construct(){
if( !apply_filters('bebuilder_access', false) ){
return false;
}
if( !current_user_can('editor') && !current_user_can('administrator') ){
return false;
}
parent::__construct();
// fires after WordPress has finished loading but before any headers are sent
add_action('init', array($this, 'register'));
With
public function __construct(){
// WPML Workaround for compsupp-7262 (Part 2)
if ( ! class_exists('Sitepress') ) {
if( !apply_filters('bebuilder_access', false) ){
return false;
}
if( !current_user_can('editor') && !current_user_can('administrator') ){
return false;
}
}
parent::__construct();
// fires after WordPress has finished loading but before any headers are sent
add_action('init', array($this, 'register'));
Thanks for workaround.
It's good to know for future users that you'll need first apply workaround and then making sections and then translation with wpml.
Otherwise CSS for sections will not regenerate and you'll need to update all sections firsthand and and update pages.