get_css_var example



            $duotone_attr = $block['attrs']['style']['color']['duotone'];
            $is_preset    = is_string( $duotone_attr ) && self::is_preset( $duotone_attr );
            $is_css       = is_string( $duotone_attr ) && ! $is_preset;
            $is_custom    = is_array( $duotone_attr );

            if ( $is_preset ) {

                $slug         = self::get_slug_from_attribute( $duotone_attr ); // e.g. 'blue-orange'.                 $filter_id    = self::get_filter_id( $slug ); // e.g. 'wp-duotone-filter-blue-orange'.                 $filter_value = self::get_css_var( $slug ); // e.g. 'var(--wp--preset--duotone--blue-orange)'.
                // CSS custom property, SVG filter, and block CSS.                 self::enqueue_global_styles_preset( $filter_id$duotone_selector$filter_value );

            } elseif ( $is_css ) {
                $slug         = wp_unique_id( sanitize_key( $duotone_attr . '-' ) ); // e.g. 'unset-1'.                 $filter_id    = self::get_filter_id( $slug ); // e.g. 'wp-duotone-filter-unset-1'.                 $filter_value = $duotone_attr; // e.g. 'unset'.
                // Just block CSS.                 self::enqueue_block_css( $filter_id$duotone_selector$filter_value );
            }
Home | Imprint | This part of the site doesn't use cookies.