Home › Forums › Themes Support › How to process Multi language for Header and Footer?
Tagged: multi language, wpml
- This topic has 0 replies, 1 voice, and was last updated 2 years, 10 months ago by
admin.
-
AuthorPosts
-
October 8, 2019 at 3:17 pm #4138
Hi all customer,
In this tutorial we’ll help you process multi language in our theme.
We’ll have tutorial for each plugin here.
1. Polylang
1.1. Translate Header
Top Header:
Because Top Header use Widgets to display so you can translate it by translate Widget in Appearance -> Widgets
Menu:
You can go to Appearance -> Menu and create Menu for each language like step 4 in this tutorial: https://harutheme.com/forums/topic/how-to-use-multi-language-in-wordpress-with-polylang-plugin/
Header Elements:
You can customize template display of Header Elements follow this topic tutorial: https://harutheme.com/forums/topic/customize-wordpress-theme-using-child-theme/
Example customize Social Network you need customize this template:
wp-content/themes/xxx/templates/header/header-elements/social-network-xxx.php
You need code to check current language:
$slug = pll_current_language('slug');
and check conditional to display for each language. Example you use French as secondary language:
if ($slug == 'fr') { $youtube_fr = '#'; // You need change # to your url $social_icons .= '<li><a href="' . esc_url( $youtube_fr ) . '" target="_blank"><i class="fa fa-youtube"></i></a></li>' . "\n"; } else { $social_icons .= '<li><a href="' . esc_url( $youtube ) . '" target="_blank"><i class="fa fa-youtube"></i></a></li>' . "\n"; }
You can do similar with other Header Elements.
1.2. Translate Footer
You can follow step 6 in this topic tutorial: https://harutheme.com/forums/topic/how-to-use-multi-language-in-wordpress-with-polylang-plugin/
2. WPML
2.1. Translate Header
2.2. Translate Footer
You need customize code in 2 files: (xxx is name of theme)
wp-content/themes/xxx/templates/footer/footer.php
wp-content/themes/xxx/templates/footer/footer-stylesheet.php
Similar Polylang you need check current language for WPML: https://wpml.org/documentation/support/wpml-coding-api/
https://wpml.org/forums/topic/get-translated-post-id/
The new code in footer.php
Updating…
The new code in footer-stylesheet.php
Updating…
Hope this help you!
******
Best regards,
HaruTheme
-
AuthorPosts
You must be logged in to reply to this topic.