Supa Mike has recently created a feature request in Oxygen’s GitHub page for the Oxygen team to add an easy way to disable Sections here.

Let’s see how we can do this today using the Shortcode Wrapper with a custom shortcode that returns nothing as a workaround until this feature gets added in Oxygen.

The idea is to simply move the Sections or other Components that should be disabled inside this Shortcode Wrapper so they will not print on the front end.

This is recommended over simply setting the Display to none that will still output the entire HTML of the hidden elements on the front end.

Step 1

Install and activate Code Snippets plugin.

Step 2

Go to Snippets > Add New.

Title: Shortcode to disable Components

Code:

add_shortcode( 'disable_component', 'func_disable_component' );
/**
 * Add a custom shortcode to not return anything.
 *
 * Sample usage: [disable_component]content[/disable_component]
 *
 * @param array $atts An associative array of attributes, or an empty string if no attributes are given.
 * @param string $content The enclosed content.
 * @return void|string Enclosed content for logged in users and login form for anonymous visitors.
 */
function func_disable_component( $atts, $content = '' ) {

	return ''; // nothing.

}

Set it to run everywhere.

Save changes and activate.

Step 3

In the Oxygen editor add a Shortcode Wrapper component.

Full shortcode:

[disable_component][/disable_component]

Now move your Section(s) or any other component that you wish to disable inside/under this Shortcode Wrapper.

For the sake of convenience, you may wish to rename this to something like “Disabled Zone”.

In the above screenshot, Section # 2 will be disabled and not appear on the front end.

Need help implementing a tutorial in your site or want to hire me for custom work?

HIRE ME

Find the article helpful and wish to donate?

DONATE

Comments

For adding code blocks wrap the code in three backticks. Markdown should work.
Provide a URL of your site/webpage if something is not working.
magnifiercross
>
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: