Background of the issue:
I am trying to use the [wpml_language_switcher] shortcode to build a custom language switcher by passing in a twig template string as described in the shortcode's documentation. Since updating from WPML 4.7.6 to 4.8.1, it is no longer using the template string to generate its output.
The template code is as follows:
<div class="nav-lang col-auto">
<?php echo do_shortcode('[wpml_language_switcher]
<div class="{{ css_classes }} nav-lang-switcher">
<ul>
{% for code, language in languages %}
<li class="{{ language.css_classes }}"><a href="{{ language.url }}" title="{{ language.native_name }}{% if language.native_name != language.display_name %} ({{ language.display_name }}){% endif %}" class="nav-button">{{ language.code }}</a></li>
{% endfor %}
</ul>
</div>
[/wpml_language_switcher]');
?>
</div>
Link to a page where the issue can be seen: hidden link
I have also made sure that the "Custom Language Switcher" setting is enabled.
<b>Symptoms: </b>
The expected output was a specific HTML structure for the language switcher, but instead, I got a different HTML structure that does not respect the template string.
<b>Questions: </b>
Why is the
wpml_language_switcher
shortcode not respecting the template string after updating to WPML 4.8.1?
Yes, the expected output is the version with the circle, which was achieved with CSS. The issue is that the shortcode isn't using the template string anymore, thus no longer putting out the specific HTML for the styling.
I've attempted reproducing this on a sandbox environment, but I was not successful, I would like to request temporary access (wp-admin and FTP) to your site to test the issue.
(preferably to a test site where the problem has been replicated if possible)
**Before we proceed It is necessary to take FULL BACKUP of your database and your website. Providing us with access, you agree that a backup has been taken **
I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/
You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you enter is private which means only you and I have access to it.
NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin.
Thank you,
Bobby
The topic ‘[Closed] [wpml_language_switcher] shortcode no longer respecting template string after updating from WPML 4.7…’ is closed to new replies.