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 630 Bricks code tutorials with BricksLabs Pro

6 comments

  • 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.

  • 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.

  • 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.

Leave a Reply to Pavel Janovec (Cancel Reply)

 

Related Tutorials..

Filtering out Media Items from “Select post/page” Bricks control

Filtering out Media Items from “Select post/page” Bricks control

The dropdown that appears after choosing "Internal post/page" when setting a link in Bricks shows media (attachment) items besides Pages, Posts and other CPTs. If…
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
Filtering a Bricks Terms query on Term archive pages

Filtering a Bricks Terms query on Term archive pages

On product category archives, how to show product type names but only those that the current product category has.