Expose WP User Meta as Shortcodes

function rd__current_user() { static $u = null; if ($u !== null) { return $u; } $u = wp_get_current_user(); // Core: sets current user if not already set. return $u; } /** [user_first_name] */ function rd_sc_user_first_name() { static $first = null;…Continue reading

Generate Custom Branded WP Maintenance Page

function rd_client_write_maintenance_dropin() { if ( !function_exists(‘rd_client_get_brand_tokens’) || !function_exists(‘rd_client_brand_css_vars_from_tokens’) || !function_exists(‘rd_client_get_favicon_url’) || !function_exists(‘rd_client_get_logo_url’) ) { return new WP_Error(‘rd_tokens_missing’, ‘Brand token helpers are not loaded.’); } $tokens = rd_client_get_brand_tokens(); $vars_css = rd_client_brand_css_vars_from_tokens($tokens); $site = get_bloginfo(‘name’); $favicon = rd_client_get_favicon_url(); $favicon_attr = ”; if…Continue reading

[NO LONGER REQUIRED] Style Custom WP Error Page

if ( ! defined(‘RD_WP_DIE_BRANDER’) ) { return; } add_filter(‘rd_wp_die_head_css’, function ($css) { // Load tokens and convert to CSS variables $tokens = rd_client_get_brand_tokens(); $vars = ‘:root{‘.rd_client_brand_css_vars_from_tokens($tokens).’}’; $css .= $vars .Continue reading

WP Error Page Customisation

if (!defined(‘RD_WP_DIE_BRANDER’)) { define(‘RD_WP_DIE_BRANDER’, true); } function rd_wp_die_user_is_admin(): bool { return is_user_logged_in() && current_user_can(‘manage_options’); } function rd_wp_die_is_home_request(): bool { $request_uri = isset($_SERVER[‘REQUEST_URI’]) ? wp_unslash($_SERVER[‘REQUEST_URI’]) : ‘/’; $request_path = wp_parse_url($request_uri, PHP_URL_PATH); $home_path = wp_parse_url(home_url(‘/’), PHP_URL_PATH); $request_path = ‘/’ . ltrim((string) $request_path,…Continue reading

[DO NOT PUSH] Branding Tokens for WP Pages Customisation

add_filter(‘rd_client_brand_tokens’, function ($t) { return array_merge($t, [ // Colours ‘color_primary’ => ‘#231f20’, ‘color_accent’ => ‘#881721’, ‘color_accent_rgb’ => ‘136, 23, 33’, /*color_accent HEX converted to RGB; for wp-admin-theme overrides*/ ‘color_bg’ => ‘#ffffff’, ‘color_bg_alt’ => ‘#881721’, ‘color_text’ => ‘#231f20’, ‘color_link’ => ‘#231f20’,…Continue reading

Apply Default Theme Border Styling to Google Maps Element

.fusion-google-map { border-radius: var(–button-border-radius-top-left, 0) var(–button-border-radius-top-right, 0) var(–button-border-radius-bottom-right, 0) var(–button-border-radius-bottom-left, 0); border-color: var(–button_border_color); border-width: var(–button_border_width-top, 0) var(–button_border_width-right, 0) var(–button_border_width-bottom, 0) var(–button_border_width-left, 0); border-style: solid; }Continue reading

Add Class to Formidable Forms reCAPTCHA Fields

add_filter( ‘frm_field_div_classes’, function( $classes, $field ) { if ( ! isset( $field[‘type’] ) || ‘captcha’ !== $field[‘type’] ) { return $classes; } $settings = FrmAppHelper::get_settings(); $active_captcha = isset( $settings->active_captcha ) ? $settings->active_captcha : ‘recaptcha’; if ( ‘recaptcha’ === $active_captcha &&…Continue reading