#js&&****&……PKZMMclass-astra-admin-helper.phpnu[ tag in admin page * * @param String $classes body classes returned from the filter. * @return String body classes to be added to tag in admin page */ public function admin_body_class( $classes ) { global $pagenow; $screen = get_current_screen(); if ( true === apply_filters( 'astra_block_editor_hover_effect', true ) ) { $classes .= ' ast-highlight-wpblock-onhover'; } if ( ( ( 'post-new.php' == $pagenow || 'post.php' == $pagenow ) && ( defined( 'ASTRA_ADVANCED_HOOKS_POST_TYPE' ) && ASTRA_ADVANCED_HOOKS_POST_TYPE == $screen->post_type ) ) || 'widgets.php' == $pagenow ) { return $classes; } $post_id = get_the_ID(); $is_boxed = astra_is_content_style_boxed( $post_id ); $is_sidebar_boxed = astra_is_sidebar_style_boxed( $post_id ); $classes .= $is_boxed ? ' ast-default-content-style-boxed' : ' ast-default-content-unboxed'; $classes .= $is_sidebar_boxed ? ' ast-default-sidebar-style-boxed' : ' ast-default-sidebar-unboxed'; if ( $post_id ) { $meta_content_layout = astra_toggle_layout( 'ast-site-content-layout', 'meta', $post_id ); } if ( ( isset( $meta_content_layout ) && ! empty( $meta_content_layout ) ) && 'default' !== $meta_content_layout ) { $content_layout = $meta_content_layout; } else { $content_layout = astra_toggle_layout( 'ast-site-content-layout', 'global', false ); } $editor_default_content_layout = astra_toggle_layout( 'single-' . strval( get_post_type() ) . '-ast-content-layout', 'single', false ); if ( 'default' === $editor_default_content_layout || empty( $editor_default_content_layout ) ) { // Get the GLOBAL content layout value. // NOTE: Here not used `true` in the below function call. $editor_default_content_layout = astra_toggle_layout( 'ast-site-content-layout', 'global', false ); $editor_default_content_layout = astra_apply_boxed_layouts( $editor_default_content_layout, $is_boxed, $is_sidebar_boxed, $post_id ); $classes .= ' ast-default-layout-' . $editor_default_content_layout; } else { $editor_default_content_layout = astra_apply_boxed_layouts( $editor_default_content_layout, $is_boxed, $is_sidebar_boxed, $post_id ); $classes .= ' ast-default-layout-' . $editor_default_content_layout; } $content_layout = astra_apply_boxed_layouts( $content_layout, $is_boxed, $is_sidebar_boxed, $post_id ); if ( 'content-boxed-container' == $content_layout ) { $classes .= ' ast-separate-container'; } elseif ( 'boxed-container' == $content_layout ) { $classes .= ' ast-separate-container ast-two-container'; } elseif ( 'page-builder' == $content_layout ) { $classes .= ' ast-page-builder-template'; } elseif ( 'plain-container' == $content_layout ) { $classes .= ' ast-plain-container'; } elseif ( 'narrow-container' == $content_layout ) { $classes .= ' ast-narrow-container'; } $site_layout = astra_get_option( 'site-layout' ); if ( 'ast-box-layout' === $site_layout ) { $classes .= ' ast-max-width-layout'; } // block CSS class. if ( astra_block_based_legacy_setup() ) { $classes .= ' ast-block-legacy'; } else { $classes .= ' ast-block-custom'; } $classes .= ' ast-' . astra_page_layout(); $classes .= ' ast-sidebar-default-' . astra_get_sidebar_layout_for_editor( strval( get_post_type() ) ); return $classes; } /** * List of all assets. * * @return array assets array. */ public static function theme_assets() { $default_assets = array( // handle => location ( in /assets/js/ ) ( without .js ext). 'js' => array( 'astra-theme-js' => 'style', ), // handle => location ( in /assets/css/ ) ( without .css ext). 'css' => array( 'astra-theme-css' => Astra_Builder_Helper::apply_flex_based_css() ? 'style-flex' : 'style', ), ); if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { $default_assets = array( // handle => location ( in /assets/js/ ) ( without .js ext). 'js' => array( 'astra-theme-js' => 'frontend', ), // handle => location ( in /assets/css/ ) ( without .css ext). 'css' => array( 'astra-theme-css' => Astra_Builder_Helper::apply_flex_based_css() ? 'main' : 'frontend', ), ); if ( defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, '3.5.9', '<' ) ) { $default_assets['js']['astra-theme-js-pro'] = 'frontend-pro'; } if ( ( class_exists( 'Easy_Digital_Downloads' ) && Astra_Builder_Helper::is_component_loaded( 'edd-cart', 'header' ) ) || ( class_exists( 'WooCommerce' ) && Astra_Builder_Helper::is_component_loaded( 'woo-cart', 'header' ) ) ) { $default_assets['js']['astra-mobile-cart'] = 'mobile-cart'; } /** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( ( true === Astra_Builder_Helper::$is_header_footer_builder_active && Astra_Builder_Helper::is_component_loaded( 'search', 'header' ) && astra_get_option( 'live-search', false ) ) || ( is_search() && true === astra_get_option( 'ast-search-live-search' ) ) ) { /** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $default_assets['js']['astra-live-search'] = 'live-search'; } if ( class_exists( 'WooCommerce' ) ) { if ( is_product() && astra_get_option( 'single-product-sticky-add-to-cart' ) ) { $default_assets['js']['astra-sticky-add-to-cart'] = 'sticky-add-to-cart'; } if ( ! is_customize_preview() ) { $astra_shop_add_to_cart = astra_get_option( 'shop-add-to-cart-action' ); if ( $astra_shop_add_to_cart && 'default' !== $astra_shop_add_to_cart ) { $default_assets['js']['astra-shop-add-to-cart'] = 'shop-add-to-cart'; } } /** @psalm-suppress UndefinedFunction */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $astra_add_to_cart_quantity_btn_enabled = apply_filters( 'astra_add_to_cart_quantity_btn_enabled', astra_get_option( 'single-product-plus-minus-button' ) ); if ( $astra_add_to_cart_quantity_btn_enabled ) { $default_assets['js']['astra-add-to-cart-quantity-btn'] = 'add-to-cart-quantity-btn'; } } } if ( astra_get_option( 'site-sticky-sidebar', false ) ) { $default_assets['js']['astra-sticky-sidebar'] = 'sticky-sidebar'; } return apply_filters( 'astra_theme_assets', $default_assets ); } /** * Add Fonts */ public function add_fonts() { $font_family = astra_get_option( 'body-font-family' ); $font_weight = astra_get_option( 'body-font-weight' ); $font_variant = astra_get_option( 'body-font-variant' ); Astra_Fonts::add_font( $font_family, $font_weight ); Astra_Fonts::add_font( $font_family, $font_variant ); // Render headings font. $heading_font_family = astra_get_option( 'headings-font-family' ); $heading_font_weight = astra_get_option( 'headings-font-weight' ); $heading_font_variant = astra_get_option( 'headings-font-variant' ); Astra_Fonts::add_font( $heading_font_family, $heading_font_weight ); Astra_Fonts::add_font( $heading_font_family, $heading_font_variant ); } /** * Enqueue Scripts */ public function enqueue_scripts() { if ( false === self::enqueue_theme_assets() ) { return; } /* Directory and Extension */ $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $js_uri = ASTRA_THEME_URI . 'assets/js/' . $dir_name . '/'; $css_uri = ASTRA_THEME_URI . 'assets/css/minified/'; /** * IE Only Js and CSS Files. */ // Flexibility.js for flexbox IE10 support. wp_enqueue_script( 'astra-flexibility', $js_uri . 'flexibility' . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, false ); wp_add_inline_script( 'astra-flexibility', 'flexibility(document.documentElement);' ); wp_script_add_data( 'astra-flexibility', 'conditional', 'IE' ); // Polyfill for CustomEvent for IE. wp_register_script( 'astra-customevent', $js_uri . 'custom-events-polyfill' . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, false ); wp_register_style( 'astra-galleries-css', $css_uri . 'galleries.min.css', array(), ASTRA_THEME_VERSION, 'all' ); // All assets. $all_assets = self::theme_assets(); $styles = $all_assets['css']; $scripts = $all_assets['js']; if ( is_array( $styles ) && ! empty( $styles ) ) { // Register & Enqueue Styles. foreach ( $styles as $key => $style ) { $dependency = array(); // Add dynamic CSS dependency for all styles except for theme's style.css. if ( 'astra-theme-css' !== $key && class_exists( 'Astra_Cache_Base' ) ) { if ( ! Astra_Cache_Base::inline_assets() ) { $dependency[] = 'astra-theme-dynamic'; } } // Generate CSS URL. $css_file = $css_uri . $style . '.min.css'; // Register. wp_register_style( $key, $css_file, $dependency, ASTRA_THEME_VERSION, 'all' ); // Enqueue. wp_enqueue_style( $key ); // RTL support. wp_style_add_data( $key, 'rtl', 'replace' ); } } // Fonts - Render Fonts. Astra_Fonts::render_fonts(); /** * Inline styles */ add_filter( 'astra_dynamic_theme_css', array( 'Astra_Dynamic_CSS', 'return_output' ) ); add_filter( 'astra_dynamic_theme_css', array( 'Astra_Dynamic_CSS', 'return_meta_output' ) ); $menu_animation = astra_get_option( 'header-main-submenu-container-animation' ); // Submenu Container Animation for header builder. if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { for ( $index = 1; $index <= Astra_Builder_Helper::$component_limit; $index++ ) { $menu_animation_enable = astra_get_option( 'header-menu' . $index . '-submenu-container-animation' ); if ( Astra_Builder_Helper::is_component_loaded( 'menu-' . $index, 'header' ) && ! empty( $menu_animation_enable ) ) { $menu_animation = 'is_animated'; break; } } } $rtl = ( is_rtl() ) ? '-rtl' : ''; if ( ! empty( $menu_animation ) || is_customize_preview() ) { if ( class_exists( 'Astra_Cache' ) ) { Astra_Cache::add_css_file( ASTRA_THEME_DIR . 'assets/css/minified/menu-animation' . $rtl . '.min.css' ); } else { wp_register_style( 'astra-menu-animation', $css_uri . 'menu-animation.min.css', null, ASTRA_THEME_VERSION, 'all' ); wp_enqueue_style( 'astra-menu-animation' ); } } if ( ! class_exists( 'Astra_Cache' ) ) { $theme_css_data = apply_filters( 'astra_dynamic_theme_css', '' ); wp_add_inline_style( 'astra-theme-css', $theme_css_data ); } if ( astra_is_amp_endpoint() ) { return; } // Comment assets. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } if ( is_array( $scripts ) && ! empty( $scripts ) ) { // Register & Enqueue Scripts. foreach ( $scripts as $key => $script ) { // Register. wp_register_script( $key, $js_uri . $script . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, true ); // Enqueue. wp_enqueue_script( $key ); } } /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $quantity_type = ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'woocommerce' ) ) ? astra_get_option( 'cart-plus-minus-button-type' ) : 'normal'; /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $astra_localize = array( 'break_point' => astra_header_break_point(), // Header Break Point. 'isRtl' => is_rtl(), 'is_scroll_to_id' => astra_get_option( 'enable-scroll-to-id' ), 'is_scroll_to_top' => astra_get_option( 'scroll-to-top-enable' ), 'is_header_footer_builder_active' => Astra_Builder_Helper::$is_header_footer_builder_active, 'responsive_cart_click' => astra_get_option( 'responsive-cart-click-action' ), ); wp_localize_script( 'astra-theme-js', 'astra', apply_filters( 'astra_theme_js_localize', $astra_localize ) ); $astra_qty_btn_localize = array( 'plus_qty' => __( 'Plus Quantity', 'astra' ), 'minus_qty' => __( 'Minus Quantity', 'astra' ), 'style_type' => $quantity_type, // Quantity button type. ); wp_localize_script( 'astra-add-to-cart-quantity-btn', 'astra_qty_btn', apply_filters( 'astra_qty_btn_js_localize', $astra_qty_btn_localize ) ); $astra_cart_localize_data = array( 'desktop_layout' => astra_get_option( 'woo-header-cart-click-action' ), // WooCommerce sidebar flyout desktop. 'responsive_cart_click' => astra_get_option( 'responsive-cart-click-action' ), // WooCommerce responsive devices flyout. ); wp_localize_script( 'astra-mobile-cart', 'astra_cart', apply_filters( 'astra_cart_js_localize', $astra_cart_localize_data ) ); if ( ( true === Astra_Builder_Helper::$is_header_footer_builder_active && Astra_Builder_Helper::is_component_loaded( 'search', 'header' ) && astra_get_option( 'live-search', false ) ) || ( is_search() && true === astra_get_option( 'ast-search-live-search' ) ) ) { $search_post_types = array(); $search_post_type_label = array(); $search_within_val = astra_get_option( 'live-search-post-types' ); if ( ! empty( $search_within_val ) && is_array( $search_within_val ) ) { foreach ( $search_within_val as $post_type => $value ) { if ( $value && post_type_exists( $post_type ) ) { $search_post_types[] = $post_type; /** @psalm-suppress PossiblyNullPropertyFetch */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $post_type_object = get_post_type_object( $post_type ); $search_post_type_label[ $post_type ] = is_object( $post_type_object ) && isset( $post_type_object->labels->name ) ? esc_html( $post_type_object->labels->name ) : $post_type; /** @psalm-suppress PossiblyNullPropertyFetch */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort } } } $search_page_post_types = array(); $search_page_post_type_label = array(); $search_page_within_val = astra_get_option( 'ast-search-live-search-post-types' ); if ( is_search() && ! empty( $search_page_within_val ) && is_array( $search_page_within_val ) ) { foreach ( $search_page_within_val as $post_type => $value ) { if ( $value && post_type_exists( $post_type ) ) { $search_page_post_types[] = $post_type; /** @psalm-suppress PossiblyNullPropertyFetch */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $post_type_object = get_post_type_object( $post_type ); $search_page_post_type_label[ $post_type ] = is_object( $post_type_object ) && isset( $post_type_object->labels->name ) ? esc_html( $post_type_object->labels->name ) : $post_type; /** @psalm-suppress PossiblyNullPropertyFetch */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort } } } $astra_live_search_localize_data = array( 'rest_api_url' => get_rest_url(), 'search_posts_per_page' => 5, 'search_post_types' => $search_post_types, 'search_post_types_labels' => $search_post_type_label, 'search_language' => astra_get_current_language_slug(), 'no_live_results_found' => __( 'No results found', 'astra' ), 'search_page_condition' => is_search() && true === astra_get_option( 'ast-search-live-search' ) ? true : false, 'search_page_post_types' => $search_page_post_types, 'search_page_post_type_labels' => $search_page_post_type_label, ); wp_localize_script( 'astra-live-search', 'astra_search', apply_filters( 'astra_search_js_localize', $astra_live_search_localize_data ) ); } if ( class_exists( 'woocommerce' ) ) { $is_astra_pro = function_exists( 'astra_has_pro_woocommerce_addon' ) ? astra_has_pro_woocommerce_addon() : false; $astra_shop_add_to_cart_localize_data = array( 'shop_add_to_cart_action' => astra_get_option( 'shop-add-to-cart-action' ), 'cart_url' => wc_get_cart_url(), 'checkout_url' => wc_get_checkout_url(), 'is_astra_pro' => $is_astra_pro, ); wp_localize_script( 'astra-shop-add-to-cart', 'astra_shop_add_to_cart', apply_filters( 'astra_shop_add_to_cart_js_localize', $astra_shop_add_to_cart_localize_data ) ); } $sticky_sidebar = astra_get_option( 'site-sticky-sidebar', false ); if ( $sticky_sidebar ) { /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $sticky_header_addon = ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'sticky-header' ) ); /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $astra_sticky_sidebar_localize_data = array( 'sticky_sidebar_on' => $sticky_sidebar, 'header_above_height' => astra_get_option( 'hba-header-height' ), 'header_height' => astra_get_option( 'hb-header-height' ), 'header_below_height' => astra_get_option( 'hbb-header-height' ), 'header_above_stick' => astra_get_option( 'header-above-stick', false ), 'header_main_stick' => astra_get_option( 'header-main-stick', false ), 'header_below_stick' => astra_get_option( 'header-below-stick', false ), 'sticky_header_addon' => $sticky_header_addon, 'desktop_breakpoint' => astra_get_tablet_breakpoint( '', 1 ), ); wp_localize_script( 'astra-sticky-sidebar', 'astra_sticky_sidebar', apply_filters( 'astra_sticky_sidebar_js_localize', $astra_sticky_sidebar_localize_data ) ); } } /** * Trim CSS * * @since 1.0.0 * @param string $css CSS content to trim. * @return string */ public static function trim_css( $css = '' ) { // Trim white space for faster page loading. if ( ! empty( $css ) ) { $css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css ); $css = str_replace( array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), '', $css ); $css = str_replace( ', ', ',', $css ); } return $css; } /** * Enqueue Gutenberg assets. * * @since 1.5.2 * * @return void */ public function gutenberg_assets() { /* Directory and Extension */ $rtl = ''; if ( is_rtl() ) { $rtl = '-rtl'; } $js_uri = ASTRA_THEME_URI . 'inc/assets/js/block-editor-script.js'; /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort wp_enqueue_script( 'astra-block-editor-script', $js_uri, false, ASTRA_THEME_VERSION, 'all' ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $content_bg_obj = astra_get_option( 'content-bg-obj-responsive' ); $site_bg_obj = astra_get_option( 'site-layout-outside-bg-obj-responsive' ); $site_builder_url = admin_url( 'admin.php?page=theme-builder' ); /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $is_astra_pro_colors_activated = ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'colors-and-background' ) ); /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $astra_global_palette_instance = new Astra_Global_Palette(); $astra_colors = array( 'var(--ast-global-color-0)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-0)' ), 'var(--ast-global-color-1)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-1)' ), 'var(--ast-global-color-2)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-2)' ), 'var(--ast-global-color-3)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-3)' ), 'var(--ast-global-color-4)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-4)' ), 'var(--ast-global-color-5)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-5)' ), 'var(--ast-global-color-6)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-6)' ), 'var(--ast-global-color-7)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-7)' ), 'var(--ast-global-color-8)' => $astra_global_palette_instance->get_color_by_palette_variable( 'var(--ast-global-color-8)' ), 'ast_wp_version_higher_6_3' => astra_wp_version_compare( '6.2.99', '>' ), 'ast_wp_version_higher_6_4' => astra_wp_version_compare( '6.4.99', '>' ), 'apply_content_bg_fullwidth' => astra_apply_content_background_fullwidth_layouts(), 'customizer_content_bg_obj' => $content_bg_obj, 'customizer_site_bg_obj' => $site_bg_obj, 'is_astra_pro_colors_activated' => $is_astra_pro_colors_activated, 'site_builder_url' => $site_builder_url, 'mobile_logo' => astra_get_option( 'mobile-header-logo' ), 'mobile_logo_state' => astra_get_option( 'different-mobile-logo' ), ); wp_localize_script( 'astra-block-editor-script', 'astraColors', apply_filters( 'astra_theme_root_colors', $astra_colors ) ); // Render fonts in Gutenberg layout. Astra_Fonts::render_fonts(); if ( astra_block_based_legacy_setup() ) { $css_uri = ASTRA_THEME_URI . 'inc/assets/css/block-editor-styles' . $rtl . '.css'; /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort wp_enqueue_style( 'astra-block-editor-styles', $css_uri, false, ASTRA_THEME_VERSION, 'all' ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort wp_add_inline_style( 'astra-block-editor-styles', apply_filters( 'astra_block_editor_dynamic_css', Gutenberg_Editor_CSS::get_css() ) ); } else { $css_uri = ASTRA_THEME_URI . 'inc/assets/css/wp-editor-styles' . $rtl . '.css'; /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort wp_enqueue_style( 'astra-wp-editor-styles', $css_uri, false, ASTRA_THEME_VERSION, 'all' ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort wp_add_inline_style( 'astra-wp-editor-styles', apply_filters( 'astra_block_editor_dynamic_css', Astra_WP_Editor_CSS::get_css() ) ); } } /** * Function to check if enqueuing of Astra assets are disabled. * * @since 2.1.0 * @return boolean */ public static function enqueue_theme_assets() { return apply_filters( 'astra_enqueue_theme_assets', true ); } /** * Enqueue galleries relates CSS on gallery_style filter. * * @param string $gallery_style gallery style and div. * @since 3.5.0 * @return string */ public function enqueue_galleries_style( $gallery_style ) { wp_enqueue_style( 'astra-galleries-css' ); return $gallery_style; } } new Astra_Enqueue_Scripts(); } PKZUpcpcclass-astra-admin-settings.phpnu[ '4.1.0', '4.0.2' => '4.0.0', '3.9.4' => '3.9.2', '3.9.1' => '3.9.0', '3.8.5' => '3.6.11', '3.8.4' => '3.6.10', '3.8.2' => '3.6.3', '3.7.4' => '3.6.2', '3.7.3' => '3.6.0', '3.6.9' => '3.5.8', '3.6.7' => '3.5.5', '3.6.4' => '3.5.0', '3.4.8' => '3.4.2', '3.4.2' => '3.4.0', '3.3.3' => '3.3.2', '3.3.2' => '3.3.1', '3.3.1' => '3.3.0', '3.2.0' => '3.1.0', '3.0.3' => '3.0.0', ); /** * Constructor */ public function __construct() { if ( ! is_admin() ) { return; } self::get_starter_templates_slug(); add_action( 'after_setup_theme', __CLASS__ . '::init_admin_settings', 99 ); } /** * Admin settings init */ public static function init_admin_settings() { add_action( 'admin_enqueue_scripts', __CLASS__ . '::register_scripts' ); add_action( 'customize_controls_enqueue_scripts', __CLASS__ . '::customizer_scripts' ); add_action( 'astra_notice_before_markup_astra-sites-on-active', __CLASS__ . '::load_astra_admin_script' ); add_action( 'admin_init', __CLASS__ . '::register_notices' ); add_action( 'astra_notice_before_markup', __CLASS__ . '::notice_assets' ); add_action( 'admin_init', __CLASS__ . '::minimum_addon_version_notice' ); add_action( 'admin_init', __CLASS__ . '::minimum_addon_supported_version_notice' ); if ( astra_showcase_upgrade_notices() ) { add_action( 'admin_init', __CLASS__ . '::upgrade_to_pro_wc_notice' ); add_action( 'wp_nav_menu_item_custom_fields', __CLASS__ . '::add_custom_fields', 10, 4 ); } } /** * Add custom megamenu fields data to the menu. * * @param int $id menu item id. * @param object $item A single menu item. * @param int $depth menu item depth. * @param array $args menu item arguments. * @return void * * @since 3.9.4 */ public static function add_custom_fields( $id, $item, $depth, $args ) { ?>

admin_url( 'admin-ajax.php' ), 'astraSitesLink' => admin_url( 'themes.php?page=starter-templates' ), 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '…', 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '…', 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ), 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ), 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ), 'astraPluginManagerNonce' => wp_create_nonce( 'astra_plugin_manager_nonce' ), ); wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) ); // Script. wp_enqueue_script( 'astra-admin-settings' ); } /** * Ask Theme Rating * * @since 1.4.0 */ public static function register_notices() { // Return if white labeled. /** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( astra_is_white_labelled() || ! ASTRA_THEME_ORG_VERSION || false === apply_filters( 'astra_showcase_starter_templates_notice', true ) || ! Astra_Menu::is_promoting_starter_templates() ) { /** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort return; } /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $current_slug = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort // Force Astra welcome notice on theme activation. if ( current_user_can( 'install_plugins' ) && ! defined( 'ASTRA_SITES_NAME' ) && '1' == get_option( 'fresh_site' ) && ! in_array( $current_slug, array( 'astra-advanced-hook', 'astra_adv_header' ), true ) ) { // Do not display admin welcome banner notice on theme upload page. /** @psalm-suppress InvalidGlobal */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort global $pagenow; /** @psalm-suppress InvalidGlobal */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( isset( $pagenow ) && 'update.php' === $pagenow ) { return; } $image_path = ASTRA_THEME_URI . 'inc/assets/images/astra-banner.png'; $gb_image_path = ASTRA_THEME_URI . 'inc/assets/images/gb-logo.svg'; $ele_image_path = ASTRA_THEME_URI . 'inc/assets/images/ele-logo.svg'; $bb_image_path = ASTRA_THEME_URI . 'inc/assets/images/bb-logo.jpg'; $ai_image_path = ASTRA_THEME_URI . 'inc/assets/images/ai-logo.svg'; $ast_sites_notice_btn = self::astra_sites_notice_button(); $ast_sites_notice_btn['button_text'] = __( 'Let’s Get Started with Starter Templates', 'astra' ); if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) { $ast_sites_notice_btn['class'] .= ' button button-primary'; } elseif ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) { $ast_sites_notice_btn['class'] .= ' button button-primary'; // Astra Premium Sites - Active. } else { $ast_sites_notice_btn['class'] = ' button button-primary astra-notice-close'; } $astra_sites_notice_args = array( 'id' => 'astra-sites-on-active', 'type' => 'info', 'message' => sprintf( '

%1$s

%2$s

%3$s

%13$s

Starter Templates
%14$s
', __( 'Thank you for choosing the Astra theme!', 'astra' ), __( 'Build Your Dream Site in Minutes With AI 🚀', 'astra' ), __( 'Say goodbye to the days of spending weeks designing and building your website. With Astra and our Starter Templates plugin, you can now create professional-grade websites in minutes.', 'astra' ), esc_attr( $ast_sites_notice_btn['class'] ), 'href="' . astra_get_prop( $ast_sites_notice_btn, 'link', '' ) . '"', 'data-slug="' . astra_get_prop( $ast_sites_notice_btn, 'data_slug', '' ) . '"', 'data-init="' . astra_get_prop( $ast_sites_notice_btn, 'data_init', '' ) . '"', 'data-settings-link-text="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link_text', '' ) . '"', 'data-settings-link="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link', '' ) . '"', 'data-activating-text="' . astra_get_prop( $ast_sites_notice_btn, 'activating_text', '' ) . '"', esc_html( $ast_sites_notice_btn['button_text'] ), $image_path, __( 'I want to build this website from scratch', 'astra' ), __( '280+ Templates', 'astra' ), $gb_image_path, $ele_image_path, $bb_image_path, $ai_image_path, ), 'priority' => 5, 'display-with-other-notices' => false, 'show_if' => class_exists( 'Astra_Ext_White_Label_Markup' ) ? Astra_Ext_White_Label_Markup::show_branding() : true, ); Astra_Notices::add_notice( $astra_sites_notice_args ); } } /** * Upgrade to Pro notice for Astra on WooCommerce pages. * * @since 3.9.4 */ public static function upgrade_to_pro_wc_notice() { /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $current_slug = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( '' !== $current_slug && function_exists( 'WC' ) && in_array( $current_slug, array( 'wc-admin', 'wc-reports', 'wc-status', 'wc-addons', 'wc-settings' ), true ) ) { $image_path = ASTRA_THEME_URI . 'inc/assets/images/astra-logo.svg'; $astra_sites_notice_args = array( 'id' => 'astra-upgrade-pro-wc', 'type' => 'info', 'message' => sprintf( '

%2$s

%3$s

%6$s
', $image_path, __( 'Astra Works Seamlessly with WooCommerce!', 'astra' ), __( 'Use every tool at your disposal to optimize your online store for conversion. All the advantages you need to make more profit!', 'astra' ), esc_attr( 'button button-primary' ), 'href="' . astra_get_pro_url( '/pricing/', 'free-theme', 'dashboard', 'woocommerce' ) . '" target="_blank"', __( 'Upgrade Now', 'astra' ) ), 'priority' => 5, 'show_if' => is_admin() ? true : false, 'display-with-other-notices' => false, ); Astra_Notices::add_notice( $astra_sites_notice_args ); } } /** * Display notice for minimun version for Astra addon. * * @since 2.0.0 */ public static function minimum_addon_version_notice() { if ( ! defined( 'ASTRA_EXT_VER' ) ) { return; } if ( version_compare( ASTRA_EXT_VER, ASTRA_EXT_MIN_VER ) < 0 ) { $message = sprintf( /* translators: %1$1s: Theme Name, %2$2s: Minimum Required version of the addon */ __( 'Please update the %1$1s to version %2$2s or higher. Ignore if already updated.', 'astra' ), astra_get_addon_name(), ASTRA_EXT_MIN_VER ); $min_version = get_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', true ); if ( ! $min_version ) { update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER ); } if ( version_compare( $min_version, ASTRA_EXT_MIN_VER, '!=' ) ) { delete_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice' ); update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER ); } $notice_args = array( 'id' => 'ast-minimum-addon-version-notice', 'type' => 'warning', 'message' => $message, 'show_if' => true, 'repeat-notice-after' => false, 'priority' => 18, 'display-with-other-notices' => true, ); Astra_Notices::add_notice( $notice_args ); } } /** * Get minimum supported version for Astra addon. * This function will be used to inform the user about incompatible version of Astra addon. * * @param string $input_version Input version of the addon. * * @since 4.3.0 */ public static function get_astra_addon_min_supported_version( $input_version ) { if ( defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, ASTRA_EXT_MIN_VER ) < 0 ) { return ASTRA_EXT_MIN_VER; } $supported_version = ''; // First, check if the exact version is supported if ( isset( self::$astra_addon_supported_version_map[ $input_version ] ) ) { $supported_version = self::$astra_addon_supported_version_map[ $input_version ]; } else { foreach ( self::$astra_addon_supported_version_map as $index => $supported ) { /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( '' !== $supported_version || version_compare( $input_version, $index ) > 0 ) { /** @psalm-suppress TypeDoesNotContainType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $supported_version = $supported; break; } } } return $supported_version; } /** * This constant will be used to inform the user about incompatible version of Astra addon. * * @since 4.3.0 */ public static function minimum_addon_supported_version_notice() { if ( ! defined( 'ASTRA_EXT_VER' ) ) { return; } // ASTRA_EXT_MIN_VER < ASTRA_EXT_VER && ASTRA_EXT_VER < 4.0.0. if ( version_compare( ASTRA_EXT_VER, ASTRA_EXT_MIN_VER ) >= 0 || version_compare( '4.0.0', ASTRA_EXT_VER ) < 0 ) { return; } $astra_addon_supported_version = self::get_astra_addon_min_supported_version( ASTRA_EXT_VER ); $message = sprintf( /* translators: %1$s: Plugin Name, %2$s: Theme name, %3$s: Supported required version of the addon */ 'Your current version of %1$s plugin is incompatible with %2$s theme. Please update to at least version %3$s for optimal functionality.', astra_get_addon_name(), astra_get_theme_name(), $astra_addon_supported_version ); $ext_min_supported_version = get_user_meta( get_current_user_id(), 'ast-addon-supported-version-notice', true ); if ( ! $ext_min_supported_version ) { update_user_meta( get_current_user_id(), 'ast-addon-supported-version-notice', $astra_addon_supported_version ); } if ( version_compare( $ext_min_supported_version, $astra_addon_supported_version, '!=' ) ) { delete_user_meta( get_current_user_id(), 'ast-addon-minimum-supported-version-notice' ); update_user_meta( get_current_user_id(), 'ast-addon-supported-version-notice', $astra_addon_supported_version ); } $notice_args = array( 'id' => 'ast-addon-minimum-supported-version-notice', 'type' => 'warning', 'message' => $message, 'show_if' => true, 'repeat-notice-after' => false, 'priority' => 20, 'display-with-other-notices' => false, ); Astra_Notices::add_notice( $notice_args ); } /** * Enqueue Astra Notices CSS. * * @since 2.0.0 * * @return void */ public static function notice_assets() { if ( is_rtl() ) { wp_enqueue_style( 'astra-custom-notices-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-notices-rtl.css', array(), ASTRA_THEME_VERSION ); } else { wp_enqueue_style( 'astra-custom-notices', ASTRA_THEME_URI . 'inc/assets/css/astra-notices.css', array(), ASTRA_THEME_VERSION ); } } /** * Render button for Astra Site notices * * @since 1.6.5 * @return array $ast_sites_notice_btn Rendered button */ public static function astra_sites_notice_button() { $ast_sites_notice_btn = array(); // Any of the Starter Templtes plugin - Active. if ( is_plugin_active( 'astra-pro-sites/astra-pro-sites.php' ) || is_plugin_active( 'astra-sites/astra-sites.php' ) ) { $ast_sites_notice_btn['class'] = 'active'; $ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); return $ast_sites_notice_btn; } // Starter Templates PRO Plugin - Installed but Inactive. if ( file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) { $ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin'; $ast_sites_notice_btn['data_slug'] = 'astra-pro-sites'; $ast_sites_notice_btn['data_init'] = '/astra-pro-sites/astra-pro-sites.php'; $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library »', 'astra' ); $ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '…'; return $ast_sites_notice_btn; } // Starter Templates FREE Plugin - Installed but Inactive. if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-sites.php' ) ) { $ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin'; $ast_sites_notice_btn['data_slug'] = 'astra-sites'; $ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php'; $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library »', 'astra' ); $ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '…'; return $ast_sites_notice_btn; } // Any of the Starter Templates plugin not available. if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) || ! file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) ) { $ast_sites_notice_btn['class'] = 'astra-install-recommended-plugin'; $ast_sites_notice_btn['data_slug'] = 'astra-sites'; $ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php'; $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library »', 'astra' ); $ast_sites_notice_btn['detail_link_class'] = 'plugin-detail thickbox open-plugin-details-modal astra-starter-sites-detail-link'; $ast_sites_notice_btn['detail_link'] = network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=astra-sites&TB_iframe=true&width=772&height=400' ); $ast_sites_notice_btn['detail_link_text'] = __( 'Details »', 'astra' ); return $ast_sites_notice_btn; } $ast_sites_notice_btn['class'] = 'active'; $ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug ); return $ast_sites_notice_btn; } /** * Check if installed Starter Sites plugin is new. * * @since 2.3.2 */ public static function get_starter_templates_slug() { if ( defined( 'ASTRA_PRO_SITES_VER' ) && version_compare( ASTRA_PRO_SITES_VER, '2.0.0', '>=' ) ) { self::$starter_templates_slug = 'starter-templates'; } if ( defined( 'ASTRA_SITES_VER' ) && version_compare( ASTRA_SITES_VER, '2.0.0', '>=' ) ) { self::$starter_templates_slug = 'starter-templates'; } } /** * Load the scripts and styles in the customizer controls. * * @since 1.2.1 */ public static function customizer_scripts() { $color_palettes = wp_json_encode( astra_color_palette() ); wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $color_palettes . ';' ); } /** * Register admin scripts. * * @param String $hook Screen name where the hook is fired. * @return void */ public static function register_scripts( $hook ) { if ( in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) { $post_types = get_post_types( array( 'public' => true ) ); $screen = get_current_screen(); $post_type = $screen->id; // Check if block editor is enabled or not. if ( null !== $post_type && is_callable( 'use_block_editor_for_post_type' ) && use_block_editor_for_post_type( $post_type ) && in_array( $post_type, (array) $post_types ) ) { echo ''; /** * Register admin script for missing Layout option from nested Column Blocks inside Group/Cover blocks. * * @see https://github.com/WordPress/gutenberg/issues/33374 & https://gist.github.com/Luehrsen/c4aad3b33435058c19ea80f5f1c268e8 - Remove this once the issue is fixed. * * @since 3.7.9 */ wp_enqueue_script( 'astra-column-block-comp-js', ASTRA_THEME_URI . 'inc/assets/js/column-block-compatibility.js', array( 'wp-util', 'wp-hooks', 'wp-blocks' ), ASTRA_THEME_VERSION, false ); } } } /** * Get and return page URL * * @param string $menu_slug Menu name. * @since 1.0 * @return string page url */ public static function get_page_url( $menu_slug ) { $parent_page = 'themes.php'; /** @psalm-suppress InvalidLiteralArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( strpos( $parent_page, '?' ) !== false ) { /** @psalm-suppress InvalidLiteralArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $query_var = '&page=' . Astra_Menu::get_theme_page_slug(); } else { $query_var = '?page=' . Astra_Menu::get_theme_page_slug(); } $parent_page_url = admin_url( $parent_page . $query_var ); $url = $parent_page_url . '&action=' . $menu_slug; return esc_url( $url ); } } new Astra_Admin_Settings(); } PKZU>>class-astra-wp-editor-css.phpnu[ array( 'top' => $desktop_top_block_space, 'right' => $desktop_right_block_space, 'bottom' => $desktop_bottom_block_space, 'left' => $desktop_left_block_space, ), 'tablet' => array( 'top' => $tablet_top_block_space, 'right' => $tablet_right_block_space, 'bottom' => $tablet_bottom_block_space, 'left' => $tablet_left_block_space, ), 'mobile' => array( 'top' => $mobile_top_block_space, 'right' => $mobile_right_block_space, 'bottom' => $mobile_bottom_block_space, 'left' => $mobile_left_block_space, ), ); } /** * Get dynamic CSS required for the block editor to make editing experience similar to how it looks on frontend. * * @return String CSS to be loaded in the editor interface. */ public static function get_css() { $ltr_left = is_rtl() ? 'right' : 'left'; $site_content_width = astra_get_option( 'site-content-width', 1200 ); $headings_font_family = astra_get_option( 'headings-font-family' ); $headings_font_weight = astra_get_option( 'headings-font-weight' ); $headings_text_transform = astra_get_font_extras( astra_get_option( 'headings-font-extras' ), 'text-transform' ); $headings_line_height = astra_get_font_extras( astra_get_option( 'headings-font-extras' ), 'line-height', 'line-height-unit' ); $body_font_family = astra_body_font_family(); $para_margin_bottom = astra_get_option( 'para-margin-bottom', '1.6' ); $theme_color = astra_get_option( 'theme-color' ); $heading_base_color = astra_get_option( 'heading-base-color' ); $highlight_theme_color = astra_get_foreground_color( $theme_color ); $body_font_weight = astra_get_option( 'body-font-weight' ); $body_font_size = astra_get_option( 'font-size-body' ); $body_line_height = astra_get_font_extras( astra_get_option( 'body-font-extras' ), 'line-height', 'line-height-unit' ); $body_text_transform = astra_get_font_extras( astra_get_option( 'body-font-extras' ), 'text-transform' ); $body_letter_spacing = astra_get_font_extras( astra_get_option( 'body-font-extras' ), 'letter-spacing', 'letter-spacing-unit' ); $body_text_decoration = astra_get_font_extras( astra_get_option( 'body-font-extras' ), 'text-decoration' ); $text_color = astra_get_option( 'text-color' ); $heading_h1_font_size = astra_get_option( 'font-size-h1' ); $heading_h2_font_size = astra_get_option( 'font-size-h2' ); $heading_h3_font_size = astra_get_option( 'font-size-h3' ); $heading_h4_font_size = astra_get_option( 'font-size-h4' ); $heading_h5_font_size = astra_get_option( 'font-size-h5' ); $heading_h6_font_size = astra_get_option( 'font-size-h6' ); $link_color = astra_get_option( 'link-color', $theme_color ); $link_h_color = astra_get_option( 'link-h-color' ); /** * Button theme compatibility. */ $btn_color = astra_get_option( 'button-color' ); $btn_bg_color = astra_get_option( 'button-bg-color', '', $theme_color ); $btn_h_color = astra_get_option( 'button-h-color' ); $btn_bg_h_color = astra_get_option( 'button-bg-h-color', '', $link_h_color ); $btn_border_radius_fields = astra_get_option( 'button-radius-fields' ); $theme_btn_padding = astra_get_option( 'theme-button-padding' ); $btn_border_size = astra_get_option( 'theme-button-border-group-border-size' ); $btn_border_color = astra_get_option( 'theme-button-border-group-border-color' ); $btn_border_h_color = astra_get_option( 'theme-button-border-group-border-h-color' ); $theme_btn_font_family = astra_get_option( 'font-family-button' ); $theme_btn_font_size = astra_get_option( 'font-size-button' ); $theme_btn_font_weight = astra_get_option( 'font-weight-button' ); $theme_btn_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-button' ), 'text-transform' ); $theme_btn_line_height = astra_get_font_extras( astra_get_option( 'font-extras-button' ), 'line-height', 'line-height-unit' ); $theme_btn_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-button' ), 'letter-spacing', 'letter-spacing-unit' ); $theme_btn_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-button' ), 'text-decoration' ); $theme_btn_top_border = ( isset( $btn_border_size['top'] ) && ( '' !== $btn_border_size['top'] && '0' !== $btn_border_size['top'] ) ) ? astra_get_css_value( $btn_border_size['top'], 'px' ) : ''; $theme_btn_right_border = ( isset( $btn_border_size['right'] ) && ( '' !== $btn_border_size['right'] && '0' !== $btn_border_size['right'] ) ) ? astra_get_css_value( $btn_border_size['right'], 'px' ) : ''; $theme_btn_left_border = ( isset( $btn_border_size['left'] ) && ( '' !== $btn_border_size['left'] && '0' !== $btn_border_size['left'] ) ) ? astra_get_css_value( $btn_border_size['left'], 'px' ) : ''; $theme_btn_bottom_border = ( isset( $btn_border_size['bottom'] ) && ( '' !== $btn_border_size['bottom'] && '0' !== $btn_border_size['bottom'] ) ) ? astra_get_css_value( $btn_border_size['bottom'], 'px' ) : ''; /** * Headings typography. */ $h1_font_family = astra_get_option( 'font-family-h1' ); $h1_font_weight = astra_get_option( 'font-weight-h1' ); $h1_line_height = astra_get_font_extras( astra_get_option( 'font-extras-h1' ), 'line-height', 'line-height-unit' ); $h1_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-h1' ), 'text-transform' ); $h1_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-h1' ), 'letter-spacing', 'letter-spacing-unit' ); $h1_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-h1' ), 'text-decoration' ); $h2_font_family = astra_get_option( 'font-family-h2' ); $h2_font_weight = astra_get_option( 'font-weight-h2' ); $h2_line_height = astra_get_font_extras( astra_get_option( 'font-extras-h2' ), 'line-height', 'line-height-unit' ); $h2_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-h2' ), 'text-transform' ); $h2_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-h2' ), 'letter-spacing', 'letter-spacing-unit' ); $h2_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-h2' ), 'text-decoration' ); $h3_font_family = astra_get_option( 'font-family-h3' ); $h3_font_weight = astra_get_option( 'font-weight-h3' ); $h3_line_height = astra_get_font_extras( astra_get_option( 'font-extras-h3' ), 'line-height', 'line-height-unit' ); $h3_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-h3' ), 'text-transform' ); $h3_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-h3' ), 'letter-spacing', 'letter-spacing-unit' ); $h3_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-h3' ), 'text-decoration' ); $h4_font_family = astra_get_option( 'font-family-h4' ); $h4_font_weight = astra_get_option( 'font-weight-h4' ); $h4_line_height = astra_get_font_extras( astra_get_option( 'font-extras-h4' ), 'line-height', 'line-height-unit' ); $h4_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-h4' ), 'text-transform' ); $h4_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-h4' ), 'letter-spacing', 'letter-spacing-unit' ); $h4_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-h4' ), 'text-decoration' ); $h5_font_family = astra_get_option( 'font-family-h5' ); $h5_font_weight = astra_get_option( 'font-weight-h5' ); $h5_line_height = astra_get_font_extras( astra_get_option( 'font-extras-h5' ), 'line-height', 'line-height-unit' ); $h5_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-h5' ), 'text-transform' ); $h5_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-h5' ), 'letter-spacing', 'letter-spacing-unit' ); $h5_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-h5' ), 'text-decoration' ); $h6_font_family = astra_get_option( 'font-family-h6' ); $h6_font_weight = astra_get_option( 'font-weight-h6' ); $h6_line_height = astra_get_font_extras( astra_get_option( 'font-extras-h6' ), 'line-height', 'line-height-unit' ); $h6_text_transform = astra_get_font_extras( astra_get_option( 'font-extras-h6' ), 'text-transform' ); $h6_letter_spacing = astra_get_font_extras( astra_get_option( 'font-extras-h6' ), 'letter-spacing', 'letter-spacing-unit' ); $h6_text_decoration = astra_get_font_extras( astra_get_option( 'font-extras-h6' ), 'text-decoration' ); // Fallback for H1 - headings typography. if ( 'inherit' === $h1_font_family ) { $h1_font_family = $headings_font_family; } if ( 'inherit' === $h1_font_weight && 'inherit' === $headings_font_weight ) { $h1_font_weight = 'normal'; } if ( '' == $h1_text_transform ) { $h1_text_transform = $headings_text_transform; } if ( '' == $h1_line_height ) { $h1_line_height = $headings_line_height; } // Fallback for H2 - headings typography. if ( 'inherit' === $h2_font_family ) { $h2_font_family = $headings_font_family; } if ( 'inherit' === $h2_font_weight && 'inherit' === $headings_font_weight ) { $h2_font_weight = 'normal'; } if ( '' == $h2_text_transform ) { $h2_text_transform = $headings_text_transform; } if ( '' == $h2_line_height ) { $h2_line_height = $headings_line_height; } // Fallback for H3 - headings typography. if ( 'inherit' === $h3_font_family ) { $h3_font_family = $headings_font_family; } if ( 'inherit' === $h3_font_weight && 'inherit' === $headings_font_weight ) { $h3_font_weight = 'normal'; } if ( '' == $h3_text_transform ) { $h3_text_transform = $headings_text_transform; } if ( '' == $h3_line_height ) { $h3_line_height = $headings_line_height; } // Fallback for H4 - headings typography. if ( 'inherit' === $h4_font_family ) { $h4_font_family = $headings_font_family; } if ( 'inherit' === $h4_font_weight && 'inherit' === $headings_font_weight ) { $h4_font_weight = 'normal'; } if ( '' == $h4_text_transform ) { $h4_text_transform = $headings_text_transform; } if ( '' == $h4_line_height ) { $h4_line_height = $headings_line_height; } // Fallback for H5 - headings typography. if ( 'inherit' === $h5_font_family ) { $h5_font_family = $headings_font_family; } if ( 'inherit' === $h5_font_weight && 'inherit' === $headings_font_weight ) { $h5_font_weight = 'normal'; } if ( '' == $h5_text_transform ) { $h5_text_transform = $headings_text_transform; } if ( '' == $h5_line_height ) { $h5_line_height = $headings_line_height; } // Fallback for H6 - headings typography. if ( 'inherit' === $h6_font_family ) { $h6_font_family = $headings_font_family; } if ( 'inherit' === $h6_font_weight && 'inherit' === $headings_font_weight ) { $h6_font_weight = 'normal'; } if ( '' == $h6_text_transform ) { $h6_text_transform = $headings_text_transform; } if ( '' == $h6_line_height ) { $h6_line_height = $headings_line_height; } // Fallback for button settings. if ( empty( $btn_color ) ) { $btn_color = astra_get_foreground_color( $theme_color ); } if ( empty( $btn_h_color ) ) { $btn_h_color = astra_get_foreground_color( $link_h_color ); } if ( is_array( $body_font_size ) ) { $body_font_size_desktop = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15; // Convert to appropriate pixels if the unit is 'rem'. $body_font_size_desktop = ! empty( $body_font_size['desktop-unit'] ) && $body_font_size['desktop-unit'] === 'rem' ? $body_font_size_desktop * 16 : $body_font_size_desktop; } else { $body_font_size_desktop = ( '' != $body_font_size ) ? $body_font_size : 15; } $site_background = astra_get_option( 'site-layout-outside-bg-obj-responsive' ); $content_background = astra_get_option( 'content-bg-obj-responsive' ); $background_style_data = astra_get_responsive_background_obj( $site_background, 'desktop' ); if ( empty( $background_style_data ) || ( ( empty( $background_style_data['background-color'] ) || ';' === $background_style_data['background-color'] ) && ( empty( $background_style_data['background-image'] ) && 'none;' === $background_style_data['background-image'] ) ) ) { $background_style_data = array( 'background-color' => '#f5f5f5', ); } // Site title (Page Title) on Block Editor. $post_type = strval( get_post_type() ); $site_title_font_family = astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-family', astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-text-font-family' ) ); $site_title_font_weight = astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-weight', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-weight' ) ); $site_title_font_size = astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-size', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-size' ) ); $site_title_font_extras = astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-text-font-extras' ); $site_title_text_transform = astra_get_font_extras( astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-extras', $site_title_font_extras ), 'text-transform' ); $site_title_spacing = astra_get_font_extras( astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-extras', $site_title_font_extras ), 'letter-spacing', 'letter-spacing-unit' ); $site_title_decoration = astra_get_font_extras( astra_get_option( 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-extras', $site_title_font_extras ), 'text-decoration' ); $is_widget_title_support_font_weight = Astra_Dynamic_CSS::support_font_css_to_widget_and_in_editor(); $font_weight_prop = ( $is_widget_title_support_font_weight ) ? 'inherit' : 'normal'; $btn_preset_style = astra_get_option( 'button-preset-style' ); $border_color = astra_get_option( 'border-color' ); // Fallback for Site title (Page Title). if ( 'inherit' == $site_title_font_family ) { $site_title_font_family = $headings_font_family; } if ( $font_weight_prop === $site_title_font_weight ) { $site_title_font_weight = $headings_font_weight; } if ( '' == $site_title_text_transform ) { $site_title_text_transform = '' === $headings_text_transform ? astra_get_option( 'text-transform-h1' ) : $headings_text_transform; } if ( 'inherit' == $site_title_font_weight || '' == $site_title_font_weight ) { $site_title_font_weight = Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-weight' ); } // check the selection color in-case of empty/no theme color. $selection_text_color = ( 'transparent' === $highlight_theme_color ) ? '' : $highlight_theme_color; $astra_is_block_editor_v2_ui = astra_get_option( 'wp-blocks-v2-ui', true ); $astra_container_width = $site_content_width . 'px'; $block_appender_width = $astra_is_block_editor_v2_ui ? 'var(--wp--custom--ast-content-width-size)' : 'var(--wp--custom--ast-wide-width-size)'; $astra_wide_particular_selector = $astra_is_block_editor_v2_ui ? '.editor-styles-wrapper .block-editor-block-list__layout.is-root-container .block-list-appender' : '.editor-styles-wrapper .block-editor-block-list__layout.is-root-container > p, .editor-styles-wrapper .block-editor-block-list__layout.is-root-container .block-list-appender'; $blocks_spacings = self::astra_get_block_spacings(); $color_palette_reorganize = Astra_Dynamic_CSS::astra_4_8_9_compatibility(); $desktop_top_spacing = isset( $blocks_spacings['desktop']['top'] ) ? $blocks_spacings['desktop']['top'] : ''; $desktop_right_spacing = isset( $blocks_spacings['desktop']['right'] ) ? $blocks_spacings['desktop']['right'] : ''; $desktop_bottom_spacing = isset( $blocks_spacings['desktop']['bottom'] ) ? $blocks_spacings['desktop']['bottom'] : ''; $desktop_left_spacing = isset( $blocks_spacings['desktop']['left'] ) ? $blocks_spacings['desktop']['left'] : ''; $tablet_top_spacing = isset( $blocks_spacings['tablet']['top'] ) ? $blocks_spacings['tablet']['top'] : ''; $tablet_right_spacing = isset( $blocks_spacings['tablet']['right'] ) ? $blocks_spacings['tablet']['right'] : ''; $tablet_bottom_spacing = isset( $blocks_spacings['tablet']['bottom'] ) ? $blocks_spacings['tablet']['bottom'] : ''; $tablet_left_spacing = isset( $blocks_spacings['tablet']['left'] ) ? $blocks_spacings['tablet']['left'] : ''; $mobile_top_spacing = isset( $blocks_spacings['mobile']['top'] ) ? $blocks_spacings['mobile']['top'] : ''; $mobile_right_spacing = isset( $blocks_spacings['mobile']['right'] ) ? $blocks_spacings['mobile']['right'] : ''; $mobile_bottom_spacing = isset( $blocks_spacings['mobile']['bottom'] ) ? $blocks_spacings['mobile']['bottom'] : ''; $mobile_left_spacing = isset( $blocks_spacings['mobile']['left'] ) ? $blocks_spacings['mobile']['left'] : ''; $ast_content_width = apply_filters( 'astra_block_content_width', $astra_is_block_editor_v2_ui ? $astra_container_width : '910px' ); $ast_wide_width = apply_filters( 'astra_block_wide_width', $astra_is_block_editor_v2_ui ? 'calc(' . esc_attr( $astra_container_width ) . ' + var(--wp--custom--ast-default-block-left-padding) + var(--wp--custom--ast-default-block-right-padding))' : $astra_container_width ); $ast_narrow_width = astra_get_option( 'narrow-container-max-width', apply_filters( 'astra_narrow_container_width', 750 ) ) . 'px'; $primary_color = $color_palette_reorganize ? 'var(--ast-global-color-4)' : 'var(--ast-global-color-5)'; $secondary_color = $color_palette_reorganize ? 'var(--ast-global-color-5)' : 'var(--ast-global-color-4)'; $alternate_color = $color_palette_reorganize ? 'var(--ast-global-color-6)' : 'var(--ast-global-color-7)'; $subtle_color = $color_palette_reorganize ? 'var(--ast-global-color-7)' : 'var(--ast-global-color-6)'; $css = ':root, body .editor-styles-wrapper { --wp--custom--ast-default-block-top-padding: ' . $desktop_top_spacing . '; --wp--custom--ast-default-block-right-padding: ' . $desktop_right_spacing . '; --wp--custom--ast-default-block-bottom-padding: ' . $desktop_bottom_spacing . '; --wp--custom--ast-default-block-left-padding: ' . $desktop_left_spacing . '; --wp--custom--ast-content-width-size: ' . $ast_content_width . '; --wp--custom--ast-wide-width-size: ' . $ast_wide_width . '; --ast-global-color-primary: ' . $primary_color . '; --ast-global-color-secondary: ' . $secondary_color . '; --ast-global-color-alternate-background: ' . $alternate_color . '; --ast-global-color-subtle-background: ' . $subtle_color . '; }'; $css .= '.ast-narrow-container .editor-styles-wrapper { --wp--custom--ast-content-width-size: ' . $ast_narrow_width . '; }'; // Overriding the previous CSS vars in customizer because there is block editor in customizer widget, where if any container block is used in sidebar widgets then as customizer widget editor is already small (left panel) the blocks does not looks good. if ( is_customize_preview() ) { $css = ''; } /** @psalm-suppress InvalidScalarArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $html_font_size = astra_get_font_css_value( (int) $body_font_size_desktop * 6.25, '%' ); /** @psalm-suppress InvalidScalarArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** Primary button styles */ $theme_color = astra_get_option( 'theme-color' ); $btn_border_color = astra_get_option( 'theme-button-border-group-border-color' ); $btn_bg_color = astra_get_option( 'button-bg-color', $theme_color ); $btn_border_color = astra_get_option( 'theme-button-border-group-border-color' ); $btn_border_h_color = astra_get_option( 'theme-button-border-group-border-h-color' ); $link_hover_color = astra_get_option( 'link-h-color' ); $btn_bg_hover_color = astra_get_option( 'button-bg-h-color', $link_hover_color ); // Apply button 4-6 preset styles same as frontend. if ( 'button_04' === $btn_preset_style || 'button_05' === $btn_preset_style || 'button_06' === $btn_preset_style ) { if ( empty( $btn_border_color ) ) { $btn_border_color = $btn_bg_color; } if ( '' === astra_get_option( 'button-bg-color' ) && '' === astra_get_option( 'button-color' ) ) { $btn_color = $theme_color; } elseif ( '' === astra_get_option( 'button-color' ) ) { $btn_color = $btn_bg_color; } $btn_bg_color = 'transparent'; } /** * Apply text hover color depends on link hover color */ $btn_text_hover_color = astra_get_option( 'button-h-color' ); if ( empty( $btn_text_hover_color ) ) { $btn_text_hover_color = astra_get_foreground_color( $link_hover_color ); } $desktop_css = array( ':root' => Astra_Global_Palette::generate_global_palette_style(), 'html' => array( 'font-size' => $html_font_size, ), $astra_wide_particular_selector => array( 'max-width' => esc_attr( $block_appender_width ), 'margin' => '0 auto', ), '.editor-styles-wrapper a' => array( 'color' => esc_attr( $link_color ), ), '.block-editor-block-list__block' => array( 'color' => esc_attr( $text_color ), ), '.has-text-color .block-editor-block-list__block:not(.wp-block-heading)' => array( 'color' => 'inherit', ), '.wp-block-cover:not(.has-text-color.has-link-color) .wp-block-cover__inner-container .block-editor-rich-text__editable.wp-block-paragraph' => array( 'color' => esc_attr( $text_color ), ), // Global selection CSS. '.block-editor-block-list__layout .block-editor-block-list__block ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit:before' => array( 'background-color' => esc_attr( $theme_color ), ), '.block-editor-block-list__layout .block-editor-block-list__block ::selection, .block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit' => array( 'color' => esc_attr( $selection_text_color ), ), '#editor .edit-post-visual-editor' => $background_style_data, '.editor-styles-wrapper' => astra_get_responsive_background_obj( $content_background, 'desktop' ), '.editor-styles-wrapper, #customize-controls .editor-styles-wrapper' => array( 'font-family' => astra_get_font_family( $body_font_family ), 'font-weight' => esc_attr( $body_font_weight ), 'font-size' => astra_responsive_font( $body_font_size, 'desktop' ), 'line-height' => esc_attr( $body_line_height ), 'text-transform' => esc_attr( $body_text_transform ), 'text-decoration' => esc_attr( $body_text_decoration ), 'letter-spacing' => esc_attr( $body_letter_spacing ), ), '.editor-styles-wrapper h1, .editor-styles-wrapper h2, .editor-styles-wrapper h3, .editor-styles-wrapper h4, .editor-styles-wrapper h5, .editor-styles-wrapper h6' => astra_get_font_array_css( astra_get_option( 'headings-font-family' ), astra_get_option( 'headings-font-weight' ), array(), 'headings-font-extras', $heading_base_color ), ".wp-block-cover:not([class*='background-color']):not(.has-text-color.has-link-color):not(.wp-block-cover__inner-container .wp-block-cover ). block-editor-block-list__block" => astra_get_font_array_css( astra_get_option( 'headings-font-family' ), astra_get_option( 'headings-font-weight' ), array(), 'headings-font-extras', $heading_base_color ), // Headings H1 - H6 typography. '.editor-styles-wrapper h1' => array( 'font-size' => astra_responsive_font( $heading_h1_font_size, 'desktop' ), 'font-family' => astra_get_css_value( $h1_font_family, 'font' ), 'font-weight' => astra_get_css_value( $h1_font_weight, 'font' ), 'line-height' => esc_attr( $h1_line_height ), 'text-transform' => esc_attr( $h1_text_transform ), 'text-decoration' => esc_attr( $h1_text_decoration ), 'letter-spacing' => esc_attr( $h1_letter_spacing ), ), '.editor-styles-wrapper h2' => array( 'font-size' => astra_responsive_font( $heading_h2_font_size, 'desktop' ), 'font-family' => astra_get_css_value( $h2_font_family, 'font' ), 'font-weight' => astra_get_css_value( $h2_font_weight, 'font' ), 'line-height' => esc_attr( $h2_line_height ), 'text-transform' => esc_attr( $h2_text_transform ), 'text-decoration' => esc_attr( $h2_text_decoration ), 'letter-spacing' => esc_attr( $h2_letter_spacing ), ), '.editor-styles-wrapper h3, #customize-controls .editor-styles-wrapper h3' => array( 'font-size' => astra_responsive_font( $heading_h3_font_size, 'desktop' ), 'font-family' => astra_get_css_value( $h3_font_family, 'font' ), 'font-weight' => astra_get_css_value( $h3_font_weight, 'font' ), 'line-height' => esc_attr( $h3_line_height ), 'text-transform' => esc_attr( $h3_text_transform ), 'text-decoration' => esc_attr( $h3_text_decoration ), 'letter-spacing' => esc_attr( $h3_letter_spacing ), ), '.editor-styles-wrapper h4' => array( 'font-size' => astra_responsive_font( $heading_h4_font_size, 'desktop' ), 'font-family' => astra_get_css_value( $h4_font_family, 'font' ), 'font-weight' => astra_get_css_value( $h4_font_weight, 'font' ), 'line-height' => esc_attr( $h4_line_height ), 'text-transform' => esc_attr( $h4_text_transform ), 'text-decoration' => esc_attr( $h4_text_decoration ), 'letter-spacing' => esc_attr( $h4_letter_spacing ), ), '.editor-styles-wrapper h5' => array( 'font-size' => astra_responsive_font( $heading_h5_font_size, 'desktop' ), 'font-family' => astra_get_css_value( $h5_font_family, 'font' ), 'font-weight' => astra_get_css_value( $h5_font_weight, 'font' ), 'line-height' => esc_attr( $h5_line_height ), 'text-transform' => esc_attr( $h5_text_transform ), 'text-decoration' => esc_attr( $h5_text_decoration ), 'letter-spacing' => esc_attr( $h5_letter_spacing ), ), '.editor-styles-wrapper h6' => array( 'font-size' => astra_responsive_font( $heading_h6_font_size, 'desktop' ), 'font-family' => astra_get_css_value( $h6_font_family, 'font' ), 'font-weight' => astra_get_css_value( $h6_font_weight, 'font' ), 'line-height' => esc_attr( $h6_line_height ), 'text-transform' => esc_attr( $h6_text_transform ), 'text-decoration' => esc_attr( $h6_text_decoration ), 'letter-spacing' => esc_attr( $h6_letter_spacing ), ), '.editor-styles-wrapper .block-editor-block-list__layout.is-root-container p' => array( 'margin-bottom' => astra_get_css_value( $para_margin_bottom, 'em' ), ), '.editor-styles-wrapper .wp-block-quote:not(.has-text-align-right):not(.has-text-align-center)' => array( 'border-' . esc_attr( $ltr_left ) => '5px solid rgba(0, 0, 0, 0.05)', ), // Gutenberg button compatibility for default styling. '.editor-styles-wrapper .wp-block-button:not(.is-style-outline) .wp-block-button__link, .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button, .block-editor-writing-flow .wp-block-file .wp-block-file__button, .editor-styles-wrapper button.wc-block-components-button' => array( 'border-style' => ( $theme_btn_top_border || $theme_btn_right_border || $theme_btn_left_border || $theme_btn_bottom_border ) ? 'solid' : '', 'border-top-width' => $theme_btn_top_border, 'border-right-width' => $theme_btn_right_border, 'border-left-width' => $theme_btn_left_border, 'border-bottom-width' => $theme_btn_bottom_border, 'color' => esc_attr( $btn_color ), 'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ), 'background-color' => esc_attr( $btn_bg_color ), 'font-family' => astra_get_font_family( $theme_btn_font_family ), 'font-weight' => esc_attr( $theme_btn_font_weight ), 'line-height' => esc_attr( $theme_btn_line_height ), 'text-transform' => esc_attr( $theme_btn_text_transform ), 'letter-spacing' => astra_get_css_value( $theme_btn_letter_spacing, 'px' ), 'text-decoration' => esc_attr( $theme_btn_text_decoration ), 'font-size' => astra_responsive_font( $theme_btn_font_size, 'desktop' ), 'border-top-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'top', 'desktop' ), 'border-top-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'right', 'desktop' ), 'border-bottom-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'desktop' ), 'border-bottom-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'left', 'desktop' ), 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'desktop' ), 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'desktop' ), 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'desktop' ), 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'desktop' ), ), '.wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus, .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:hover, .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:focus, .block-editor-writing-flow .wp-block-file .wp-block-file__button:hover, .block-editor-writing-flow .wp-block-file .wp-block-file__button:focus' => array( 'color' => esc_attr( $btn_h_color ), 'background-color' => esc_attr( $btn_bg_h_color ), 'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_h_color ) : esc_attr( $btn_border_h_color ), ), '.wp-block-button.is-style-outline > .wp-block-button__link:hover, .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color):hover' => array( 'color' => esc_attr( $btn_h_color ), 'background-color' => esc_attr( $btn_bg_h_color ), ), '.wp-block-button.is-style-outline > .wp-block-button__link.has-text-color' => array( 'border-color' => 'initial', ), '.wp-block-button.is-style-outline > .wp-block-button__link' => array( 'padding' => '.667em 1.333em', ), '.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color)' => array( 'color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ), ), // Margin bottom same as applied on frontend. '.editor-styles-wrapper .is-root-container.block-editor-block-list__layout > .wp-block-heading' => array( 'margin-bottom' => '20px', ), '.editor-styles-wrapper p' => array( 'line-height' => esc_attr( $body_line_height ), ), ); if ( Astra_Dynamic_CSS::astra_4_6_0_compatibility() && astra_get_option( 'single-content-images-shadow', false ) ) { $desktop_css['.wp-block-image img'] = array( 'box-shadow' => '0 0 30px 0 rgba(0,0,0,.15)', '-webkit-box-shadow' => '0 0 30px 0 rgba(0,0,0,.15)', '-moz-box-shadow' => '0 0 30px 0 rgba(0,0,0,.15)', ); } if ( Astra_Dynamic_CSS::astra_4_6_4_compatibility() ) { $desktop_css['.uagb-buttons-repeater.ast-outline-button'] = array( 'border-radius' => '9999px', ); } // Boxed, Content-Boxed, page title alignment with Spectra Container Blocks. $desktop_css['.ast-separate-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > .uagb-is-root-container'] = array( 'max-width' => 'var(--wp--custom--ast-content-width-size)', ); // Full-Width Stretched Layout page title alignment. $desktop_css['.ast-page-builder-template .edit-post-visual-editor__post-title-wrapper'] = array( 'max-width' => 'calc( 100% - 5px ) !important', ); // Full-Width Contained Layout page title wrapper crops in stacked view fix. $desktop_css['.ast-plain-container .ast-stacked-title-visibility .edit-post-visual-editor__post-title-wrapper'] = array( 'padding-left' => '3px', 'padding-right' => '3px', ); // Core / Spectra blocks compatibility to occupy same width as narrow container. $desktop_css['.ast-narrow-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container'] = array( 'max-width' => 'var(--wp--custom--ast-content-width-size)', 'margin-left' => 'auto', 'margin-right' => 'auto', ); $desktop_css['.ast-narrow-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > *.wp-block, .ast-narrow-container .is-root-container > .alignfull > :where(:not(.alignleft):not(.alignright))'] = array( 'max-width' => 'var(--wp--custom--ast-content-width-size)', 'margin-left' => 'auto', 'margin-right' => 'auto', ); $desktop_css['.ast-narrow-container .is-root-container > .alignwide > :where(:not(.alignleft):not(.alignright))'] = array( 'max-width' => 'var(--wp--custom--ast-content-width-size)', 'margin-left' => 'auto', 'margin-right' => 'auto', ); $desktop_css['.ast-narrow-container .editor-styles-wrapper .is-root-container .wp-block-uagb-image--align-full .wp-block-uagb-image__figure'] = array( 'max-width' => '100%', 'margin-left' => 'auto', 'margin-right' => 'auto', ); /** * Desktop site title. */ $desktop_css['.editor-styles-wrapper .edit-post-visual-editor__post-title-wrapper > h1'] = array( 'font-size' => astra_responsive_font( $site_title_font_size, 'desktop' ), 'font-weight' => astra_get_css_value( $site_title_font_weight, 'font' ), 'font-family' => astra_get_css_value( $site_title_font_family, 'font', $body_font_family ), 'text-transform' => esc_attr( $site_title_text_transform ), 'letter-spacing' => esc_attr( $site_title_spacing ), 'text-decoration' => esc_attr( $site_title_decoration ), ); $desktop_css['.editor-styles-wrapper .wp-block-search__input'] = array( 'padding' => '0 10px', 'border-color' => esc_attr( $border_color ), ); $desktop_css['.wp-block-table figcaption'] = array( 'text-align' => esc_attr( $ltr_left ), ); $default_border_size = '2px'; if ( astra_button_default_padding_updated() ) { $default_border_size = ''; } // Secondary button editor compatibility. $scndry_btn_text_color = astra_get_option( 'secondary-button-color' ); $scndry_btn_border_color = astra_get_option( 'secondary-theme-button-border-group-border-color' ); $scndry_btn_border_h_color = astra_get_option( 'secondary-theme-button-border-group-border-h-color' ); $global_scndry_custom_button_border_size = astra_get_option( 'secondary-theme-button-border-group-border-size' ); $scndry_theme_btn_top_border = ( isset( $global_scndry_custom_button_border_size['top'] ) && ( '' !== $global_scndry_custom_button_border_size['top'] && '0' !== $global_scndry_custom_button_border_size['top'] ) ) ? astra_get_css_value( $global_scndry_custom_button_border_size['top'], 'px' ) : $default_border_size; $scndry_theme_btn_right_border = ( isset( $global_scndry_custom_button_border_size['right'] ) && ( '' !== $global_scndry_custom_button_border_size['right'] && '0' !== $global_scndry_custom_button_border_size['right'] ) ) ? astra_get_css_value( $global_scndry_custom_button_border_size['right'], 'px' ) : $default_border_size; $scndry_theme_btn_left_border = ( isset( $global_scndry_custom_button_border_size['left'] ) && ( '' !== $global_scndry_custom_button_border_size['left'] && '0' !== $global_scndry_custom_button_border_size['left'] ) ) ? astra_get_css_value( $global_scndry_custom_button_border_size['left'], 'px' ) : $default_border_size; $scndry_theme_btn_bottom_border = ( isset( $global_scndry_custom_button_border_size['bottom'] ) && ( '' !== $global_scndry_custom_button_border_size['bottom'] && '0' !== $global_scndry_custom_button_border_size['bottom'] ) ) ? astra_get_css_value( $global_scndry_custom_button_border_size['bottom'], 'px' ) : $default_border_size; $scndry_theme_btn_font_family = astra_get_option( 'secondary-font-family-button' ); $scndry_theme_btn_font_size = astra_get_option( 'secondary-font-size-button' ); $scndry_theme_btn_font_weight = astra_get_option( 'secondary-font-weight-button' ); $scndry_theme_btn_text_transform = astra_get_font_extras( astra_get_option( 'secondary-font-extras-button' ), 'text-transform' ); $scndry_theme_btn_line_height = astra_get_font_extras( astra_get_option( 'secondary-font-extras-button' ), 'line-height', 'line-height-unit' ); $scndry_theme_btn_letter_spacing = astra_get_font_extras( astra_get_option( 'secondary-font-extras-button' ), 'letter-spacing', 'letter-spacing-unit' ); $scndry_theme_btn_text_decoration = astra_get_font_extras( astra_get_option( 'secondary-font-extras-button' ), 'text-decoration' ); $scndry_theme_btn_padding = astra_get_option( 'secondary-theme-button-padding' ); $scndry_btn_border_radius_fields = astra_get_option( 'secondary-button-radius-fields' ); $scndry_btn_bg_color = astra_get_option( 'secondary-button-bg-color' ); $scndry_btn_bg_hover_color = astra_get_option( 'secondary-button-bg-h-color' ); $scndry_btn_text_hover_color = astra_get_option( 'secondary-button-h-color' ); $scndry_btn_border_radius_top = astra_responsive_spacing( $scndry_btn_border_radius_fields, 'top', 'desktop' ); $scndry_btn_border_radius_right = astra_responsive_spacing( $scndry_btn_border_radius_fields, 'right', 'desktop' ); $scndry_btn_border_radius_bottom = astra_responsive_spacing( $scndry_btn_border_radius_fields, 'bottom', 'desktop' ); $scndry_btn_border_radius_left = astra_responsive_spacing( $scndry_btn_border_radius_fields, 'left', 'desktop' ); // Secondary color. if ( empty( $scndry_btn_text_color ) ) { $btn_color_val = empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ); } else { $btn_color_val = $scndry_btn_text_color; } // Secondary border color. if ( empty( $scndry_btn_border_color ) && empty( $scndry_btn_bg_color ) ) { $btn_border_color_val = empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ); } else { $btn_border_color_val = empty( $scndry_btn_border_color ) ? esc_attr( $scndry_btn_bg_color ) : esc_attr( $scndry_btn_border_color ); } // Secondary border hover color. if ( empty( $scndry_btn_border_h_color ) ) { $btn_border_h_color_val = empty( $btn_border_h_color ) ? esc_attr( $btn_bg_hover_color ) : esc_attr( $btn_border_h_color ); } else { $btn_border_h_color_val = $scndry_btn_border_h_color; } // Fallback to primary border radius if secondary border radius is not set. if ( empty( $scndry_btn_border_radius_top ) && empty( $scndry_btn_border_radius_right ) && empty( $scndry_btn_border_radius_bottom ) && empty( $scndry_btn_border_radius_left ) ) { $scndry_btn_border_radius_top = astra_responsive_spacing( $btn_border_radius_fields, 'top', 'desktop' ); $scndry_btn_border_radius_right = astra_responsive_spacing( $btn_border_radius_fields, 'right', 'desktop' ); $scndry_btn_border_radius_bottom = astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'desktop' ); $scndry_btn_border_radius_left = astra_responsive_spacing( $btn_border_radius_fields, 'left', 'desktop' ); } // Secondary button preset compatibility. $secondary_btn_preset_style = astra_get_option( 'secondary-button-preset-style' ); if ( 'button_04' === $secondary_btn_preset_style || 'button_05' === $secondary_btn_preset_style || 'button_06' === $secondary_btn_preset_style ) { if ( empty( $scndry_btn_border_color ) ) { $btn_border_color_val = $scndry_btn_bg_color; } if ( '' === astra_get_option( 'secondary-button-bg-color' ) && '' === astra_get_option( 'secondary-button-color' ) ) { $btn_color_val = $theme_color; } elseif ( '' === astra_get_option( 'secondary-button-color' ) ) { $btn_color_val = $scndry_btn_bg_color; } $scndry_btn_bg_color = 'transparent'; } /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $secondary_btn_desktop_font_size = is_array( $scndry_theme_btn_font_size ) && isset( $scndry_theme_btn_font_size['desktop'] ) && isset( $scndry_theme_btn_font_size['desktop-unit'] ) ? astra_get_font_css_value( $scndry_theme_btn_font_size['desktop'], $scndry_theme_btn_font_size['desktop-unit'] ) : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $outline_button_css_desktop = array( '.editor-styles-wrapper .wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link, .ast-outline-button' => array( 'border-color' => esc_attr( $btn_border_color_val ), 'border-top-width' => esc_attr( $scndry_theme_btn_top_border ), 'border-right-width' => esc_attr( $scndry_theme_btn_right_border ), 'border-bottom-width' => esc_attr( $scndry_theme_btn_bottom_border ), 'border-left-width' => esc_attr( $scndry_theme_btn_left_border ), 'font-family' => astra_get_font_family( $scndry_theme_btn_font_family ), 'font-weight' => esc_attr( $scndry_theme_btn_font_weight ), 'font-size' => esc_attr( $secondary_btn_desktop_font_size ), 'line-height' => esc_attr( $scndry_theme_btn_line_height ), 'text-transform' => esc_attr( $scndry_theme_btn_text_transform ), 'text-decoration' => esc_attr( $scndry_theme_btn_text_decoration ), 'letter-spacing' => esc_attr( $scndry_theme_btn_letter_spacing ), 'padding-top' => astra_responsive_spacing( $scndry_theme_btn_padding, 'top', 'desktop' ), 'padding-right' => astra_responsive_spacing( $scndry_theme_btn_padding, 'right', 'desktop' ), 'padding-bottom' => astra_responsive_spacing( $scndry_theme_btn_padding, 'bottom', 'desktop' ), 'padding-left' => astra_responsive_spacing( $scndry_theme_btn_padding, 'left', 'desktop' ), 'border-top-left-radius' => esc_attr( $scndry_btn_border_radius_top ), 'border-top-right-radius' => esc_attr( $scndry_btn_border_radius_right ), 'border-bottom-right-radius' => esc_attr( $scndry_btn_border_radius_bottom ), 'border-bottom-left-radius' => esc_attr( $scndry_btn_border_radius_left ), 'background-color' => empty( $scndry_btn_bg_color ) ? 'transparent' : esc_attr( $scndry_btn_bg_color ), ), '.editor-styles-wrapper .uagb-buttons-repeater.ast-outline-button' => array( 'border-top-left-radius' => esc_attr( $scndry_btn_border_radius_top ), 'border-top-right-radius' => esc_attr( $scndry_btn_border_radius_right ), 'border-bottom-right-radius' => esc_attr( $scndry_btn_border_radius_bottom ), 'border-bottom-left-radius' => esc_attr( $scndry_btn_border_radius_left ), ), '.editor-styles-wrapper .wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color), .wp-block-buttons .wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color), .ast-outline-button' => array( 'color' => esc_attr( $btn_color_val ), ), '.editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link:focus, .wp-block-buttons .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color):hover, .wp-block-buttons .wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color):hover, .ast-outline-button:hover, .ast-outline-button:focus, .editor-styles-wrapper .uagb-buttons-repeater.ast-outline-button:hover, .editor-styles-wrapper .uagb-buttons-repeater.ast-outline-button:focus' => array( 'color' => empty( $scndry_btn_text_hover_color ) ? esc_attr( $btn_text_hover_color ) : esc_attr( $scndry_btn_text_hover_color ), 'background-color' => empty( $scndry_btn_bg_hover_color ) ? esc_attr( $btn_bg_hover_color ) : esc_attr( $scndry_btn_bg_hover_color ), 'border-color' => esc_attr( $btn_border_h_color_val ), ), // Primary hover styles. '.editor-styles-wrapper .wp-block-button:not(.is-style-outline) .wp-block-button__link:hover, .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:hover, .block-editor-writing-flow .wp-block-file .wp-block-file__button:hover' => array( 'color' => esc_attr( $btn_text_hover_color ), 'background-color' => esc_attr( $btn_bg_hover_color ), 'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_hover_color ) : esc_attr( $btn_border_h_color ), ), ); // Secondary button preset compatibility. if ( 'button_01' === $secondary_btn_preset_style || 'button_02' === $secondary_btn_preset_style || 'button_03' === $secondary_btn_preset_style ) { if ( empty( $scndry_btn_text_color ) ) { $scndry_btn_text_color = astra_get_foreground_color( $theme_color ); } $outline_button_css_desktop['.wp-block-buttons .wp-block-button .wp-block-button__link.is-style-outline:not(.has-background), .wp-block-buttons .wp-block-button.is-style-outline>.wp-block-button__link:not(.has-background)'] = array( 'background-color' => empty( $scndry_btn_bg_color ) ? esc_attr( $theme_color ) : esc_attr( $scndry_btn_bg_color ), 'color' => esc_attr( $scndry_btn_text_color ), ); } $desktop_css = array_merge( $desktop_css, $outline_button_css_desktop ); $content_links_underline = astra_get_option( 'underline-content-links' ); if ( $content_links_underline ) { $desktop_css['.editor-styles-wrapper .is-root-container a'] = array( 'text-decoration' => 'underline', ); $reset_underline_from_anchors = Astra_Dynamic_CSS::unset_builder_elements_underline(); $buttons_excluded_selectors = Astra_Dynamic_CSS::astra_4_6_4_compatibility() ? '.edit-post-visual-editor a.uagb-tabs-list, .edit-post-visual-editor .uagb-ifb-cta a, .edit-post-visual-editor a.uagb-marketing-btn__link, .edit-post-visual-editor .uagb-post-grid a, .edit-post-visual-editor .uagb-toc__wrap a, .edit-post-visual-editor .uagb-taxomony-box a, .edit-post-visual-editor .uagb_review_block a, .editor-styles-wrapper .uagb-blockquote a, .editor-styles-wrapper .is-root-container .wc-block-components-product-name, .editor-styles-wrapper .is-root-container .wc-block-components-totals-coupon-link' : '.edit-post-visual-editor a.uagb-tabs-list, .edit-post-visual-editor .uagb-ifb-cta a, .edit-post-visual-editor a.uagb-marketing-btn__link, .edit-post-visual-editor .uagb-post-grid a, .edit-post-visual-editor .uagb-toc__wrap a, .edit-post-visual-editor .uagb-taxomony-box a, .edit-post-visual-editor .uagb_review_block a, .editor-styles-wrapper .uagb-blockquote a, .editor-styles-wrapper .wp-block-button:not(.is-style-outline) .wp-block-button__link, .editor-styles-wrapper .wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link, .ast-outline-button, .editor-styles-wrapper .is-root-container .wc-block-components-product-name, .editor-styles-wrapper .is-root-container .wc-block-components-totals-coupon-link'; $excluding_anchor_selectors = $reset_underline_from_anchors ? $buttons_excluded_selectors : ''; $desktop_css[ $excluding_anchor_selectors ] = array( 'text-decoration' => 'none', ); } if ( $astra_is_block_editor_v2_ui ) { $single_post_continer_spacing = astra_get_option( 'single-post-inside-spacing' ); $astra_continer_left_spacing = defined( 'ASTRA_EXT_VER' ) && astra_responsive_spacing( $single_post_continer_spacing, 'left', 'desktop' ) ? astra_responsive_spacing( $single_post_continer_spacing, 'left', 'desktop' ) : '6.67em'; $astra_continer_right_spacing = defined( 'ASTRA_EXT_VER' ) && astra_responsive_spacing( $single_post_continer_spacing, 'right', 'desktop', '6.67' ) ? astra_responsive_spacing( $single_post_continer_spacing, 'right', 'desktop', '6.67' ) : '6.67em'; $alignwide_left_negative_margin = $astra_continer_left_spacing ? 'calc(-1 * min(' . $astra_continer_left_spacing . ', 40px))' : '-40px'; $alignwide_right_negative_margin = $astra_continer_right_spacing ? 'calc(-1 * min(' . $astra_continer_right_spacing . ', 40px))' : '-40px'; $heading_width_comp = Astra_Dynamic_CSS::astra_4_8_0_compatibility() ? 'none' : 'var(--wp--custom--ast-content-width-size)'; $container_width_comp = Astra_Dynamic_CSS::astra_4_8_4_compatibility() ? 'var(--wp--custom--ast-content-width-size)' : ''; $desktop_css['.editor-styles-wrapper .wp-block-latest-posts > li > a'] = array( 'text-decoration' => 'none', 'font-size' => '1.25rem', ); $desktop_css['.ast-plain-container.ast-no-sidebar .editor-styles-wrapper .is-root-container.block-editor-block-list__layout > .alignwide.uagb-is-root-container '] = array( 'max-width' => $container_width_comp, ); $desktop_css['.ast-separate-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container .alignwide, .ast-plain-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container .alignwide'] = array( 'margin-left' => $alignwide_left_negative_margin, 'margin-right' => $alignwide_right_negative_margin, ); $desktop_css['.ast-page-builder-template .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > *.wp-block, .ast-page-builder-template .is-root-container > .alignfull:not(.wp-block-group) > :where(:not(.alignleft):not(.alignright)), .editor-styles-wrapper .is-root-container > .wp-block-cover.alignfull .wp-block-cover__image-background'] = array( 'max-width' => 'none', ); $desktop_css['.ast-page-builder-template .is-root-container > .alignwide > :where(:not(.alignleft):not(.alignright)), .editor-styles-wrapper .is-root-container > .wp-block-cover.alignwide .wp-block-cover__image-background'] = array( 'max-width' => 'var(--wp--custom--ast-wide-width-size)', ); $desktop_css['.ast-page-builder-template .is-root-container > .inherit-container-width > *, .ast-page-builder-template .is-root-container > *:not(.wp-block-group) > :where(:not(.alignleft):not(.alignright)), .is-root-container .wp-block-cover .wp-block-cover__inner-container, .editor-styles-wrapper .is-root-container > .wp-block-cover .wp-block-cover__inner-container, .is-root-container > .wp-block-cover .wp-block-cover__image-background'] = array( 'max-width' => $heading_width_comp, // phpcs:ignore WordPress.Arrays.ArrayIndentation.ItemNotAligned 'margin-right' => 'auto', // phpcs:ignore WordPress.Arrays.ArrayIndentation.ItemNotAligned 'margin-left' => 'auto', // phpcs:ignore WordPress.Arrays.ArrayIndentation.ItemNotAligned ); // phpcs:ignore WordPress.Arrays.ArrayIndentation.CloseBraceNotAligned } else { $desktop_css['.editor-styles-wrapper .wp-block-latest-posts > li > a'] = array( 'text-decoration' => 'none', 'color' => esc_attr( $heading_base_color ), ); } $tablet_css = array( ':root, body .editor-styles-wrapper' => array( '--wp--custom--ast-default-block-top-padding' => $tablet_top_spacing, '--wp--custom--ast-default-block-right-padding' => $tablet_right_spacing, '--wp--custom--ast-default-block-bottom-padding' => $tablet_bottom_spacing, '--wp--custom--ast-default-block-left-padding' => $tablet_left_spacing, ), // Heading H1 - H6 font size. '.editor-styles-wrapper h1' => array( 'font-size' => astra_responsive_font( $heading_h1_font_size, 'tablet', '30' ), ), '.editor-styles-wrapper h2' => array( 'font-size' => astra_responsive_font( $heading_h2_font_size, 'tablet', '25' ), ), '.editor-styles-wrapper h3' => array( 'font-size' => astra_responsive_font( $heading_h3_font_size, 'tablet', '20' ), ), '.editor-styles-wrapper h4' => array( 'font-size' => astra_responsive_font( $heading_h4_font_size, 'tablet' ), ), '.editor-styles-wrapper h5' => array( 'font-size' => astra_responsive_font( $heading_h5_font_size, 'tablet' ), ), '.editor-styles-wrapper h6' => array( 'font-size' => astra_responsive_font( $heading_h6_font_size, 'tablet' ), ), '.edit-post-visual-editor__post-title-wrapper' => array( 'margin-top' => '0', ), '#editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $site_background, 'tablet' ), '.editor-styles-wrapper' => astra_get_responsive_background_obj( $content_background, 'tablet' ), ); /** * Tablet site title. */ $tablet_css['.editor-styles-wrapper .edit-post-visual-editor__post-title-wrapper > h1'] = array( 'font-size' => astra_responsive_font( $site_title_font_size, 'tablet' ), ); $mobile_css = array( ':root, body .editor-styles-wrapper' => array( '--wp--custom--ast-default-block-top-padding' => $mobile_top_spacing, '--wp--custom--ast-default-block-right-padding' => $mobile_right_spacing, '--wp--custom--ast-default-block-bottom-padding' => $mobile_bottom_spacing, '--wp--custom--ast-default-block-left-padding' => $mobile_left_spacing, ), // Heading H1 - H6 font size. '.editor-styles-wrapper h1' => array( 'font-size' => astra_responsive_font( $heading_h1_font_size, 'mobile', '30' ), ), '.editor-styles-wrapper h2' => array( 'font-size' => astra_responsive_font( $heading_h2_font_size, 'mobile', '25' ), ), '.editor-styles-wrapper h3' => array( 'font-size' => astra_responsive_font( $heading_h3_font_size, 'mobile', '20' ), ), '.editor-styles-wrapper h4' => array( 'font-size' => astra_responsive_font( $heading_h4_font_size, 'mobile' ), ), '.editor-styles-wrapper h5' => array( 'font-size' => astra_responsive_font( $heading_h5_font_size, 'mobile' ), ), '.editor-styles-wrapper h6' => array( 'font-size' => astra_responsive_font( $heading_h6_font_size, 'mobile' ), ), '#editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $site_background, 'mobile' ), '.editor-styles-wrapper' => astra_get_responsive_background_obj( $content_background, 'mobile' ), ); /** * Mobile site title. */ $mobile_css['.editor-styles-wrapper .edit-post-visual-editor__post-title-wrapper > h1'] = array( 'font-size' => astra_responsive_font( $site_title_font_size, 'mobile' ), ); /** * Core blocks custom spacing support. * Case :- Do not apply custom padding for custom layout group, cover & column blocks. */ if ( 'astra-advanced-hook' !== $post_type ) { $desktop_css['.block-editor-block-list__layout.is-root-container > .wp-block-group, .block-editor-block-list__layout.is-root-container > [data-align="wide"] > .wp-block-group, .block-editor-block-list__layout.is-root-container > [data-align="full"] > .wp-block-group, .block-editor-block-list__layout.is-root-container > .wp-block-cover, .block-editor-block-list__layout.is-root-container > [data-align="wide"] > .wp-block-cover, .block-editor-block-list__layout.is-root-container > [data-align="full"] > .wp-block-cover, .block-editor-block-list__layout.is-root-container > .wp-block-columns, .block-editor-block-list__layout.is-root-container > [data-align="wide"] > .wp-block-columns, .block-editor-block-list__layout.is-root-container > [data-align="full"] > .wp-block-columns'] = array( 'padding-top' => 'var(--wp--custom--ast-default-block-top-padding)', 'padding-right' => 'var(--wp--custom--ast-default-block-right-padding)', 'padding-bottom' => 'var(--wp--custom--ast-default-block-bottom-padding)', 'padding-left' => 'var(--wp--custom--ast-default-block-left-padding)', ); } $css .= astra_parse_css( $desktop_css ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $css .= astra_parse_css( $tablet_css, '', astra_get_tablet_breakpoint() ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $css .= astra_parse_css( $mobile_css, '', astra_get_mobile_breakpoint() ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort return $css; } } PKZ_]sidebar-manager.phpnu[{$n}"; $output = apply_filters( 'astra_caret_wrap_filter', $output, $args['sort_column'] ); } /** * Outputs the beginning of the current element in the tree. * * @see Walker::start_el() * @since 1.7.2 * * @param string $output Used to append additional content. Passed by reference. * @param WP_Post $page Page data object. * @param int $depth Optional. Depth of page. Used for padding. Default 0. * @param array $args Optional. Array of arguments. Default empty array. * @param int $current_page Optional. Page ID. Default 0. */ public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) { $css_class = array( 'page_item', 'page-item-' . $page->ID ); $icon = ''; $mobile_icon = ''; if ( isset( $args['pages_with_children'][ $page->ID ] ) ) { $css_class[] = 'menu-item-has-children'; $icon = Astra_Icons::get_icons( 'arrow' ); $icon = '' . $icon . ''; // Add toggle button if menu is from Astra. if ( true === is_object( $args ) ) { if ( isset( $args->theme_location ) && ( 'primary' === $args->theme_location || 'above_header_menu' === $args->theme_location || 'below_header_menu' === $args->theme_location ) ) { $mobile_icon = ''; } } else { if ( isset( $page->post_parent ) && 0 === $page->post_parent ) { $mobile_icon = ''; } } } if ( ! empty( $current_page ) ) { $_current_page = get_post( $current_page ); if ( $_current_page && in_array( $page->ID, $_current_page->ancestors ) ) { $css_class[] = 'current-menu-ancestor'; } if ( $page->ID == $current_page ) { $css_class[] = 'current-menu-item'; } elseif ( $_current_page && $page->ID == $_current_page->post_parent ) { $css_class[] = 'current-menu-parent'; } } elseif ( get_option( 'page_for_posts' ) == $page->ID ) { $css_class[] = 'current-menu-parent'; } $css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before']; $args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after']; $output .= sprintf( '
  • %s%s%s%s%s', $css_classes, get_permalink( $page->ID ), $args['link_before'], apply_filters( 'the_title', $page->post_title, $page->ID ), // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $args['link_after'], $icon, $mobile_icon ); } } } PKZ)R##theme-hooks.phpnu[ * // Declare support for all hook types * add_theme_support( 'astra_hooks', array( 'all' ) ); * * // Declare support for certain hook types only * add_theme_support( 'astra_hooks', array( 'header', 'content', 'footer' ) ); * */ add_theme_support( 'astra_hooks', array( /** * As a Theme developer, use the 'all' parameter, to declare support for all * hook types. * Please make sure you then actually reference all the hooks in this file, * Plugin developers depend on it! */ 'all', /** * Themes can also choose to only support certain hook types. * Please make sure you then actually reference all the hooks in this type * family. * * When the 'all' parameter was set, specific hook types do not need to be * added explicitly. */ 'html', 'body', 'head', 'header', 'content', 'entry', 'comments', 'sidebars', 'sidebar', 'footer', /** * If/when WordPress Core implements similar methodology, Themes and Plugins * will be able to check whether the version of THA supplied by the theme * supports Core hooks. */ ) ); /** * Determines, whether the specific hook type is actually supported. * * Plugin developers should always check for the support of a specific * hook type before hooking a callback function to a hook of this type. * * Example: * * if ( current_theme_supports( 'astra_hooks', 'header' ) ) * add_action( 'astra_head_top', 'prefix_header_top' ); * * * @param bool $bool true. * @param array $args The hook type being checked. * @param array $registered All registered hook types. * * @return bool */ function astra_current_theme_supports( $bool, $args, $registered ) { return in_array( $args[0], $registered[0] ) || in_array( 'all', $registered[0] ); } add_filter( 'current_theme_supports-astra_hooks', 'astra_current_theme_supports', 10, 3 ); /** * HTML hook * Special case, useful for , etc. * $astra_supports[] = 'html; */ function astra_html_before() { do_action( 'astra_html_before' ); } /** * HTML hooks * $astra_supports[] = 'body'; */ function astra_body_top() { do_action( 'astra_body_top' ); } /** * Body Bottom */ function astra_body_bottom() { do_action( 'astra_body_bottom' ); } /** * HTML hooks * * $astra_supports[] = 'head'; */ function astra_head_top() { do_action( 'astra_head_top' ); } /** * Head Bottom */ function astra_head_bottom() { do_action( 'astra_head_bottom' ); } /** * Semantic
    hooks * * $astra_supports[] = 'header'; */ function astra_header_before() { do_action( 'astra_header_before' ); } /** * Site Header */ function astra_header() { do_action( 'astra_header' ); } /** * Masthead Top */ function astra_masthead_top() { do_action( 'astra_masthead_top' ); } /** * Masthead */ function astra_masthead() { do_action( 'astra_masthead' ); } /** * Masthead Bottom */ function astra_masthead_bottom() { do_action( 'astra_masthead_bottom' ); } /** * Header After */ function astra_header_after() { do_action( 'astra_header_after' ); } /** * Main Header bar top */ function astra_main_header_bar_top() { do_action( 'astra_main_header_bar_top' ); } /** * Main Header bar bottom */ function astra_main_header_bar_bottom() { do_action( 'astra_main_header_bar_bottom' ); } /** * Main Header Content */ function astra_masthead_content() { do_action( 'astra_masthead_content' ); } /** * Main toggle button before */ function astra_masthead_toggle_buttons_before() { do_action( 'astra_masthead_toggle_buttons_before' ); } /** * Main toggle buttons */ function astra_masthead_toggle_buttons() { do_action( 'astra_masthead_toggle_buttons' ); } /** * Main toggle button after */ function astra_masthead_toggle_buttons_after() { do_action( 'astra_masthead_toggle_buttons_after' ); } /** * Semantic hooks * * $astra_supports[] = 'content'; */ function astra_content_before() { do_action( 'astra_content_before' ); } /** * Content after */ function astra_content_after() { do_action( 'astra_content_after' ); } /** * Content top */ function astra_content_top() { do_action( 'astra_content_top' ); } /** * Content bottom */ function astra_content_bottom() { do_action( 'astra_content_bottom' ); } /** * Content while before */ function astra_content_while_before() { do_action( 'astra_content_while_before' ); } /** * Content loop */ function astra_content_loop() { do_action( 'astra_content_loop' ); } /** * Conten Page Loop. * * Called from page.php */ function astra_content_page_loop() { do_action( 'astra_content_page_loop' ); } /** * Content while after */ function astra_content_while_after() { do_action( 'astra_content_while_after' ); } /** * Semantic hooks * * $astra_supports[] = 'entry'; */ function astra_entry_before() { do_action( 'astra_entry_before' ); } /** * Entry after */ function astra_entry_after() { do_action( 'astra_entry_after' ); } /** * Entry content before */ function astra_entry_content_before() { do_action( 'astra_entry_content_before' ); } /** * Entry content after */ function astra_entry_content_after() { do_action( 'astra_entry_content_after' ); } /** * Entry Top */ function astra_entry_top() { do_action( 'astra_entry_top' ); } /** * Entry bottom */ function astra_entry_bottom() { do_action( 'astra_entry_bottom' ); } /** * Single Post Header Before */ function astra_single_header_before() { do_action( 'astra_single_header_before' ); } /** * Single Post Header After */ function astra_single_header_after() { do_action( 'astra_single_header_after' ); } /** * Single Post Header Top */ function astra_single_header_top() { do_action( 'astra_single_header_top' ); } /** * Single Post Header Bottom */ function astra_single_header_bottom() { do_action( 'astra_single_header_bottom' ); } /** * Comments block hooks * * $astra_supports[] = 'comments'; */ function astra_comments_before() { do_action( 'astra_comments_before' ); } /** * Comments after. */ function astra_comments_after() { do_action( 'astra_comments_after' ); } /** * Semantic hooks * * $astra_supports[] = 'sidebar'; */ function astra_sidebars_before() { do_action( 'astra_sidebars_before' ); } /** * Sidebars after */ function astra_sidebars_after() { do_action( 'astra_sidebars_after' ); } /** * Semantic