How can I create my custom dynamic data tags for the builder?
Only on the phone, copied from my site: This should add a custom tag selection field and adds a new field to enter dynamic tags. Works for me …
<?php add_filter( "bricks/elements/heading/controls", 'bu_filter_heading_element_controls' ); function bu_filter_heading_element_controls( $controls ) { $controls['tag']['options']['custom'] = esc_html__('Custom'); $controls['customTag'] = [ 'tab' => 'content', 'label' => esc_html__( 'Custom tag', 'bricks' ), 'type' => 'text', 'inline' => true, 'placeholder' => 'div', 'required' => [ 'tag', '=', 'custom' ], ]; return $controls; }Thanks @beziehungsweise, and the function to retrieve the data? I understand this is to add the tag to the list of tags right? How can I retrieve the data from that tag?
Here is the function again, copied from desktop:
I do not understand what you exactly mean with your second question. This function registers this in Bricks Builder => see screenshot. Isn’t that what you wanted?
<?php
add_filter( "bricks/elements/heading/controls", 'bu_filter_heading_element_controls' );
function bu_filter_heading_element_controls( $controls ) {
$controls['tag']['options']['custom'] = esc_html__('Custom');
$controls['customTag'] = [
'tab' => 'content',
'label' => esc_html__( 'Custom tag', 'bricks' ),
'type' => 'text',
'inline' => true,
'placeholder' => 'div',
'required' => [ 'tag', '=', 'custom' ],
];
return $controls;
}```
Sorry @beziehungsweise this is html tag.
I meant dynamic data tag. Something like: “{my_custom_tag}” and render something with my custom functionality.
ah ok … then I misunderstood you … sorry!