Quantcast
Viewing all articles
Browse latest Browse all 20145

Conditional HTML output based on taxonomy – what am I doing wrong here?

I have tried adapting the example from http://wp-types.com/documentation/user-guides/conditional-html-output-in-views/ as well as from this recent thread: http://wp-types.com/forums/topic/conditional-html-output-based-on-tags/ but I just can't get it to work.

What I'm trying to do is wrap the output in <h2> tags only if the post custom taxonomy "Session Types" is set to "Main Session". The Types name for "Session Types" is "session-type" and the slug for "Main Session" is "main-session". Here is my latest attempt:

<wpv-loop>
<br />
[wpv-if evaluate="'[wpv-post-taxonomy type="session-type" format="text" show='slug'"]' = 'main-session'"]<h2>[wpv-if]
[types field="start-time"][/types] – [wpv-post-title]
[wpv-if evaluate="'[wpv-post-taxonomy type="session-type" format="text" show='slug'"]' = 'main-session'"]</h2>[/wpv-if]
<br />
</wpv-loop>

As you can see here http://www.organicoutreach.com/ooc2013/about-the-conference/schedule/ all the items are being wrapped with <h2> even though only "Main Session 1" is set to Session Type "Main Session". What am I doing wrong?

ETA: I just noticed that the first closing [/wpv-if] was missing the "/". I fixed that, and now none of the items are being wrapped with <h2> – so I still need help.


Viewing all articles
Browse latest Browse all 20145

Trending Articles