Skip to content

Instantly share code, notes, and snippets.

@Spellhammer
Last active January 25, 2022 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Spellhammer/2b4547c36c2e2d9a8e0fa9ec84c83cf7 to your computer and use it in GitHub Desktop.
Save Spellhammer/2b4547c36c2e2d9a8e0fa9ec84c83cf7 to your computer and use it in GitHub Desktop.
Post Type Condition For ACF Extended Post Types
if( function_exists('oxygen_vsb_register_condition') ) {
add_action('init', 'register_post_type_condition_acfe', 99);
function register_post_type_condition_acfe() {
$post_types = array_values(get_post_types(array('public'=>true)));
global $oxy_condition_operators;
oxygen_vsb_register_condition('ACFE Post Type',array('options'=>$post_types, 'custom'=>false), array('==', '!='), 'condition_post_type_callback_acfe', 'ACFE');
}
function condition_post_type_callback_acfe($value, $operator) {
$current_post_type = get_post_type( get_the_ID() );
$value = (string) $value;
global $OxygenConditions;
return $OxygenConditions->eval_string($current_post_type, $value, $operator);
} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment