Within a view, is there a method to "continue", as in skip this iteration, and go to the next iteration.
Is there also a "break" method as well? As in, stop this loop at the current iteration.
I cant seem to find any documentation on this, and it seems odd that these 2 methods wouldnt be available for loops.
Thanks.
Hello, no there is nothing like a continue/break structure in Views loops. You can use conditional statements inside the loop, but they are evaluated after the query has been run. We also offer the PHP APIs wpv_filter_query and wpv_filter_query_post_process to perform other manipulation on the query itself with PHP.
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
Thank you. Is there a reason why these 2 methods do not exist? It seems like an easy add to me. These 2 methods do not need to manipulate/change the existing query, it just needs to stop or skip the loop iteration.
Offhand, no I'm not sure why they don't exist. I think most users are less knowledgeable of known code structures so they find other ways to solve problems. If you'd like to see continue and break added, I encourage you to submit your request in our forums over here: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
My issue is resolved now. Thank you!