Question regarding WPML support

Hi there,

I use BeTheme on my site ([Links visible only for registered users]) along with the WPML plugin to display translations of my site in multiple languages, so I have the following versions of the site:

I am trying to add different advertising tags for each language, and have reached out to WPML support for help on this.  They've given me the following snippet of code, and asked me to request support from BeTheme on where to insert the code.  So my question is, where should I insert this code?

$current_lang = apply_filters( 'wpml_current_language', NULL );
if( $current_lang == 'zh-hans' ){
//advertising code for chinese simplified
}elseif( $current_lang == 'zh-hant' ){
//advertising code for chinese traditional
}elseif( $current_lang == 'en' ){
//advertising code for English
}


Thanks for your help!
Emma

Comments

  • Hi,

    we are sorry but your question is incomplete because we have no idea with what you want to connect this code. We do not understand what this code supposed to do and with which our item or option should be connected.
  • Ok, here's the long explanation then.  I have the WPML plugin installed on my site.  It allows me to display translations of my website in different languages without creating a completely new post or page for every existing page that I have.  So my different URLs are as follows:

    English site: [Links visible only for registered users]
    Simplified Chinese: [Links visible only for registered users]
    Hindi: [Links visible only for registered users]
    etc.

    I also need to insert some advertising tags in my site, and the advertising tag needs to be different for each language.  For example, the English tag is as follows:

    <!--


    Start of DoubleClick Floodlight Tag: Please do not remove


    Activity name of this tag: Vancouver English Landing Page - Escape


    URL of the webpage where the tag is expected to be placed:
    [Links visible only for registered users]


    This tag must be placed between the <body> and </body> tags, as close as possible to the opening tag.


    Creation Date: 11/29/2016


    -->


    <script type="text/javascript">


    var axel = Math.random() + "";


    var a = axel * 10000000000000;


    document.write('<iframe src="[Links visible only for registered users]" width="1" height="1" frameborder="0" style="display:none"></iframe>');


    </script>


    <noscript>


    <iframe src="[Links visible only for registered users]"
    width="1" height="1" frameborder="0" style="display:none"></iframe>


    </noscript>


    <!-- End of DoubleClick Floodlight Tag: Please do not remove -->

    (Continued in next comment)
  • (Continued from last comment)

    While the Simplified Chinese tag is as follows:

    <!--
    Start of DoubleClick Floodlight Tag: Please do not remove
    Activity name of this tag: Vancouver Chinese Simplified Landing Page - Escape
    URL of the webpage where the tag is expected to be placed: [Links visible only for registered users]
    This tag must be placed between the <body> and </body> tags, as close as possible to the opening tag.
    Creation Date: 11/29/2016
    -->
    <script type="text/javascript">
    var axel = Math.random() + "";
    var a = axel * 10000000000000;
    document.write('<iframe src="[Links visible only for registered users] + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
    </script>
    <noscript>
    <iframe src="[Links visible only for registered users]?" width="1" height="1" frameborder="0" style="display:none"></iframe>
    </noscript>
    <!-- End of DoubleClick Floodlight Tag: Please do not remove -->

    Because the advertising code snippets are for different translations of the same page, I am not sure where to put this code.

    When I reached out to WPML support, they gave me this code snippet to resolve the issue, and asked me to request support from BeTheme regarding where to insert the code, along with my advertising code above.

    $current_lang = apply_filters( 'wpml_current_language', NULL );
    if( $current_lang == 'zh-hans' ){
    //advertising code for chinese simplified
    }elseif( $current_lang == 'zh-hant' ){
    //advertising code for chinese traditional
    }elseif( $current_lang == 'en' ){
    //advertising code for English
    }

    Does this make it clear?

    Regards,
    Emma
  • Ok, we understand what you mean now but we are afraid that what you ask for, requires files customization. As we can see, the code you want to use is some PHP and Javascript. However, because files customization in reference to Item Support Policy [Links visible only for registered users] are not allowed, you need to contact with your web developer if you would like to do such customization.
Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.