CMS Development

DM2
Membre

Excluding multiple blog topics from a topic list

Résolue

Hi

 

I am showing a list of topics but have 3 that I don't want to show (Novice, Intermediate and Advanced). I've tried this:

 

{% for topic in post.topic_list %}
 {% if topic.name != ['Novice', 'Intermediate', 'Advanced'] %}
  {{ topic.name }} 
 {% endif %}   
{% endfor %}

 

but that returns no topics.

 

Grateful for any help here.

0 Votes
1 Solution acceptée
piersg
Solution
Conseiller clé

Excluding multiple blog topics from a topic list

Résolue

@DM2 it should work if you do this:

{% for topic in post.topic_list %}
 {% if topic.name is not in ['Novice', 'Intermediate', 'Advanced'] %}
  {{ topic.name }} 
 {% endif %}   
{% endfor %}

 

Voir la solution dans l'envoi d'origine

2 Réponses
DM2
Membre

Excluding multiple blog topics from a topic list

Résolue

Brilliant, thanks so much.

0 Votes
piersg
Solution
Conseiller clé

Excluding multiple blog topics from a topic list

Résolue

@DM2 it should work if you do this:

{% for topic in post.topic_list %}
 {% if topic.name is not in ['Novice', 'Intermediate', 'Advanced'] %}
  {{ topic.name }} 
 {% endif %}   
{% endfor %}