Hi there,
I have been building a Search Results Layout and came across the need for a Have Posts and Have No Posts Condition to be able to show a different message (no results found) and the latest posts if no search results are found.
I was able to filter into the $condition_contexts
section to add a ‘Have Posts’ / ‘Have No Posts’ selection, and adding a simple condition_rule_
function to handle the condition by returning the WP default have_posts()
. This works in my scenario, but it strikes me that a similar Conditional option for all Looper capabilities (‘Have Items’ within the Looper Provider, which works for the Looper_Provider_Array
return as well as the Looper_Provider_Wp_Query
) would be very useful in many cases. I haven’t looked in to expanding my filter to work for all these, so it would be great if you’re able to extend this option, or a similar solution, to work for all types of loopers / queries / loops!
Cheers!