2nd Aug '22
/
6 comments

How to hide/remove the Block Element from the Bricks Builder

Don’t like the new Block element in Bricks? Just copy/paste the following code into your child theme’s functions.php. By the way, It’s a terrible idea and expect things to break if you will call the block element in the future (nested elements or templates are just a couple of examples that come to mind).

// Remove the Block element from the builder
add_filter( 'bricks/builder/elements', function( $elements ) {

  $index = array_search( 'block', $elements );
  unset( $elements[$index] );

  return $elements;
} );

Or just hide it from the left panel using CSS (much safer):

#bricks-panel-elements-categories .bricks-add-element[data-element-name="block"] {
    display: none !important;
}

I hope this helps to get some positivity back into the Facebook community!

Note by the editor: Also see How to Exclude Elements from Bricks Editor.

Get access to all 633 Bricks code tutorials with BricksLabs Pro

6 comments

  • That feels like the wrong approach. Let's create a bad ui and than hide it.

    The block together with with container should get a new section like "layout helpers". Here would it be great to add the premade layouts that are for whatever reason not part of the elementsmenu.

    If I don't need that elements I'm able to collapse them. Done.

    Out of interest. Is that possible to solve with also some lines of code?

    • Maxime Beguin

      There is no easy way to do that - there is no filter to manipulate the $category of the element before the output. At the moment, you would have to unregister the block -> duplicate the block element in your child theme with the new $category set to "layout helpers" -> register your new custom element. This would work now, but the block element won't be updated by the new updates anymore - you'd have to manually copy/paste the changes in your child theme anytime the Bricks Team makes changes to the core files.

      • Thank you very much for your answer! That's what I was afraid of. Then I hope that the development team has a sense and improves the UI. Just the premade layouts would fit gread and the whole thing as a whole package more sense.

  • John McBade

    I think the Block element is misunderstood for when it is helpful.

    If you are an ACSS user, Kevin gives a pretty clear use case for the Blocks element in a video for ACSS customers.

    In a nutshell, the Block element quickly creates a full width div in one click instead of a few clicks. From there you can make it have any html tag you wish.

  • Pavel Janovec

    Hi, hiding elements is great, but could you make a tutorial on hiding the "Styles" tab for regular editors so that they can edit only the basic content of the element?

    • A

      I created a test user having the Editor role, then edited a Bricks-built Page whilst logged-in as that editor user and don't see the STYLE tab. Looks like it's working like you want out of the box.

Leave your comment

 

Related Tutorials..

Pro
Random Row from ACF Repeater in Bricks

Random Row from ACF Repeater in Bricks

In the past, we shared how the first row of a ACF Repeater can be output in a Bricks query loop here. This Pro tutorial…
Pro
Restrict Content Pro in Bricks

Restrict Content Pro in Bricks

This Pro tutorial provides the steps to restrict Pages and individual elements like Sections in Bricks depending on whether the current user has any active…
Pro
How to move data attributes from outer element to nested element in Bricks

How to move data attributes from outer element to nested element in Bricks

Consider a scenario where a Container/Block in Bricks is made up of image on the left side and a heading with text blurb on the…
Pro
Programmatically populating ACF field values in WordPress

Programmatically populating ACF field values in WordPress

An example of how to set the values of a Select-type field with the names and labels of all public post types.
Categories: