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 610 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 your comment

 

Related Tutorials..

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…
Modifying ACF Field Value Before It Is Output

Modifying ACF Field Value Before It Is Output

Consider the scenario where a Page has a "Page Fields" field group created with ACF Pro like this: Field name: scientific_coordinators (type Repeater)|__ Sub field…
Categories:
How to create filters with IsotopeJS in Bricks (Part 4): AJAX filter and infinite loops, Sorting, List view and Disable animations

How to create filters with IsotopeJS in Bricks (Part 4): AJAX filter and infinite loops, Sorting, List view and Disable animations

This tutorial will explain how to enable the AJAX filter with an infinite scroll query loop container, how to add a sorting function, how to…
Categories:
Pro
Conditionally Hiding Bricks Filters based on Select Filter Value

Conditionally Hiding Bricks Filters based on Select Filter Value

How show or hide Bricks' filter based on the selection made by another filter.
Categories:
Tags: