Last active
March 23, 2022 09:39
-
-
Save danmaby/7bda296698fe1e8c57c3673c30f0198d to your computer and use it in GitHub Desktop.
Apply Conditional Blocks PHP Logic using WordPress Pods custom settings options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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