Tell us what you are trying to do?
I had support but I didn't respond for too long. I need to add code to make the english pages load in the english pixel and the same with dutch pages and pixel.
Languages: English (English )Spanish (Español )Italian (Italiano )
Timezone: Europe/Rome (GMT+02:00)
Hello!
Well, this would be out of the scope of this support since it falls under the category of custom coding, however, i want to point you in the right direction (i just can't debug the code).
A function like this one added to your active theme's function.php file will probably do the trick:
function pixelByLanguages(){
$current_language= apply_filters( 'wpml_current_language', NULL);
/* Note that XX refers to the language code. i.e: en - English, es-Spanish, it-italian, etc. */
if($current_language == 'XX'){
echo "PIXEL JS CODE GOES HERE INSIDE <script></script> TAG";
} else{
/*this one will be used as DEFAULT in case no language defined above is found. you can remove this part if you don't want to show the pixel in one of the languages or if you want to instead show it in all the other languages except the one defined above */
echo "PIXEL JS CODE GOES HERE INSIDE <script></script> TAG";
}
}
add_action('wp_head','pixelByLanguages');
/* you can change wp_head to wp_footer if you want to add the code in the footer*/
I tried to put in the code with no success unfortunately. I understand this is not in the scope of the support but every tip is more then welcome. In the screenshot you can see how I put in the code and what happens when its loaded in. When checking the pixel with Facebook pixel helper it doesn't show up the english one.
Languages: English (English )Spanish (Español )Italian (Italiano )
Timezone: Europe/Rome (GMT+02:00)
Hi there,
Indeed what you did wouldn't work because of a very simple yet tricky to see issue:
you are echoing the code using double quotes, right? however the pixel is also using double quotes for a few things so you have 2 ways to fix this:
1) Make sure all double quotes (") in the facebook pixel are replaced by single quotes ('). This won't mess up with the pixel script, so don't worry about that.
2) Add a backslash right before the double quotes inside the facebook pixel script (it would look like this --> \")