Skip Navigation

[Resolved] Content template for conditional language output

This support ticket is created 3 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by hugoC-3 3 years, 10 months ago.

Assisted by: Jamal.

Author
Posts
#1957941

I created a content template in order to display a different banner in the 2 languages below each post in a specific category lik this:

[wpv-post-body view_template="None"]
[wpv-conditional if="( '[get_wpml_language_code_value]' eq 'nl' )" AND ="( CONTAINS(#(category),'getuigenissen') )"]
<figure style="text-align:center;margin-bottom:20px;">

</figure>
[/wpv-conditional]
[wpv-conditional if="( '[get_wpml_language_code_value]' eq 'fr' )" AND ="( CONTAINS(#(category),'temoignages') )"]
<figure style="text-align:center;margin-bottom:20px;">

</figure>
[/wpv-conditional]

The language filter works as expected. My problem however is that the banner show up in *all* posts. I need it to display only in the posts with the specified categories.

Is there any documentation that you are following? https://toolset.com/forums/topic/conditional-output-language/#post-402783

#1959817

Hello and thank you for contacting the Toolset support.

From the first sight, it seems that you have closed the condition early, using a double quote(") just before AND. Try this instead:

[wpv-post-body view_template="None"]
  [wpv-conditional if="( '[get_wpml_language_code_value]' eq 'nl' ) AND ( CONTAINS(#(category),'getuigenissen') )"]
    <figure style="text-align:center;margin-bottom:20px;">
      <a href="/nl/over-ons/notaunicorn"><img src="/wp-content/uploads/2021/02/banner.jpg" class="size-large" /></a>
    </figure>
[/wpv-conditional]
[wpv-conditional if="( '[get_wpml_language_code_value]' eq 'fr' ) AND ( CONTAINS(#(category),'temoignages') )"]
    <figure style="text-align:center;margin-bottom:20px;">
      <a href="/fr/a-propos/notaunicorn"><img src="/wp-content/uploads/2021/02/banner.jpg" class="size-large" /></a>
    </figure>
[/wpv-conditional]

Remember that you can debug a conditional shortcode by adding the debug="true" argument. This will display information about the conditional for administrators, which will help you find out what's going on.

I hope this helps. Otherwise, please allow me temporary access, and provide the link to the content template and let me check it further. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#1960009

My issue is resolved now. Thank you!