elizabethU-2
We have a button in the footer template that looks like this:
<a href="/contact/"> <button class="stickycontactButton"> <svg style="width:25px; color:#fff;" xmlns="hidden link " viewBox="0 0 512 512"> <path d="M464 64C490.5 64 512 85.49 512 112C512 127.1 504.9 141.3 492.8 150.4L275.2 313.6C263.8 322.1 248.2 322.1 236.8 313.6L19.2 150.4C7.113 141.3 0 127.1 0 112C0 85.49 21.49 64 48 64H464zM217.6 339.2C240.4 356.3 271.6 356.3 294.4 339.2L512 176V384C512 419.3 483.3 448 448 448H64C28.65 448 0 419.3 0 384V176L217.6 339.2z"></path> </svg> </button> </a>
How we can we make it so the href changes on the other languages?
At the moment, it always directs them to the UK site.
Thanks
Andreas
Hi,
before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.
May I ask you to read this :
https://wpml.org/faq/how-to-translate-urls-shortcodes-and-html-attributes-using-the-advanced-translation-editor/
Regards,
Andreas
elizabethU-2
Hey, how do I find the advanced editor for a HTML element that's present on every page? (it's included in the footer)
Bobby
Supporter
Languages:
English (English )
Timezone:
America/Los_Angeles (GMT-07:00)
Hi there,
Go to WPML->Settings-> verify that you have enabled the Advanced transation editor(ATE)
Then follow the steps from the documentation my colleague shared.
when you click on "+" and open the translation in the ATE you will see the option to search HTML elements at the top left.
Let me know your results, please.
elizabethU-2
I translated a test page just to see if it detects the HTML element, but when searching, nothing comes up. The HTML element isn't included in the page builder, perhaps this is why? it's part of the footer.php template, which loads on every page.
Bobby
Supporter
Languages:
English (English )
Timezone:
America/Los_Angeles (GMT-07:00)
I possibly misunderstood, but yes you are correct; If the HTML is within the footer's code and hardcoded it will not show in the WPML editor.
For hardcoded content, you will either need to create a custom logic filtering for the language OR wrap the HTML in a gettext call to translate using WPML String Translation.
See the following documentation for reference
https://wpml.org/documentation/support/translating-the-theme-you-created/
https://wpml.org/documentation/support/wpml-coding-api/
elizabethU-2
Thanks!
We now have this in our footer.php template:
<?php if ( $newlang = "es" ) {
$link = "hidden link ";
}?>
<?php if ( $newlang = "pt-br" ) {
$link = "hidden link ";
}?>
<?php if ( $newlang = "de" ) {
$link = "hidden link ";
}?>
<?php if ( $newlang = "en" ) {
$link = "hidden link ";
}?>
and this in our functions.php template:
function get_language_shortcode() {
$lang = apply_filters( 'wpml_current_language', null );
return ($lang);
}
add_shortcode( 'language', 'get_language_shortcode' );
$newlang = do_shortcode('[language]');
ISSUE: For some reason it always sets the link to being the last IF statement. In this instance, all languages are being set as the English link as it's the last IF statement. Any idea why?
Bobby
Supporter
Languages:
English (English )
Timezone:
America/Los_Angeles (GMT-07:00)
Unfortunately, custom programming work is beyond the scope of our support.
I am not able to see something apparent at the moment, To possibly test the logic further, I'd recommend using an if-else statement rather than 2 ifs.
I would suggest you consider contacting one of our certified partners from this link:
http://wpml.org/documentation/support/wpml-contractors/
You will get the custom assistance you need to get on with your project.
Before doing so please have a look also here:
http://wpml.org/documentation/support/wpml-contractors/guidelines-for-people-looking-for-consulting-help/