Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 9 replies, has 3 voices.

Last updated by arnaudD-4 7 years, 5 months ago.

Assigned support staff: Andreas Neuber.

Author Posts
December 30, 2013 at 10:27 am #314364

Godert

Hi,

I have been working with WPML and Pinboard theme for a while and I am happy. But now I encountered a problem I cant solve. The website has 2 languages (dutch and english) and when the visitor changes to english we want a different header image. I cant get it working.

Can you help/advice me?

Thanks

Godert

hidden link

December 30, 2013 at 11:45 am #314399

Andreas Neuber
Supporter

Languages: English (English ) German (Deutsch )

Hello Godert,

There are at least two possibilities:

1) If the link to the header image is set by a theme option..
Then we could "translate" the link under "WPML > String Translation"

2) If the link is hard-coded, directly in the theme file..
Then we could add small PHP switch which looks like this:

if(ICL_LANGUAGE_CODE == 'en'){
[link to English image]
}
else {
[link to Dutch image]
}

In order to help you better, could you provide us with credentials for your website and we have a closer look at the settings? For this purpose you should see a protected webform all they way down here in this thread. (it asks first for "Backup + Legal disclaimer")
Thanks in advance!

December 30, 2013 at 12:10 pm #314416

Godert

Hello Andreas,

Thanks for the reply. I think it is hard coded so I need the php thing. In which PHP document do I put the code? header.php?

thanks

December 30, 2013 at 1:04 pm #314448

Andreas Neuber
Supporter

Languages: English (English ) German (Deutsch )

Hi Godert,

In 99% of all cases "header.php" is the right file.
If you like to you could copy + paste the complete code of "header.php" on pastebin.com and then I can tell you exactly what to change.

December 31, 2013 at 10:12 am #314800

Godert

Hi Andreas,

I have pasted the code on pastebin.com

Best
Godert

December 31, 2013 at 11:26 am #314832

Andreas Neuber
Supporter

Languages: English (English ) German (Deutsch )

Thanks! Do you still remember the pastebin.com url?

December 31, 2013 at 11:33 am #314837

Godert

http://pastebin.com/giBQrSvP

Sorry! : )

December 31, 2013 at 11:55 am #314854

Andreas Neuber
Supporter

Languages: English (English ) German (Deutsch )

Thanks!
Ok, you could try this:

# In the file you posted on pastebin.com, in line 23, change function..
header_image() to wpml_header_image()

# In file "functions.php" of your theme add the function

function wpml_header_image($return_me = FALSE){

	switch(ICL_LANGUAGE_CODE){
	
		case 'nl':
			$url = 'http:// [path to NL logo file]';
		break;		

		case 'en':
			$url = 'http:// [path to EN logo file]';
		break;
	}

	if($return_me === FALSE){
		echo $url;
	}
	else {
		return $url;
	}
}

Hope it works straight away 🙂

December 31, 2013 at 12:54 pm #314881

Godert

Did any one ever tell you: YOU ARE THE BEST!!!!

Thanks and a happy new year!

July 30, 2014 at 10:08 am #444596

arnaudD-4

Hi Andreas,
I have the same issue, I would lie to change the url of the logo when I'm in French. I'm currently using WPLMS as a template. Do you think you could check my code as well ?
Thanks a lot.

Best

Arnaud