Jump to content
Sign in to follow this  
antonella

Need help with function to change site logo header according to language

Recommended Posts

antonella

Hello, I am trying to change the site logo header according to language with WPML. I followed the direction provided in this post here: http://www.pagelines.com/forum/discussion/11322/how-to-change-header-site-logo-according-to-language#Item_10 However, I'm not too experienced with coding functions, so need a few extra hints. I need to use this code instead of uploading the logo through the pagelines interface:

<?php???if (ICL_LANGUAGE_CODE == 'en') { ?>
	;
	<?php???} else if (ICL_LANGUAGE_CODE == 'es') { ?>???
	<?php???} else if (ICL_LANGUAGE_CODE == 'ca') {?>???
	<?php???} else if (ICL_LANGUAGE_CODE == 'fr') {????>???;???<?php???}????>[/code]

	
	I added it to the instructions provided in the post above, but I am probably missing a semi-colon or have my php statement in the wrong place. This is how I did it, but it's not working. I'm getting an error on the site.
	
	
[code] add_filter ( 'pagelines_site_logo', 'multilanguage'); function multilanguage($site_logo){ $site_logo = <?php if (ICL_LANGUAGE_CODE == 'en') { ?> logo-eng-2012.png <?php } else if (ICL_LANGUAGE_CODE == 'es') { ?> logo-es-2012.png <?php } else if (ICL_LANGUAGE_CODE == 'ca') {?> logo-ca-2012.png <?php } else if (ICL_LANGUAGE_CODE == 'fr') { ?> logo-fr-2012.png; <?php } ?> ; return $site_logo; }

The error is occurring on the third line in ($site_logo = <?php ). Can anyone give me any clues to get to the next step? Thanks!

Share this post


Link to post
Share on other sites
Simon
You are trying to output html in a filter, a wordpress filter always takes something in, adjusts it and sends it back for display or whatever. Filters should never output anything. Anyway we take translation seriously so here is a perfect working example for you: http://paste.pagelines.com/9k Enjoy!

Share this post


Link to post
Share on other sites
finnes
Tks... works fine to me!!! [url="http://www.flic2012.com.br"]FLIC 2012[/url] Best Regards

Share this post


Link to post
Share on other sites
Simon
Looks good.

Share this post


Link to post
Share on other sites
antonella
This is awesome and it worked! Thanks so much! Like I said before, I don't know too much about PHP beyond basic stuff, and I was trying to paste together instructions from different sources that just didn't make sense obviously. Wishlist: I wonder if there's a way to automate this? ;)

Share this post


Link to post
Share on other sites
Simon
Just add new languages to the array... [code]'jp' => 'http://url.to.image.for.jp',[/code]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×