Skip to content

Instantly share code, notes, and snippets.

@Spellhammer
Spellhammer / urlparamexistscondition
Last active August 15, 2022 10:30
Check for presence of URL parameter condition for Oxygen
if( function_exists('oxygen_vsb_register_condition') ) {
global $oxy_condition_operators;
// Condition to check if a URL parameter is present.
oxygen_vsb_register_condition('URL Param Exists', array('options'=>array(), 'custom'=>true), array('--'), 'oxy_url_param_exists_callback', 'Other');
function oxy_url_param_exists_callback($value, $operator) {
if( isset($_GET[$value]) && $_GET[$value] ) {
@Spellhammer
Spellhammer / getuserfield
Created April 28, 2020 15:10
Get field from current user's Profile (ACF)
// Get field from current user's profile
function get_user_field( $field_name ) {
if( !$field_name ) { return; }
$user = "user_" . get_current_user_ID();
if( $field_name ) {
return get_field( $field_name, $user );
}
@Spellhammer
Spellhammer / gist:2b4547c36c2e2d9a8e0fa9ec84c83cf7
Last active January 25, 2022 17:51
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;