Bricks Builder collection of hook snippet.
// Render a Bricks Template by its ID above the site header.
add_action( 'bricks_before_header', 'render_bricks_template_above_header' );
function render_bricks_template_above_header() {
echo do_shortcode( '' );
}
Filter to add HTML attributes to the body tag
add_filter( 'bricks/body/attributes', function( $attributes ) {
// Add 'data-is-body' HTML attribute to footer with value 'y'
$attributes['data-is-body'] = 'y';
return $attributes;
} );Filter to add HTML attributes to the header tag
add_filter( 'bricks/header/attributes', function( $attributes ) {
// Add custom class to header
if ( isset( $attributes['class'] ) && is_array( $attributes['class'] ) ) {
$attributes['class'][] = 'my-header-class';
} else {
$attributes['class'] = ['my-header-class'];
}
// Add 'data-is-header' HTML attribute to header with value 'y'
$attributes['data-is-header'] = 'y';
return $attributes;
} );Filter to add HTML attributes to the footer tag
add_filter( 'bricks/footer/attributes', function( $attributes ) {
// Add 'data-is-footer' HTML attribute to footer with value 'y'
$attributes['data-is-footer'] = 'y';
return $attributes;
} );Filter to add HTML attributes to the main tag
add_filter( 'bricks/content/attributes', function( $attributes ) {
// Add 'data-is-content' HTML attribute to main with value 'y'
$attributes['data-is-content'] = 'y';
return $attributes;
} );Insert HTML strings after opening main tag, before rendering bricks data.
add_filter( 'bricks/content/html_after_begin', function( $html_after_begin, $bricks_data, $attributes, $tag ) {
if ( $tag !== 'main' ) {
return $html_after_begin;
}
// Insert custom div after the main tag
$my_additional_html = '<div class="my_notification">This is my notification</div>';
return $html_after_begin . $my_additional_html;
}, 10, 4 );Insert HTML strings before closing main tag, before rendering bricks data.
add_filter( 'bricks/content/html_before_end', function( $html_after_begin, $bricks_data, $attributes, $tag ) {
if ( $tag !== 'main' ) {
return $html_after_begin;
}
// Insert custom popup HTML
$my_popup_html = '<div class="my_popup">This is my popup</div>';
return $html_after_begin . $my_popup_html;
}, 10, 4 );Insert template before header tag, before rendering bricks data.
add_action( 'bricks_before_header', function() {
echo do_shortcode( '' );
});Other Hook
// Header // do_action( 'bricks_body' ); do_action( 'bricks_before_site_wrapper' ); do_action( 'bricks_before_header' ); do_action( 'render_header' ); do_action( 'bricks_after_header' ); // FOoter // do_action( 'bricks_before_footer' ); do_action( 'render_footer' ); do_action( 'bricks_after_footer' ); do_action( 'bricks_after_site_wrapper' );
