The code given in the official Oxygen documentation as well as in all the tutorials on this site for registering custom conditions is supposed to be added as a Code Snippet.

There could be times when you want to instead have this code coming from a functionality plugin like My Custom Functionality.

This members-only tutorial provides information on how to register an Oxygen condition from a plugin.

If we take the Is Mobile condition as an example, you would need to change

if ( function_exists( 'oxygen_vsb_register_condition' ) ) {

	if ( ! class_exists( 'Mobile_Detect' ) ) {
		return;
	}

	oxygen_vsb_register_condition(
		// Condition Name
		'Is Mobile',

		// Values: The array of pre-set values the user can choose from.
		// Set the custom key's value to true to allow users to input custom values.
		array( 
			'options' => array( 'true', 'false' ),
			'custom' => false
		),

		// Operators
		array( '==' ),
		
		// Callback Function: Name of function that will be used to handle the condition
		'wpdd_is_mobile_fallback',

		// Condition Category: Default ones are Archive, Author, Other, Post, User
		'Other'
	);

}

to

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($37/month or $399 one-time).

Already a member? Log in below or here.

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
magnifiercross
>
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: