We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Hide container when post list is empty Reply To: Hide container when post list is empty

#5223
Janek
Participant

Still wasn’t working so I had a blind man’s tinker and somehow managed to find the problem.

In the end the only remaining problem was you had an ID instead of a class designated for the container. What I ended up using was:

jQuery( document ).ready( function( $ ) {
    if ( $( '.wpsp-no-results' ).length ) {
        $( '.wpsp-no-results' ).closest( '.generate-sections-container' ).hide();
    }
} );

And it works perfectly! Such a good result for such a small amount of code.

Thanks so much for helping with this. Now I also know how to use the .closest tag. 🙂