简体   繁体   中英

Home url for multilanguage logo

I use wpml translate plugin for my two language site and use this code to get different logo for each language version

<div class="logo clearfix"> 
<?php if(ICL_LANGUAGE_CODE=='en'): ?> 
<img src="http://ddc.websitedesign.ge/wp-content/uploads/2016/04/DDC LOGO_ENG.png"/> 
<?php elseif(ICL_LANGUAGE_CODE=='ge'): ?> 
<img src="http://ddc.websitedesign.ge/wp-content/uploads/2016/04/DDC-LOGO_GEO.png"/> 
<?php endif;?> 
</div>

The problem is, that in this case logo doesn't has a homepage link.

I try this way

<?php elseif(ICL_LANGUAGE_CODE=='ge'): ?>
<a href="<?php echo get_option('home'); ?>"/>
<img src="http://ddc.websitedesign.ge/wp-content/uploads/2016/04/DDC-LOGO_GEO.png"/> 
<?php endif;?> 
</div>

It works. But it breaks the navigation menu. First menu Item goes down.

Just try to use <a href="<?php bloginfo('url'); ?>">

But with the same result.

Any solution?

You havent close your link tag with </a> :

<?php elseif(ICL_LANGUAGE_CODE=='ge'): ?>
<a href="<?php echo get_option('home'); ?>"/>
<img src="http://ddc.websitedesign.ge/wp-content/uploads/2016/04/DDC-LOGO_GEO.png"/>
</a> 
<?php endif;?> 
</div>

Also you can add some css rules to your <a> html tag this way: .logo > a { some: rules; } .logo > a { some: rules; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM