[Resolved] Elements depending on language (with WPML)

Home Forums Support [Resolved] Elements depending on language (with WPML)

Home Forums Support Elements depending on language (with WPML)

Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • #1841705
    Elvin
    Staff
    Customer Support

    You can base on this example for your sticky menu logo.

    This snippet assumes you’re using a Header Element with merged header.

    add_filter( 'option_generate_menu_plus_settings', function( $settings ) {
        if ( ICL_LANGUAGE_CODE == 'en' ) {
            $settings['sticky_navigation_logo'] = 'your english logo image URL here';
        } 
    
        if ( ICL_LANGUAGE_CODE == 'jp' ) {
            $settings['sticky_navigation_logo'] = 'your japanese logo image URL here';
        }
        
        return $settings;
    } );
    #1841899
    Serhii

    Thank you for your code. It works right.

    The logo now changes on the sticky menu as well when switching languages.
    Changing the logo on the static and on the sticky menu works in the display mode – desktop.
    But only now I noticed that when I check the site display mode – mobile, neither the static logo nor the logo on the sticky menu change when switching the language.

    How to make a logo switch for display mode – mobile?

    #1842886
    Tom
    Lead Developer
    Lead Developer

    This depends on how you’re displaying the logo on mobile.

    If you’re using the Mobile Header option, you can adjust your function to include its logo:

    add_filter( 'option_generate_menu_plus_settings', function( $settings ) {
        if ( ICL_LANGUAGE_CODE == 'en' ) {
            $settings['sticky_navigation_logo'] = 'your english logo image URL here';
            $settings['mobile_header_logo'] = 'your mobile logo';
        } 
    
        if ( ICL_LANGUAGE_CODE == 'jp' ) {
            $settings['sticky_navigation_logo'] = 'your japanese logo image URL here';
            $settings['mobile_header_logo'] = 'your mobile logo';
        }
        
        return $settings;
    } );
    #1844708
    Serhii

    Yes. I checked the settings – the mobile header is enabled, added your code – everything works.
    Many thanks.

    #1845894
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

Viewing 5 posts - 16 through 20 (of 20 total)
  • You must be logged in to reply to this topic.