Okay
  Public Ticket #2733090
Using a conditional statement
Closed

Comments

  • Barry Goodwin started the conversation

    Hi, 

    Here is the code for a post carousel. You kindly helped me set it up so that if a term called ‘working-today’ is Yes then put Yes, if it says no, put No etc. That works brilliantly. May I ask if I can get the code to show Yes in green and No in red? I’ve tried out a few things but they resulted in errors being displayed. Are you able to help please as I’ve tried for several hours but all my efforts have failed? 

    Many thanks,

    Barry. 


     Full widget code:

       {% set terms = getPostTerms(item.post.id, "working-today", true) %} {% if(terms|length > 0) %} {% set workingText = "Yes" %} {% else %} {% set workingText = "No" %} {% endif%}                                          {% if show_title == "true" %}{{item.post.title|raw}}{% endif %}       {{item.post.cf_nationality}}       {{item.post.cf_age}} yrs - {{item.post.cf_statistics}}       Working Today: {{ workingText }}     {% if show_intro == "true" %}{{item.post.intro_full|truncate(intro_number_of_characters)}}{% endif %}     {% if show_date == "true" %}{{item.post.date|ucdate("d F Y")|raw}}{% endif %}     {% if show_button == "true" %}{{read_txt|raw}}{% endif %}      

  •   Max replied privately
  • Barry Goodwin replied

    Hi Max, I thought I'd replied to this several days ago but I can't see any reply so maybe I'm confused. Anyway, sadly the solution you gave me didn't work. The result was just the span html code being displayed: https://www.barenakedpixels.com/all-escorts-gallery/

    Might there be another solution? 

    Many thanks,

    Barry.

  •   Max replied privately
  • Barry Goodwin replied

    Hi Max,

    A big thank you for that tip. I wouldn't have got that in a million years but of course it works beautifully so thanks for finding a solution for me. All done now.. 

    Many thanks,

    Barry.

  •   Max replied privately