Last active
February 20, 2017 21:05
-
-
Save themeblvd/ee2da251c15a49188ae7402d743e9be6 to your computer and use it in GitHub Desktop.
When using the footer "template sync" option at Appearance > Theme Options > Layout > Footer, this is how you can translate that footer template for a second language in WPML.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Apply separate footer sync template when WPML | |
* language is French (fr). | |
*/ | |
function my_translated_footer( $config ) { | |
if ( defined( 'ICL_LANGUAGE_CODE' ) && 'fr' === ICL_LANGUAGE_CODE ) { | |
$template = 'your-template-name'; // Put the name of your French template here. | |
$template_id = themeblvd_post_id_by_name( $template, 'tb_layout' ); | |
if ( ! empty( $template_id ) ) { | |
$config['bottom_builder'] = $template; | |
$config['bottom_builder_post_id'] = $template_id; | |
} | |
} | |
return $config; | |
} | |
add_filter( 'themeblvd_frontend_config', 'my_translated_footer' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The basic approach here is to filter in a second template when it is the secondary language. In this example, the site's secondary language is French (fr). When using this code snippet, make sure to specify your secondary language code in place of "fr" and also make sure to specify the $template variable, which should be the slug of the template you've created which you want to display for the secondary language.