Skip to content

Instantly share code, notes, and snippets.

@Spellhammer
Created December 8, 2022 18:42
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Spellhammer/e45fba76d65234534d1261cc1e434b16 to your computer and use it in GitHub Desktop.
Save Spellhammer/e45fba76d65234534d1261cc1e434b16 to your computer and use it in GitHub Desktop.
Has Password Oxygen Condition
if( function_exists('oxygen_vsb_register_condition') ) {
global $oxy_condition_operators;
oxygen_vsb_register_condition('Has Password', array('options'=>array('true', 'false'), 'custom'=>false), array('=='), 'has_password_callback', 'Post');
function has_password_callback($value, $operator) {
if( $value == "true" && post_password_required( get_the_ID() ) ) {
return true;
} else if( $value == "false" && !post_password_required( get_the_ID() ) ) {
return true;
} else {
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment