"Filter: bricks/frontend/render_element"
فیلتر bricks/frontend/render_element به شما امکان میدهد خروجی HTML هر المانی را در Bricks در قسمت جلویی تغییر دهید. این قلاب قدرتمند را میتوان برای انواع وظایف سفارشی سازی، مانند افزودن نظرات، اصلاح محتوا، یا تنظیم پویا HTML استفاده کرد. (@از نسخه 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 );