Shop

jQuery(document).ready(function($) { function hideEmptyWPC() { // Find every filter item and hide it if the count is 0 $('.wpc-filter-item').each(function() { var count = $(this).find('.wpc-term-count').text().replace(/[^0-9]/g, ''); if (count === '0') { $(this).hide(); } }); } // Run on page load hideEmptyWPC(); // Run again whenever the filter updates (AJAX) $(document).on('wpc_after_filter_posts', function() { hideEmptyWPC(); }); });