Addon_Gutenberg_Editor_CSS::woo_gb_blocks_dynamic_css( string $dynamic_css, string $dynamic_css_filtered = '' )
Dynamic CSS – WooCommerce Blocks
Description
Parameters
- $dynamic_css
-
(string) (Required) Astra Gutenberg Dynamic CSS.
- $dynamic_css_filtered
-
(string) (Optional) Astra Gutenberg Dynamic CSS Filters.
Default value: ''
Return
(string)
Source
File: classes/class-addon-gutenberg-editor-css.php
public function woo_gb_blocks_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { $body_font_family = astra_body_font_family(); // Shop Typo. $shop_product_title_font_size = astra_get_option( 'font-size-shop-product-title' ); $shop_product_title_line_height = astra_get_option( 'line-height-shop-product-title' ); $shop_product_title_font_family = astra_get_option( 'font-family-shop-product-title' ); $shop_product_title_font_weight = astra_get_option( 'font-weight-shop-product-title' ); $shop_product_title_text_transform = astra_get_option( 'text-transform-shop-product-title' ); // Shop Product Title color. $shop_product_title_color = astra_get_option( 'shop-product-title-color' ); $shop_product_price_font_family = astra_get_option( 'font-family-shop-product-price' ); $shop_product_price_font_weight = astra_get_option( 'font-weight-shop-product-price' ); $shop_product_price_font_size = astra_get_option( 'font-size-shop-product-price' ); $shop_product_price_line_height = astra_get_option( 'line-height-shop-product-price' ); // Shop Product Price color. $shop_product_price_color = astra_get_option( 'shop-product-price-color' ); $theme_color = astra_get_option( 'theme-color' ); $link_color = astra_get_option( 'link-color', $theme_color ); $product_sale_style = astra_get_option( 'product-sale-style' ); /** * Set font sizes */ $css_output = array( '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-title' => array( 'font-size' => astra_responsive_font( $shop_product_title_font_size, 'desktop' ), 'line-height' => esc_attr( $shop_product_title_line_height ), 'font-weight' => astra_get_css_value( $shop_product_title_font_weight, 'font' ), 'font-family' => astra_get_css_value( $shop_product_title_font_family, 'font', $body_font_family ), 'text-transform' => esc_attr( $shop_product_title_text_transform ), 'color' => esc_attr( $shop_product_title_color ), ), '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-price' => array( 'font-family' => astra_get_css_value( $shop_product_price_font_family, 'font', $body_font_family ), 'font-weight' => astra_get_css_value( $shop_product_price_font_weight, 'font' ), 'font-size' => astra_responsive_font( $shop_product_price_font_size, 'desktop' ), 'line-height' => esc_attr( $shop_product_price_line_height ), 'color' => esc_attr( $shop_product_price_color ), ), ); /* Parse CSS from array() */ $css_output = astra_parse_css( $css_output ); $tablet_css = array( '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-title' => array( 'font-size' => astra_responsive_font( $shop_product_title_font_size, 'tablet' ), ), '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-price' => array( 'font-size' => astra_responsive_font( $shop_product_price_font_size, 'tablet' ), ), ); $css_output .= astra_parse_css( $tablet_css, '', astra_addon_get_tablet_breakpoint() ); $mobile_css = array( '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-title' => array( 'font-size' => astra_responsive_font( $shop_product_title_font_size, 'mobile' ), ), '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-price' => array( 'font-size' => astra_responsive_font( $shop_product_price_font_size, 'mobile' ), ), ); /** * Sale bubble color */ if ( 'circle-outline' == $product_sale_style ) { /** * Sale bubble color - Circle Outline */ $sale_style_css = array( '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-onsale' => array( 'line-height' => '2.7', 'background' => '#ffffff', 'border' => '2px solid ' . $link_color, 'color' => $link_color, ), ); $css_output .= astra_parse_css( $sale_style_css ); } elseif ( 'square' == $product_sale_style ) { /** * Sale bubble color - Square */ $sale_style_css = array( '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-onsale' => array( 'border-radius' => '0', 'line-height' => '3', ), ); $css_output .= astra_parse_css( $sale_style_css ); } elseif ( 'square-outline' == $product_sale_style ) { /** * Sale bubble color - Square Outline */ $sale_style_css = array( '.wc-block-grid .wc-block-grid__products .wc-block-grid__product .wc-block-grid__product-onsale' => array( 'line-height' => '3', 'background' => '#ffffff', 'border' => '2px solid ' . $link_color, 'color' => $link_color, 'border-radius' => '0', ), ); $css_output .= astra_parse_css( $sale_style_css ); } $css_output .= astra_parse_css( $mobile_css, '', astra_addon_get_mobile_breakpoint() ); return $dynamic_css . $css_output; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
2.1.2 | Introduced. |