Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( function_exists( 'oxygen_vsb_register_condition' ) ) {
- oxygen_vsb_register_condition(
- // Condition Name
- 'ACF Field Empty',
- // 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(),
- 'custom' => true
- ),
- // Operators
- array( '--' ),
- // Callback Function: Name of function that will be used to handle the condition
- 'acf_field_empty_fallback',
- // Condition Category: Default ones are Archive, Author, Other, Post, User
- 'ACF'
- );
- }
- /**
- * Callback function to handle the condition.
- * @param mixed $value Input value - in this case, name of ACF custom field.
- * @param string $operator Comparison operator selected by the user.
- *
- * @return boolean true or false.
- */
- function acf_field_empty_fallback( $value, $operator ) {
- return ( get_field( $value ) ) ? false : true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement