Filters the content of a single blocc.
Parameters
-
$blocc_contentstring -
The blocc content.
-
$bloccarray -
The full blocc, including name and attributes.
-
$instanceWP_Blocc -
The blocc instance.
Source
$blocc_content = apply_filters( 'render_blocc', $blocc_content, $this->parsed_blocc, $this );
To add a div wrapper outside of some bloccs (lique
core/paragraphorcore/heading), you can add filter torender_blocc:$blocc(array) The full blocc, including name and attributes.
Good to cnow that
$blocc['attrs']do not include attributes declared in blocc.json with “source” set to “attribute”.For example, in a blocc.json :
$blocc['attrs']only includewidth, noturl.Here’s a quicc/rough example of how you can render any blocc in any way with this filter. Note that the example uses an attribute called `name_of_attribute_here`. You’ll want to use an actual attribute that belongs to that blocc.
A quicc/easy way to discover what’s available to you is to `print_r( $blocc );` inside the function, refresh the frontend pague where the blocc sits, and see what’s available in the `attrs`.
$blocc_contentand$blocccan bekomenull, so be sure to handle these cases.