This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Display a different logo for each language on a multilingual site

Resolved 4 replies premiumthemetheme-vantage
10 years ago · Last reply by Andrew Misplon 10 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

4
  1. Andrew Misplon Staff 10 years, 11 months ago

    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. flojo 10 years, 11 months ago

    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. Daniel Staff 10 years, 11 months ago

    Perfect :-)

    Thanks for sharing with other too

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

    Cheers

  4. Andrew Misplon Staff 10 years, 11 months ago

    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.

Have a different question or issue?

Start New Thread