Home>Support>Display a different logo for each language on a multilingual site

Display a different logo for each language on a multilingual site

Hi,

I want my website to display a logo for each language. I am using WPML plugin. In my child theme I changed parts/mastead.php. It works for the French version, but not for the English. I am not a PHP expert. Could you help me? Thank you.

<?php
/**
 * Part Name: Default Masthead
 */
?>
<header id="masthead" class="site-header" role="banner">

	<div class="hgroup full-container">
		<?php if(ICL_LANGUAGE_CODE=='fr'): ?>
			<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home" class="logo"><?php vantage_display_logo(); ?></a>
		<?php elseif(ICL_LANGUAGE_CODE=='en'): ?>
  			<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home" class="logo"><img src="images/logo-en.png" alt="Jedi Project"></a>
		<?php endif;?> 
		<?php if( is_active_sidebar('sidebar-header') ) : ?>

			<div id="header-sidebar">
				<?php
				// Display the header area sidebar, and tell mobile navigation that we can use menus in here
				add_filter('siteorigin_mobilenav_is_valid', '__return_true');
				dynamic_sidebar( 'sidebar-header' );
				remove_filter('siteorigin_mobilenav_is_valid', '__return_true');
				?>
			</div>
			<div><?php echo ICL_LANGUAGE_CODE; ?>

</div>

		<?php else : ?>

		<?php endif; ?>

	</div><!-- .hgroup.full-container -->

	<?php get_template_part( 'parts/menu', apply_filters( 'vantage_menu_type', siteorigin_setting( 'layout_menu' ) ) ); ?>

</header><!-- #masthead .site-header -->

URL: http://projet-jedi.org

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Hi Flojo

    Please try making your second logo url an absolute path. Right now it reads:

    images/logo-en.png
    

    Please try changing that to your full domain path.

    If that doesn’t help, please send through a zipped copy of your child theme to [email protected] and I’ll take a look. If you email, please include a link back to this thread so we can reference it.

    Thanks

  2. 9 years, 6 months ago flojo

    Thank you very much Andrew. It works! I’ll remember in the future to always use absolute URL’s.

    If somebody wants to reuse my snippet, here it is corrected (I had left an echo line form an earlier test).

    <?php
    /**
     * Part Name: Default Masthead
     */
    ?>
    <header id="masthead" class="site-header" role="banner">
    
    	<div class="hgroup full-container">
    		<?php if(ICL_LANGUAGE_CODE=='fr'): ?>
    			<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home" class="logo"><?php vantage_display_logo(); ?></a>
    		<?php elseif(ICL_LANGUAGE_CODE=='en'): ?>
      			<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home" class="logo"><img src="http://projet-jedi.org/wp-content/uploads/2015/03/logo-en.png" alt="Jedi Project"></a>
    		<?php endif;?> 
    		<?php if( is_active_sidebar('sidebar-header') ) : ?>
    
    			<div id="header-sidebar">
    				<?php
    				// Display the header area sidebar, and tell mobile navigation that we can use menus in here
    				add_filter('siteorigin_mobilenav_is_valid', '__return_true');
    				dynamic_sidebar( 'sidebar-header' );
    				remove_filter('siteorigin_mobilenav_is_valid', '__return_true');
    				?>
    			</div>
    		<?php else : ?>
    
    		<?php endif; ?>
    
    	</div><!-- .hgroup.full-container -->
    
    	<?php get_template_part( 'parts/menu', apply_filters( 'vantage_menu_type', siteorigin_setting( 'layout_menu' ) ) ); ?>
    
    </header><!-- #masthead .site-header -->
    
  3. 9 years, 6 months ago Daniel
    Hi, I Work Here

    Perfect :-)

    Thanks for sharing with other too

    Always feel free to open a new thread whenever you require support

    Cheers

  4. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Awesome Flojo, glad we found the problem :) All the best.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More