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 a Reply to Sebastian (Cancel Reply)

 

Related Tutorials..

Pro
Making a Nav Menu Item Active for Custom Post Type Single Views in WordPress

Making a Nav Menu Item Active for Custom Post Type Single Views in WordPress

Consider this scenario: CPT: project Page titled "Project" is being used to show a list/grid of all the projects rather than the CPT archive. When…
Categories:
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…
Pro
Limit the Number of Posts in a Bricks Query Loop of Relationship Type

Limit the Number of Posts in a Bricks Query Loop of Relationship Type

Updated on 12 Dec 2023 Bricks Query Loop popup does not have a control for setting the number of posts to be output when the…
Pro
Setting a Bricks template for Parent pages

Setting a Bricks template for Parent pages

This Pro tutorial shows how bricks/active_templates filter can be used to programmatically assign a Bricks template to all singular pages (of any post type) that…
Pro
How to Inject a Different Type of Post in Bricks Query Loop

How to Inject a Different Type of Post in Bricks Query Loop

Updated on 26 Aug 2024 A user asks: Hello, I'd like to inject a CPT post card inside of a Bricks query loop of a different CPT…
Removing Action/Filter Inside a Plugin’s Namespaced Class Constructor

Removing Action/Filter Inside a Plugin’s Namespaced Class Constructor

Recently worked with a friend figuring out how to remove/undo/cancel an add_action() line that's inside a plugin's constructor inside a PHP Class with the file…
Categories:
Tags: