Created
February 3, 2023 18:33
-
-
Save wurwal/08bd642c8844ea15b7681909f3b87eb3 to your computer and use it in GitHub Desktop.
detect no posts on repeaters with or without facetwp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//when facets change dynamically - delete if using on a regular page load based repeater | |
jQuery(document).on('facetwp-loaded', function() { | |
// if repeater id contains something that it would if it returned posts | |
if (jQuery('#_dynamic_list-9-148 h2').length > 0) { | |
// hide no posts error | |
jQuery('.no-results').hide(); | |
// otherwise the no results message shows | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment