Opens in a new tab
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
ACF Relationship Select Filter in Bricks

ACF Relationship Select Filter in Bricks

In the BricksLabs Facebook group, a user asks: I'm learning about ACF relationships and attempting to output a list of posts on any given page,…
Categories:
Pro
x Number of Random Bricks Query Loop Items(s) to be Shown Every x Hours

x Number of Random Bricks Query Loop Items(s) to be Shown Every x Hours

Showing how to display one random row of a Meta Box group for an hour and then output another random row.
Pro
Prefiltering Bricks Terms Query Loop

Prefiltering Bricks Terms Query Loop

Let's say there's a Events CPT with a 'Event Year' custom taxonomy. Sample event year names could be: 2021, 2022, 2024, 2025, 2028 etc. We…