gpeb-hide-empty-columns.html

Code

Filename: gpeb-hide-empty-columns.html

<!--
 * Gravity Perks // Entry Blocks // Hide Empty Columns on Edit
 * https://gravitywiz.com/documentation/gravity-forms-entry-blocks/
 * 
 * If you include multiple Entry Blocks on the same page and click to view or edit a single entry,
 * only the block to which that entry belongs will be visible. If you have each Entry Block displayed
 * in its own column, this will render any other column empty in these views.
 *
 * Use this snippet to automatically find empty columns and remove them, making the remaining column
 * full width.
 * 
 * Instructions:
 * 
 * 1. Add an HTML block to your page.
 * 2. Copy the snippet into that block.
-->
<script>
document.querySelectorAll( '.wp-block-column' ).forEach( element => {
    if ( element.textContent.trim() === '' ) {
        element.remove();
    }
} );
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.