Home › Support › English Support › [Closed] Logo in other Language
This topic contains 6 replies, has 3 voices, and was last updated by Martijn 1 year, 1 month ago. The support staff assigned to this topic is Harshad.
| Author | Posts |
|---|---|
| Author | Posts |
| April 9, 2012 at 11:06 pm #55077 | |
|
Martijn |
I need to use a different logo for 2 languages. How can I do this with the following code (in header.php)?
<div id="logo">
<?php
// Website heading/logo and description text.
if ( isset($woo_options['woo_logo']) && $woo_options['woo_logo'] ) {
echo '<a href="' . $site_url . '" title="' . $site_description . '"><img src="' . $woo_options['woo_logo'] . '" alt="' . $site_title . '" /></a>' . "n";
} else {
echo '<' . $heading_tag . ' class="site-title"><a href="' . $site_url . '">' . $site_title . '</a></' . $heading_tag . '>' . "n";
} // End IF Statement
if ( $site_description ) { echo '<span class="site-description">' . $site_description . '</span>' . "n"; }
?>
</div><!-- /#logo -->
|
| April 10, 2012 at 12:45 am #55083 | |
|
Piet |
The easiest way to show different logos on different languages is by using an IF ELSE statement in combination with ICL_LANGUAGE_CODE very similar as described here: http://wpml.org/forums/topic/using-icl-language-code-to-display-different-headings/ Please let me know if this works for you. |
| April 10, 2012 at 4:58 am #55102 | |
|
Harshad |
@Martijn Yes what Piet has suggested you should work. Using WPML constant ICL_LANGAUGE_CODE with combination of IF ELSE statements you can display different logos. For ex. |
| April 10, 2012 at 3:04 pm #55184 | |
|
Martijn |
I saw the previous posts, that I should use the ICL_LANGAUGE_CODE, but my problem is how to use it in the above code… (I'm not a PHP/Code guy…). Thanks! |
| April 10, 2012 at 3:19 pm #55185 | |
|
Piet |
Well Martijn, that depends a little bit on how you want the site setup. If you will be the only admin on the site and you know 100% sure that you will always want two different images for the two different languages, then you can strip out the existing code and replace it with the code I gave earlier. If however you are making this site for someone else and perhaps in the future there is not going to be any logo, then you better keep the current code and wiggle our code into that code. The current code says sth like if you have set a logo in the options of your theme and there is a logo then show the logo, if not, just show the site title. So it's up to you to decide what you want… |
| April 11, 2012 at 4:44 am #55244 | |
|
Harshad |
Martijn, Viewing your code seems that, you have can upload the logo from your theme options. But if you want to display different logos per language uploading them manually. you can use following code.
<div id="logo">
<?php
// Website heading/logo and description text.
if(ICL_LANGUAGE_CODE=='en'){
$site_url = "SITE_URL";
$site_description = "SITE_DESCRIPTION";
$site_title = "SITE_TITLE";
$logo = "PATH_TO_YOUR_ENGLISH_LOGO";
}
elseif(ICL_LANGUAGE_CODE=='fr'){
$site_url = "SITE_URL";
$site_description = "SITE_DESCRIPTION";
$site_title = "SITE_TITLE";
$logo = "PATH_TO_YOUR_FRENCH_LOGO";
}
echo '<a href="' . $site_url . '" title="' . $site_description . '"><img src="' . $logo . '" alt="' . $site_title . '" /></a>' . "n";
?>
</div><!-- /#logo -->
|
| April 12, 2012 at 7:02 am #55380 | |
|
Martijn |
Thanks! Worked for me! |
The topic ‘[Closed] Logo in other Language’ is closed to new replies.