[IF] or [EACH] templata tag with conditions
-
Hi,
Is it possible to add condition to the [IF][ELSE][/IF] or [EACH] template tag.
If we take the example provided by pods here : https://docs.pods.io/displaying-pods/template-tags/example-template-tag-usage/books is a custom post type created with pods
[before]<div class"book-wrap">[/before] [if books] <h5>Books</h5> <ul> [each books] <li>{@post_title}<li> [if cover_images] <ul> [each cover_images] <li class"cover-image">{@_img.thumbnail}</li> [/each] </ul> [else] <p class"no-images">No Images for this book</p> [/if] </li> [/each] </ul> [else] <p>Author has no books uploaded.</p> [/if] [after]</div><!--.book-wrap-->[/after]
we can loop through our book. Great !
However the loop display all the books, while some might still be draft or pending review, and not published yet !The stupid question is : is there a way to prevent the loop to display unpublished books
The smarter one is : is there a way to set condition to select what the loop get
In pseudo coded it could be something like :
[if books where post-status="published"]
or like
[each books where post-status="published"]
Cheers
- The topic ‘[IF] or [EACH] templata tag with conditions’ is closed to new replies.