Remove Layout Builder Elements

I’ve learned as I’ve created more themes based on this framework, it’s a pretty daunting task to make sure every element in the layout builder is styled to look right in every theoretical situation it could get placed in.

So it’s understandable that, in creating a child theme for your client, you wouldn’t necessarily need to include all of the layout builder’s elements to be available for your client.

Function Reference: themeblvd_remove_builder_element

This function will remove an element currently being used within the layout builder.

Usage
themeblvd_remove_builder_element( $element_id );
Parameters
$element_id
(string) (required) The ID for the element to be removed.
Default: None
Note: In order to remove any of the framework’s default elements, you’ll need to know the ID for the element. You can find these ID’s by viewing /includes/api/class-tb-builder-api.php of the Layout Builder plugin.
Examples

Let’s say you’re worried your client will be confused between the Blog and the Post List elements, and so you just want to remove the Post List element, all together. You’d do the following in your child theme’s functions file.

themeblvd_remove_builder_element('post_list');

Or maybe you’ve just got a whole list of elements you want to remove, to avoid confusion with your client, or even just make your personal editing experience more simple. You’d just use multiple instances of the function.

themeblvd_remove_builder_element('chart_bar');
themeblvd_remove_builder_element('chart_line');
themeblvd_remove_builder_element('chart_pie');
themeblvd_remove_builder_element('contact');
themeblvd_remove_builder_element('custom_field');
themeblvd_remove_builder_element('external');
themeblvd_remove_builder_element('map');
themeblvd_remove_builder_element('icon_box');
themeblvd_remove_builder_element('image');

If using a filter is more your style, another way to accomplish the above, would be like this.

function my_elements( $elem ) {

    unset( $elem['chart_bar'] );
    unset( $elem['chart_line'] );
    unset( $elem['chart_pie'] );
    unset( $elem['contact'] );
    unset( $elem['custom_field'] );
    unset( $elem['external'] );
    unset( $elem['map'] );
    unset( $elem['icon_box'] );
    unset( $elem['image'] );

    return $elem;
}
add_filter('themeblvd_elements', 'my_elements');