Resolved by author
Overview of the issue
In websites using Betheme theme and WPML, translated global header/footer templates may not display correctly on translated pages. Instead, the original language template appears.
Workaround
Please, make sure of having a full backup of your site before proceeding.
- Open …/wp-content/themes/betheme/functions/theme-functions.php file.
- Replace the following snippet:
// wpml fix if( defined( 'ICL_SITEPRESS_VERSION' ) ){ $default_lang = apply_filters('wpml_default_language', NULL ); $current_lang = apply_filters( 'wpml_current_language', NULL ); if( !empty($default_lang) && !empty($current_lang) && $current_lang != $default_lang ) $lang_postfix = '_'.$current_lang; }else if( function_exists( 'pll_the_languages' ) ) { if( pll_default_language() != pll_current_language() ) $lang_postfix = '_'.pll_current_language(); }
- With:
// wpml fix if( defined( 'ICL_SITEPRESS_VERSION' ) ){ $default_lang = apply_filters('wpml_default_language', NULL ); $current_lang = apply_filters( 'wpml_current_language', NULL ); // WPML WORKAROUND FOR compsupp-7113 (we are disabling $lang_postfix) if( !empty($default_lang) && !empty($current_lang) && $current_lang != $default_lang ) { //$lang_postfix = '_'.$current_lang; } }else if( function_exists( 'pll_the_languages' ) ) { if( pll_default_language() != pll_current_language() ) $lang_postfix = '_'.pll_current_language(); }
- Then, open this other file …/wp-content/themes/betheme/functions.php
- Replace the
mfn_global()
function:function mfn_global() { global $mfn_global; $mfn_global = array( 'header' => mfn_template_part_ID('header'), 'footer' => mfn_template_part_ID('footer'), 'sidemenu' => mfn_global_sidemenu_id(), 'single_product' => mfn_single_product_tmpl(), 'blog' => mfn_archive_template_id('blog'), 'portfolio' => mfn_archive_template_id('portfolio'), ); }
- With:
function mfn_global() { global $mfn_global; $header_global = mfn_template_part_ID('header'); $header_global = apply_filters( 'wpml_object_id', $header_global, get_post_type($header_global) , TRUE ); $footer_global = mfn_template_part_ID('footer'); $footer_global = apply_filters( 'wpml_object_id', $footer_global , get_post_type($footer_global) , TRUE ); $mfn_global = array( 'header' => $header_global, 'footer' => $footer_global, 'sidemenu' => mfn_global_sidemenu_id(), 'single_product' => mfn_single_product_tmpl(), 'blog' => mfn_archive_template_id('blog'), 'portfolio' => mfn_archive_template_id('portfolio'), ); }
Made the change but still in the old Header and footer on translated pages are visible.
Hello there,
This issue should be solved with the recent versions of WPML and Betheme, thus this workaround is no needed.
If the problem persists, please, start a chat in our support forum, in that way one of our specialists will take care of your case.
Hello,
The same problem appears on a website we’re developing. On the main language, header and footer are fine. On the other languages (even though the templates were translated) footer and header are different. I work on the latest version of Betheme and wpml plugin. Do you have any idea how we could resolve this?
Thanks in advance!
Kristof
Hi Kristof,
Thanks for reaching out. This issue was fixed by the author? If the issue persists, please feel free to open a ticket on our support forum. We’d be happy to take a closer look and check whether there have been any recent changes in Betheme’s code.