Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Languages & Translations (http://forum.bytesforall.com/forumdisplay.php?f=11)
-   -   Different Header Images for Different Languages using WPML (http://forum.bytesforall.com/showthread.php?t=22536)

moomum Jun 2, 2014 03:42 AM

Different Header Images for Different Languages using WPML
 
Hello
I'm using WPML for http://papallaitants.fr/
It's going ok so far but I'd like the banner to be in French when it's a French reader and English when it's an English reader.

I found this https://wpml.org/forums/topic/can-i-...each-language/ which is helpful. It tells me to add some code.

"you need insert the link into img tags.

Then add the code into your header.php file where you display your logo.

<?php
if (ICL_LANGUAGE_CODE == 'en') { ?>

<img src="http://earlymusicbesalu.com/site/wp-content/themes/earlymusicbesalu/images/logo-eng-2012.png"/>

<?php
} else if (ICL_LANGUAGE_CODE == 'es') { ?>
<img src="http://earlymusicbesalu.com/site/wp-content/themes/earlymusicbesalu/images/logo-es-2012.png" />

<?php
} else if (ICL_LANGUAGE_CODE == 'ca') {?>
<img src="http://earlymusicbesalu.com/site/wp-content/themes/earlymusicbesalu/images/logo-ca-2012.png" />

<?php
} else if (ICL_LANGUAGE_CODE == 'fr') {
?>
<img src="http://earlymusicbesalu.com/site/wp-content/themes/earlymusicbesalu/images/logo-fr-2012.png"/>
<?php
}
?>

This seems clear enough but where is the header.php file?
Or is there a different way to do it?

lmilesw Jun 2, 2014 05:42 AM

You could perhaps add a new widget area where %image is in the configure header area box and add the code to a php aware widget that you put in that widget area.

moomum Jun 2, 2014 05:46 AM

Thanks Larry but that is way way over my head and out of my league.
Is it possible to add code to the header.php file and if so please can you tell me where it is

lmilesw Jun 2, 2014 08:32 AM

header.php is in the theme folder but I don't thing that will be any easier for you or will even work. I never edit the theme files as the edit won't stay during an upgrade.

Adding a new widget area is no big deal. If you look in the theme options there are instructions on how to add a new widget area. Then you can search on wordpress.org for a php aware widget.

moomum Jun 2, 2014 08:57 AM

Thank you Larry, I'll take a deep breath and dive in

moomum Jun 2, 2014 08:59 AM

if I can sort out the widget thing do I just use the code in the original post but with my links in a php aware widget?

moomum Jun 2, 2014 09:02 AM

no results found for 'php aware' in WordPress plugins - Larry, would it be called something else? Sorry but I really have no idea what I am doing here so I don't know quite what to look for.

I understand about turning the banner area into a widget, am I then looking for a plugin that will allow me to put php into that widget area?

moomum Jun 2, 2014 09:06 AM

I found this http://wordpress.org/plugins/content-aware-sidebars/
would that do the job?

lmilesw Jun 2, 2014 09:15 AM

I would need to experiment with that plugin to see if it would work. Will it allow conditionals that take language into account for instance?

One plugin I have use for entering php code is this one.

moomum Jun 2, 2014 09:17 AM

As always that is really helpful, thank you Larry. I have to stop now before my head falls off!

moomum Jun 11, 2014 01:55 PM

I haven't sorted the header but I have got things responding to the language now so I'm confident I can do it. I've just made a widget that translates beautifully in the footer.
The add widget areas is really clear and straightforward. I put the code from the instructions straight into the footer area. I used Widget Logic and added 2 of the same widgets but in the Widget Logic area put this bit of code from WPML ICL_LANGUAGE_CODE == 'fr' on one and ICL_LANGUAGE_CODE == 'en' on the other to tell it which page to show up on.
Huge thanks!


All times are GMT -6. The time now is 09:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.