Disable Block – Hide blocks in the frontend

Description

Disable Block adds a simple button to the editor to disable the block on the frontend, hiding it from viewers.
Perfect for blocks that are not ready to be viewed by the public, but you are working on in the backend.

It adds subtle markings in the editor, so that you can easily see which blocks are disabled.

Features

  • Show or hide blocks with one click
  • Adds subtle markings and block name, so you can see which block is disabled, leaving most of the design in the editor intact.

Configuration

Just activate the plugin. The “Disable Block” button will then appear in the toolbar of each block.

Screenshots

  • The 'Disable Block' button at work in the block editor.

FAQ

Can I change the styling in the admin that marks which blocks are hidden?

Yes, of course this is possible with a filter.
Ideally do not change the “content: attr(data-spk-block-disabled);” as it creates the text for the labelling.

function change_css_styles_example_function($css)
        {
            $css = '[data-spk-block-disabled]:before {
                      color: #fff;
                      content: attr(data-spk-block-disabled);
                      z-index: 2;
                      background: #8b0000;
                      padding: 2px 6px;
                      font-size: 12px;
                      font-weight: 700;
                      position: absolute;
                      top: 0;
                      transform: translateY(calc(-100% + 1px));
                      right: 0;
                    }
                    [data-spk-block-disabled]:after {
                      z-index: 1;
                      border-top: 5px solid #8b0000;
                      border-right: 5px solid #8b0000;
                      border-radius: 0;
                      position: absolute;
                      inset: 0;
                    }';

            return $css;
        }

 add_filter('disable_block_admin_styles', 'change_css_styles_example_function', 10);

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Disable Block – Hide blocks in the frontend” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.1.0

  • Added “disable_block_admin_styles” filter, so that developers can control the styling of the hidden block markings in the editor.

1.0.0

  • Initial Release of the plugin