Filter: bricks/frontend/render_element
The bricks/frontend/render_element filter allows you to modify the HTML output of any element in Bricks on the frontend. This powerful hook can be used for a variety of customization tasks, such as adding comments, modifying content, or dynamically adjusting HTML. (@since 2.0)
add_filter( 'bricks/frontend/render_element', function( $html, $element ) { // Do not modify the HTML in the builder if ( bricks_is_builder_main() || bricks_is_builder_iframe() || bricks_is_builder_call() ) { return $html; }
// Add comments before and after an element with a specific ID if ( $element->id === 'regxve' ) { $html = '<!-- Start of the element -->' . $html . '<!-- End of the element -->'; }
// Modify the content of a Basic Text element if ( $element->id === 'wtktgp' ) { // Replace "|" with ">>" in the HTML $html = str_replace( '|', '>>', $html ); }
return $html;}, 10, 2 );Was this helpful?
A quick vote and short notes help us improve these docs faster.
Leave a note for us
Please do not include passwords, license keys, or personal data. We store submitted notes to improve the docs.
Thanks for sharing feedback. We're using it to improve these docs.