Skip to content

Instantly share code, notes, and snippets.

@wplit
Created June 11, 2024 04:16
Show Gist options
  • Save wplit/0531cfdbef6523d645bd45c84a8b0c73 to your computer and use it in GitHub Desktop.
Save wplit/0531cfdbef6523d645bd45c84a8b0c73 to your computer and use it in GitHub Desktop.
prevent Bricks' header/footer being rendered based on condition
<?php
/* do not render header if acf_hide_header field is true */
add_filter('bricks/render_header', function( $header_html ) {
return is_singular() && get_field('acf_hide_header') ? '' : $header_html;
});
/* do not render footer if acf_hide_footer field is true */
add_filter('bricks/render_footer', function( $footer_html ) {
return is_singular() && get_field('acf_hide_footer') ? '' : $footer_html;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment