Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1019549
    svdg
    Participant

    Hi, I use WPML and I want to display a different logo for each language. There are 2 languages: nl and en. Each logo has to have it’s own URL as well. I have found some examples but they all break the code, so please help. I use the Renew theme, but I don’t care to change it in global. I already have a child theme.

    #1019553
    Darshana
    Moderator

    Hi there,

    Thanks for writing in! Please refer to the following thread (https://community.theme.co/forums/topic/wpml-logo-change/).

    If you have any issues, share your code here using the code tags in the forum toolbar (you can wrap your code within the code tags), so that we can assist you accordingly.

    Thanks!

    #1021780
    svdg
    Participant
    This reply has been marked as private.
    #1021979
    Paul R
    Moderator

    Hi,

    Please replace your code with this.

    
    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_BRAND.PHP
    // -----------------------------------------------------------------------------
    // Outputs the brand.
    // =============================================================================
    
    $site_name        = get_bloginfo( 'name' );
    $site_description = get_bloginfo( 'description' );
    //$logo           = x_make_protocol_relative( x_get_option( 'x_logo' ) );
    
    if (wpml_getLanguage() == 'nl'):
        $logo = 'http://www.moveformotion.nl/img/logo.png';
    elseif (wpml_getLanguage() == 'en'):
        $logo = 'http://www.moveformotion.nl/img/logo.png-en';
    endif;
        $site_logo = '<img src="' . $logo . '" alt="' . $site_description . '">';
    
    ?>
    
    <?php echo ( is_front_page() ) ? '<h1 class="visually-hidden">' . $site_name . '</h1>' : ''; ?>
    
    <?php if(wpml_getLanguage()=='nl'): ?>
       <img src="http://www.moveformotion.nl/img/logo.png" alt="Praktijk voor psychotherapie" border="0"/>
    <?php elseif(wpml_getLanguage()=='en'): ?>
       <img src="http://www.moveformotion.nl/img/logo-en.png" alt="Psychotherapy practice" border="0"/>
    <?php endif; ?>
    

    Hope that helps

    #1022382
    svdg
    Participant
    This reply has been marked as private.
    #1022673
    Nabeel A
    Moderator

    Hi there,

    Can you please also provide the URL of your site so we can take a look?

    Thanks!

    #1022686
    svdg
    Participant
    This reply has been marked as private.
    #1023308
    Rue Nel
    Moderator

    Hello There,

    I am another staff checking on this thread! I went ahead and modified the code above. I ended up using this:

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_BRAND.PHP
    // -----------------------------------------------------------------------------
    // Outputs the brand.
    // =============================================================================
    
    $site_name        = get_bloginfo( 'name' );
    $site_description = get_bloginfo( 'description' );
    $logo             = x_make_protocol_relative( x_get_option( 'x_logo' ) );
    
    if ( ICL_LANGUAGE_CODE == 'nl' ):
        $logo = '//www.moveformotion.nl/wp-content/uploads/2015/02/logo.png';
    	$site_description = 'Dutch description here';
    elseif ( ICL_LANGUAGE_CODE == 'en' ):
        $logo = '//www.moveformotion.nl/wp-content/uploads/2015/02/logo.png';
    	$site_description = 'English description here';
    endif;
    
    $site_logo = '<img src="' . $logo . '" alt="' . $site_description . '">';
    
    ?>
    
    <?php echo ( is_front_page() ) ? '<h1 class="visually-hidden">' . $site_name . '</h1>' : ''; ?>
    
    <a href="<?php echo home_url( '/' ); ?>" class="<?php x_brand_class(); ?>" title="<?php echo $site_description; ?>">
      <?php echo ( $logo == '' ) ? $site_name : $site_logo; ?>
    </a>

    Please edit it again and supply the correct image path for the Dutch and English version of your logo. I also want to edit the description for both languages.

    Please let us know how it goes.

    #1024283
    svdg
    Participant

    That works, thanks!

    #1024697
    Joao
    Moderator

    Great to hear it.

    Let us know if you need help with anything else.

    Thanks

    Joao

  • <script> jQuery(function($){ $("#no-reply-1019549 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>