Home Forums Themes Support How to process Multi language for Header and Footer?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #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

     

     

     

     

    • This topic was modified 1 year, 11 months ago by admin.
    • This topic was modified 1 year, 11 months ago by admin.
    • This topic was modified 1 year, 11 months ago by admin.
    • This topic was modified 1 year, 11 months ago by admin.
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.