Hi,
oh sorry - but it was in view 12454 - >
i tried it in loop object with condition:
[wpv-conditional if="( '[types field='ort' item='@termine-veranst.parent'][/types]' lte '[NOW]' )"]
or
[wpv-conditional if="( '[types field='datum-und-uhrzeit' style='text' format='d'][/types]' lte '[NOW]' )"]
but this dont work.
thx for helping - best regards - alex
Hi,
Thank you for contacting us and I'd be happy to assist.
There are a couple of points to note here:
1. The right format to use the current time value is 'NOW()' and not '[NOW]'.
( ref: https://toolset.com/documentation/legacy-features/views-plugin/date-filters/ )
2. The "ort" custom field is of type select and not a date/time type field. For date function comparisons, only the date/time fields or the fields which are storing the raw UNIX timestamp format should be used.
So, based on these the correct format to use for the current post's field with slug 'example-field' would be:
[wpv-conditional if="( $(wpcf-example-field) lte 'NOW()' )"]
The condition is true!
[/wpv-conditional]
And if the field is from the related parent/child post and you need to specify that through the 'item' attribute ( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/ ) for example "@termine-veranst.parent", the format would be:
[wpv-conditional if="( '[types field='example-field' output='raw' item='@termine-veranst.parent'][/types]' lte 'NOW()' )"]
The condition is true!
[/wpv-conditional]
I hope this helps and please let me know if you need any further assistance with this.
regards,
Waqar
Hi Waqar,
sorry but i had a hanger why show this the date it is without the output='raw' item='@termine-veranst.parent'
i looks it works like this but i wonder how (field="datum-und-uhrzeit" is possible, which is given to the posttype in view 12454):
[wpv-conditional if="( '[types field='datum-und-uhrzeit' output='raw' item='@termine-veranst.parent'][/types]' lte 'NOW()' )"]
The condition is true! [types field='datum-und-uhrzeit' ][/types]
[/wpv-conditional]
best regards - alex
I'm sorry, but I couldn't fully understand the question.
If you meant to ask how the 'item' attribute can be used to get the data from the related posts, you'll find the details about that in this guide:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
In case of a different question, can you please share more details about what you have in mind?
hi Waqar,
😉 - no i would hide any posts which is in future - lower or same like Now(). The Field "datum-und-uhrzeit" has a date which i can use it in an if-loop 😉 - but it dont work.
thx for helping - alex
Thank you for sharing these details.
The outer condition in the view with ID '12454' was not working, because the shortcode was using the attribute item='@termine-veranst.parent'.
[wpv-conditional if="( '[types field='datum-und-uhrzeit' output='raw' item='@termine-veranst.parent'][/types]' lte 'NOW()' )"]
....
[/wpv-conditional]
Since the 'datum-und-uhrzeit' field is directly attached to the post type 'Termine' that this view is showing, the shortcode for it doesn't need the 'item' attribute.
[wpv-conditional if="( '[types field='datum-und-uhrzeit' output='raw'][/types]' lte 'NOW()' )"]
....
[/wpv-conditional]
I've updated the conditional statement and it seems to be working now.
Hi Waqar,
yes but without it dont work - have you seen this -> enlace oculto
thx for you helping, best regards - alex
Yes, I've seen this page and it is not showing any results because there are no posts which are fulfilling the criteria.
To demonstrate that the conditional statement itself is working correctly, I've created a new test view named "Test view from TS support", with the same settings and it can be seen on a new page named "Test Page from TS support".
You can see that this page is correctly showing only the posts which have the 'datum-und-uhrzeit' field value, lower than or equal to 'Now'.
The reason the view with ID '12454' is not showing any results is that it is undergoing some extra filtering through the custom code snippet named "tssupp-multi-rfg-parents", added at WP Admin -> Toolset -> Settings -> Custom Code.
( screenshot: enlace oculto )
If you'll remove this view's ID '12454' from that code snippet, it will also start showing the results correctly.
Hi Waqar,
yes you are right - now i ordering this view also about datum-und-uhrzeit: this is working - but now the filters wont work - do i see something wrong? -> look i filtered about kategories and date but nothing work.
I've reviewed your previous ticket in which the custom snippet "tssupp-multi-rfg-parents" was shared.
( ref: https://toolset.com/forums/topic/filter-view-of-rfg-by-taxonomy-applied-to-parent-post/ )
As Toolset views, don't officially support the front-end search filters for the taxonomies and the custom fields attached to the related parent or child posts, this workaround of linking one view's results with another, can't be considered reliable or efficient.
A better approach, in this case, would be to use a single view that shows the "Veranstaltungen" posts with the desired search filters. And in the view's loop item template, you can show the related 'Termine' posts.