Skip to content

Instantly share code, notes, and snippets.

@danmaby
Last active March 23, 2022 09:39
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 danmaby/7bda296698fe1e8c57c3673c30f0198d to your computer and use it in GitHub Desktop.
Save danmaby/7bda296698fe1e8c57c3673c30f0198d to your computer and use it in GitHub Desktop.
Apply Conditional Blocks PHP Logic using WordPress Pods custom settings options
<?php
/**
* Function to determine if login blocks should show.
*
* @return boolean true/false to show the block or not.
*/
function dv_atttendee_login_open( $option_name, $defaults = array() ) {
$options = get_option('dv_event_settings_dv_settings_allow_attendee_login');
//checking if setting is empty
if ( empty( $options ) ) {
return false;
}
return true;
}
/**
* Add custom functions to be used with PHP Logic conditions.
*
* @param array $allowed_functions
* @return array $allowed_functions
*/
function custom_add_allowed_function_conditional_blocks($allowed_functions) {
array_push($allowed_functions, "dv_atttendee_login_open");
return $allowed_functions;
}
add_filter( "conditional_blocks_filter_php_logic_functions", "custom_add_allowed_function_conditional_blocks", 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment