#js&&****&……PK EmZ`B
extras.phpnu [ array(
'max-width' => '100%',
'padding-left' => '35px',
'padding-right' => '35px',
),
);
$padding_below_breakpoint = array(
'#masthead .ast-container, .ast-header-breadcrumb .ast-container' => array(
'padding-left' => '20px',
'padding-right' => '20px',
),
);
/* Parse CSS from array()*/
$dynamic_css .= astra_parse_css( $genral_global_responsive );
$dynamic_css .= astra_parse_css( $padding_below_breakpoint, '', $header_break_point );
// trim white space for faster page loading.
$dynamic_css .= Astra_Enqueue_Scripts::trim_css( $dynamic_css );
return $dynamic_css;
}
}
add_filter( 'astra_dynamic_theme_css', 'astra_header_breakpoint_style' );
/**
* Function to filter comment form arguments
*/
if ( ! function_exists( 'astra_404_page_layout' ) ) {
/**
* Function filter comment form arguments
*
* @since 1.0.0
* @param array $layout Comment form arguments.
* @return array
*/
function astra_404_page_layout( $layout ) {
if ( is_404() ) {
$layout = 'no-sidebar';
}
return apply_filters( 'astra_404_page_layout', $layout );
}
}
add_filter( 'astra_page_layout', 'astra_404_page_layout', 10, 1 );
/**
* Function to check logo component present in which Header section.
*/
if ( ! function_exists( 'astra_is_logo_in_section' ) ) {
/**
* Function filter comment form arguments
*
* @since 4.8.0
* @param array $section Logo header.
* @return array
*/
// Function to check if logo is present in a given section
function astra_is_logo_in_section( $section ) {
foreach ( $section as $components ) {
if ( in_array( 'logo', $components ) ) {
/** @psalm-suppress InvalidReturnStatement */
return true;
}
}
/** @psalm-suppress FalsableReturnStatement */
return false;
}
}
/**
* Return current content layout.
*/
if ( ! function_exists( 'astra_get_content_layout' ) ) {
/**
* Return current content layout.
*
* @since 1.0.0
* @return mixed content layout.
*/
function astra_get_content_layout() {
if ( is_singular() ) {
// Old meta layout migration to new layout.
$old_meta_content_layout = astra_get_option_meta( 'site-content-layout', '', true );
if ( $old_meta_content_layout ) {
$content_layout = astra_toggle_layout( 'ast-site-content-layout', 'meta', false, $old_meta_content_layout );
} else {
$content_layout = astra_get_option_meta( 'ast-site-content-layout', '', true );
// If post meta value is present, apply new layout option.
if ( $content_layout ) {
$content_layout = astra_toggle_layout( 'ast-site-content-layout', 'meta', false );
}
}
if ( empty( $content_layout ) ) {
$post_type = strval( get_post_type() );
$content_layout = astra_toggle_layout( 'single-' . $post_type . '-ast-content-layout', 'single', false );
if ( 'default' == $content_layout || empty( $content_layout ) ) {
// Get the GLOBAL content layout value.
// NOTE: Here not used `true` in the below function call.
$content_layout = astra_toggle_layout( 'ast-site-content-layout', 'global', false );
}
}
} else {
$content_layout = '';
$post_type = astra_get_post_type();
$content_layout = astra_toggle_layout( 'archive-' . $post_type . '-ast-content-layout', 'archive', false );
if ( is_search() ) {
$search_content_layout = astra_get_option( 'ast-search-content-layout', 'default' );
$content_layout_key = 'default' !== $search_content_layout ? 'ast-search-content-layout' : 'archive-post-ast-content-layout';
$content_layout = astra_toggle_layout( $content_layout_key, 'archive', false );
}
if ( 'default' == $content_layout || empty( $content_layout ) ) {
// Get the GLOBAL content layout value.
// NOTE: Here not used `true` in the below function call.
$content_layout = astra_toggle_layout( 'ast-site-content-layout', 'global', false );
}
}
return apply_filters( 'astra_get_content_layout', $content_layout );
}
}
/**
* Return current content layout as per new layout selection.
*
* @since 4.2.0
* @param mixed $new_content_option The new content layout option.
* @param mixed $level The level of the layout.
* @param mixed $post_id The id to fetch post meta.
* @param mixed $old_meta The old content layout option for migration cases.
* @return mixed content layout.
*/
function astra_toggle_layout( $new_content_option, $level, $post_id = false, $old_meta = false ) {
// Dynamic layout option for meta case.
$dynamic_layout_option = 'meta' === $level ? astra_get_option_meta( $new_content_option, '', true ) : astra_get_option( $new_content_option, 'post' === strval( get_post_type() ) ? 'narrow-width-container' : 'default' );
$current_layout = '';
// Get meta value by ID if specified.
if ( $post_id ) {
$dynamic_layout_option = get_post_meta( $post_id, $new_content_option, true );
}
// Meta layout migrations.
$meta_key = astra_get_option_meta( 'astra-migrate-meta-layouts', '', true );
$migrated_user = ( ! Astra_Dynamic_CSS::astra_fullwidth_sidebar_support() );
$third_party_meta_page = astra_third_party_archive_meta( 'site-content-layout' );
if ( 'meta' === $level && $migrated_user ) {
if ( false !== $third_party_meta_page ) {
$old_meta = $third_party_meta_page;
$meta_key = astra_third_party_archive_meta( 'astra-migrate-meta-layouts' );
}
if ( $old_meta && 'set' !== $meta_key ) {
$dynamic_layout_option = astra_migrate_meta_layout( $old_meta );
}
}
switch ( $dynamic_layout_option ) {
case 'normal-width-container':
$current_layout = 'plain-container';
break;
case 'narrow-width-container':
$current_layout = 'narrow-container';
// Exclude narrow layout for third party cases.
if ( astra_with_third_party() && ( ! $migrated_user ) ) {
$current_layout = 'plain-container';
}
break;
case 'full-width-container':
$current_layout = 'page-builder';
break;
default:
if ( 'meta' === $level && ! $migrated_user && 'set' !== $meta_key && $old_meta ) {
$current_layout = $old_meta;
} else {
$current_layout = $dynamic_layout_option;
}
break;
}
return $current_layout;
}
/**
* Migrate old meta layout to new layout.
*
* @since 4.2.0
* @param mixed $meta_layout Meta Layout.
* @return mixed new layout.
*/
function astra_migrate_meta_layout( $meta_layout ) {
$new_layout = '';
switch ( $meta_layout ) {
case 'boxed-container':
$new_layout = 'normal-width-container';
break;
case 'content-boxed-container':
$new_layout = 'normal-width-container';
break;
case 'plain-container':
$new_layout = 'normal-width-container';
break;
case 'page-builder':
$new_layout = 'full-width-container';
break;
case 'narrow-container':
$new_layout = 'narrow-width-container';
break;
default:
$new_layout = 'default';
break;
}
return $new_layout;
}
/**
* Function to check if it is Internet Explorer
*/
if ( ! function_exists( 'astra_check_is_ie' ) ) :
/**
* Function to check if it is Internet Explorer.
*
* @return true | false boolean
*/
function astra_check_is_ie() {
$is_ie = false;
if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
$ua = htmlentities( sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ), ENT_QUOTES, 'UTF-8' ); // phpcs:ignore WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___SERVER__HTTP_USER_AGENT__ -- Need to check if its ie.
if ( strpos( $ua, 'Trident/7.0' ) !== false ) {
$is_ie = true;
}
}
return apply_filters( 'astra_check_is_ie', $is_ie );
}
endif;
/**
* Replace header logo.
*/
if ( ! function_exists( 'astra_replace_header_logo' ) ) :
/**
* Replace header logo.
*
* @param array $image Size.
* @param int $attachment_id Image id.
* @param sting $size Size name.
* @param string $icon Icon.
*
* @return array Size of image
*/
function astra_replace_header_logo( $image, $attachment_id, $size, $icon ) {
$custom_logo_id = get_theme_mod( 'custom_logo' );
if ( ! is_customize_preview() && $custom_logo_id == $attachment_id && 'full' == $size ) {
$data = wp_get_attachment_image_src( $attachment_id, 'ast-logo-size' );
if ( false != $data ) {
$image = $data;
}
}
return apply_filters( 'astra_replace_header_logo', $image );
}
endif;
if ( ! function_exists( 'astra_strposa' ) ) :
/**
* Strpos over an array.
*
* @since 1.2.4
* @param String $haystack The string to search in.
* @param Array $needles Array of needles to be passed to strpos().
* @param integer $offset If specified, search will start this number of characters counted from the beginning of the string. If the offset is negative, the search will start this number of characters counted from the end of the string.
*
* @return bool True if haystack if part of any of the $needles.
*/
function astra_strposa( $haystack, $needles, $offset = 0 ) {
if ( ! is_array( $needles ) ) {
$needles = array( $needles );
}
foreach ( $needles as $query ) {
if ( strpos( $haystack, $query, $offset ) !== false ) {
// stop on first true result.
return true;
}
}
return false;
}
endif;
if ( ! function_exists( 'astra_get_prop' ) ) :
/**
* Get a specific property of an array without needing to check if that property exists.
*
* Provide a default value if you want to return a specific value if the property is not set.
*
* @since 1.2.7
* @link https://www.gravityforms.com/
*
* @param array $array Array from which the property's value should be retrieved.
* @param string $prop Name of the property to be retrieved.
* @param string $default Optional. Value that should be returned if the property is not set or empty. Defaults to null.
*
* @return string|mixed The value
*/
function astra_get_prop( $array, $prop, $default = null ) {
if ( ! is_array( $array ) && ! ( is_object( $array ) && $array instanceof ArrayAccess ) ) {
return $default;
}
if ( ( isset( $array[ $prop ] ) && false === $array[ $prop ] ) ) {
return false;
}
if ( isset( $array[ $prop ] ) ) {
$value = $array[ $prop ];
} else {
$value = '';
}
return empty( $value ) && null !== $default ? $default : $value;
}
endif;
/**
* Build list of attributes into a string and apply contextual filter on string.
*
* The contextual filter is of the form `astra_attr_{context}_output`.
*
* @since 1.6.2
* @credits - Genesis Theme By StudioPress.
*
* @param string $context The context, to build filter name.
* @param array $attributes Optional. Extra attributes to merge with defaults.
* @param array $args Optional. Custom data to pass to filter.
* @return string String of HTML attributes and values.
*/
function astra_attr( $context, $attributes = array(), $args = array() ) {
return Astra_Attr::get_instance()->astra_attr( $context, $attributes, $args );
}
/**
* Get the theme author details
*
* @since 3.1.0
* @return array Return theme author URL and name.
*/
function astra_get_theme_author_details() {
$theme_author = apply_filters(
'astra_theme_author',
array(
'theme_name' => esc_html__( 'Astra WordPress Theme', 'astra' ),
'theme_author_url' => ASTRA_WEBSITE_BASE_URL,
)
);
return $theme_author;
}
/**
* Add dropdown icon if menu item has children.
*
* @since 3.3.0
*
* @param string $title The menu item title.
* @param WP_Post $item All of our menu item data.
* @param stdClass $args All of our menu item args.
* @param int $depth Depth of menu item.
* @return string The menu item.
*/
function astra_dropdown_icon_to_menu_link( $title, $item, $args, $depth ) {
$role = 'application';
$icon = '';
/**
* These menus are not overriden by the 'Astra_Custom_Nav_Walker' class present in Addon - Nav Menu module.
*
* Hence skipping these menus from getting overriden by blank SVG Icons and adding the icons from theme.
*
* @since 3.3.0
*/
$astra_menu_locations = array(
'ast-hf-menu-1', // Builder - Primary menu.
'ast-hf-menu-2', // Builder - Secondary menu.
'ast-hf-menu-3',
'ast-hf-menu-4',
'ast-hf-menu-5',
'ast-hf-menu-6',
'ast-hf-menu-7',
'ast-hf-menu-8',
'ast-hf-menu-9',
'ast-hf-menu-10', // Cloned builder menus.
'ast-hf-mobile-menu', // Builder - Mobile Menu.
'ast-desktop-toggle-menu', // Builder - Toggle for Desktop Menu.
'ast-hf-account-menu', // Builder - Login Account Menu.
'primary-menu', // Old header - Primary Menu.
'above_header-menu', // Old header - Above Menu.
'below_header-menu', // Old header - Below Menu.
);
$load_svg_menu_icons = false;
if ( defined( 'ASTRA_EXT_VER' ) ) {
// Check whether Astra Pro is active + Nav menu addon is deactivate + menu registered by Astra only.
if ( ! Astra_Ext_Extension::is_active( 'nav-menu' ) && isset( $args->menu_id ) && in_array( $args->menu_id, $astra_menu_locations ) ) {
$load_svg_menu_icons = true;
}
} else {
// Check menu registered by Astra only.
if ( isset( $args->menu_id ) && in_array( $args->menu_id, $astra_menu_locations ) ) {
$load_svg_menu_icons = true;
}
}
if ( $load_svg_menu_icons || ( defined( 'ASTRA_EXT_VER' ) && ! Astra_Ext_Extension::is_active( 'nav-menu' ) ) ) {
// Assign icons to only those menu which are registered by Astra.
$icon = Astra_Icons::get_icons( 'arrow' );
}
// Dropdown svg arrow for submenu for non Astra registered menu's
$is_nav_menu_extension_inactive = defined( 'ASTRA_EXT_VER' ) && ! Astra_Ext_Extension::is_active( 'nav-menu' );
$special_menu_ids = array(
'ast-hf-menu-3',
'ast-hf-menu-4',
'ast-hf-menu-5',
'ast-hf-menu-6',
'ast-hf-menu-7',
'ast-hf-menu-8',
'ast-hf-menu-9',
'ast-hf-menu-10',
'ast-hf-menu-3-sticky',
'ast-hf-menu-4-sticky',
'ast-hf-menu-5-sticky',
'ast-hf-menu-6-sticky',
'ast-hf-menu-7-sticky',
'ast-hf-menu-8-sticky',
'ast-hf-menu-9-sticky',
'ast-hf-menu-10-sticky',
'ast-hf-account-menu',
);
$is_special_menu = isset( $args->menu_id ) && in_array( $args->menu_id, $special_menu_ids );
if ( $is_nav_menu_extension_inactive || $is_special_menu ) {
$icon = Astra_Icons::get_icons( 'arrow' );
}
$astra_arrow_icon = '';
// Render arrow icon for special menu appearance or on pro deactivation or nav menu extension deactivation.
if ( $is_special_menu || $is_nav_menu_extension_inactive || ! defined( 'ASTRA_EXT_VER' ) ) {
$custom_tabindex = true === Astra_Builder_Helper::$is_header_footer_builder_active ? 'tabindex="0"' : '';
$astra_arrow_icon = '';
}
foreach ( $item->classes as $value ) {
if ( 'menu-item-has-children' === $value ) {
$title = $title . $astra_arrow_icon;
}
}
if ( 0 < $depth ) {
$title = $icon . $title;
}
return $title;
}
if ( Astra_Icons::is_svg_icons() ) {
add_filter( 'nav_menu_item_title', 'astra_dropdown_icon_to_menu_link', 10, 4 );
}
/**
* Is theme existing header footer configs enable.
*
* @since 3.0.0
*
* @return boolean true/false.
*/
function astra_existing_header_footer_configs() {
return apply_filters( 'astra_existing_header_footer_configs', true );
}
/**
* Get Spacing value
*
* @param array $value Responsive spacing value with unit.
* @param string $operation + | - | * | /.
* @param string $from Perform operation from the value.
* @param string $from_unit Perform operation from the value of unit.
*
* @since 3.0.0
* @return mixed
*/
function astra_calculate_spacing( $value, $operation = '', $from = '', $from_unit = '' ) {
$css = '';
if ( ! empty( $value ) ) {
$css = $value;
if ( ! empty( $operation ) && ! empty( $from ) ) {
if ( ! empty( $from_unit ) ) {
$css = 'calc( ' . $value . ' ' . $operation . ' ' . $from . $from_unit . ' )';
}
if ( '*' === $operation || '/' === $operation ) {
$css = 'calc( ' . $value . ' ' . $operation . ' ' . $from . ' )';
}
}
}
return $css;
}
/**
* Generate HTML Open markup
*
* @param string $context unique markup key.
* @param array $args {
* Contains markup arguments.
* @type array attrs Initial attributes to apply to `open` markup.
* @type bool echo Flag indicating whether to echo or return the resultant string.
* }
* @since 3.3.0
* @return mixed
*/
function astra_markup_open( $context, $args = array() ) {
$defaults = array(
'open' => '',
'attrs' => array(),
'echo' => true,
'content' => '',
);
$args = wp_parse_args( $args, $defaults );
if ( $context ) {
$args = apply_filters( "astra_markup_{$context}_open", $args );
$open_tag = $args['open'] ? sprintf( $args['open'], astra_attr( $context, $args['attrs'] ) ) : '';
if ( $args['echo'] ) {
echo $open_tag; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $open_tag;
}
}
return false;
}
/**
* Generate HTML close markup
*
* @param string $context unique markup key.
* @param array $args {
* Contains markup arguments.
* @type string close Closing HTML markup.
* @type array attrs Initial attributes to apply to `open` markup.
* @type bool echo Flag indicating whether to echo or return the resultant string.
* }
* @since 3.3.0
* @return mixed
*/
function astra_markup_close( $context, $args = array() ) {
$defaults = array(
'close' => '',
'attrs' => array(),
'echo' => true,
);
$args = wp_parse_args( $args, $defaults );
if ( $context ) {
$args = apply_filters( "astra_markup_{$context}_close", $args );
$close_tag = $args['close'];
if ( $args['echo'] ) {
echo $close_tag; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $close_tag;
}
}
return false;
}
/**
* Provision to update display rules for visibility of Related Posts section in Astra.
*
* @since 3.4.0
* @return bool
*/
function astra_target_rules_for_related_posts() {
$allow_related_posts = false;
$supported_post_type = apply_filters( 'astra_related_posts_supported_post_types', 'post' );
if ( astra_get_option( 'enable-related-posts' ) && is_singular( $supported_post_type ) ) {
$allow_related_posts = true;
}
return apply_filters( 'astra_showcase_related_posts', $allow_related_posts );
}
/**
* Check if elementor plugin is active on the site.
*
* @since 3.7.0
* @return bool
*/
function astra_is_elemetor_active() {
return class_exists( '\Elementor\Plugin' );
}
/**
* Check the Astra addon version.
* For major update and frequently we used version_compare, added a function for this for easy maintenance.
*
* @param string $version Astra addon version.
* @param string $compare Compare symbols.
* @since 3.9.2
*/
function astra_addon_check_version( $version, $compare ) {
return defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, $version, $compare );
}
/**
* Get a stylesheet URL for a webfont.
*
* @since 3.6.0
*
* @param string $url The URL of the remote webfont.
* @param string $format The font-format. If you need to support IE, change this to "woff".
*
* @return string Returns the CSS.
*/
function astra_get_webfont_url( $url, $format = 'woff2' ) {
// Check if already Google font URL present or not. Basically avoiding 'Astra_WebFont_Loader' class rendering.
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$astra_font_url = astra_get_option( 'astra_font_url', false );
if ( $astra_font_url ) {
return json_decode( $astra_font_url );
}
// Now create font URL if its not present.
$font = astra_webfont_loader_instance( $url );
$font->set_font_format( $format );
return $font->get_url();
}
/**
* Get the file preloads.
*
* @param string $url The URL of the remote webfont.
* @param string $format The font-format. If you need to support IE, change this to "woff".
*/
function astra_load_preload_local_fonts( $url, $format = 'woff2' ) {
// Check if cached font files data preset present or not. Basically avoiding 'Astra_WebFont_Loader' class rendering.
$astra_local_font_files = get_site_option( 'astra_local_font_files', false );
if ( is_array( $astra_local_font_files ) && ! empty( $astra_local_font_files ) ) {
$font_format = apply_filters( 'astra_local_google_fonts_format', $format );
foreach ( $astra_local_font_files as $key => $local_font ) {
if ( $local_font ) {
echo ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Preparing HTML link tag.
}
}
return;
}
// Now preload font data after processing it, as we didn't get stored data.
$font = astra_webfont_loader_instance( $url );
$font->set_font_format( $format );
$font->preload_local_fonts();
}
/**
* Set flag to manage backward compatibility for v3.5.0 earlier users for the transparent header border bottom default value changed.
*
* @since 3.6.0
*/
function astra_get_transparent_header_default_value() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_transparent_header_default_border', isset( $astra_settings['transparent-header-default-border'] ) ? $astra_settings['transparent-header-default-border'] : true );
}
/**
* Check compatibility for content background and typography options.
*
* @since 3.7.0
*/
function astra_has_gcp_typo_preset_compatibility() {
if ( defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, '3.6.0', '<' ) ) {
return false;
}
return true;
}
/**
* Check whether user is existing or new to apply the updated default values for button padding & support GB button paddings with global button padding options.
*
* @since 3.6.3
* @return string
*/
function astra_button_default_padding_updated() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_update_button_padding_defaults', isset( $astra_settings['btn-default-padding-updated'] ) ? $astra_settings['btn-default-padding-updated'] : true );
}
/**
* Check whether user is existing or new to apply the updated default values for secondary button padding.
*
* @since 4.5.2
* @return string
*/
function astra_scndry_btn_default_padding() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_update_secondary_button_padding_defaults', isset( $astra_settings['scndry-btn-default-padding'] ) ? $astra_settings['scndry-btn-default-padding'] : true );
}
/**
* Check is WordPress version is greater than or equal to beta 5.8 version.
*
* @since 3.6.5
* @return boolean
*/
function astra_has_widgets_block_editor() {
if ( ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '10.6.2', '>' ) )
|| version_compare( get_bloginfo( 'version' ), '5.8-alpha', '>=' ) ) {
return true;
}
return false;
}
/**
* Check whether user is exising or new to override the default margin space added to Elementor-TOC widget.
*
* @since 3.6.7
* @return boolean
*/
function astra_can_remove_elementor_toc_margin_space() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_remove_elementor_toc_margin', isset( $astra_settings['remove-elementor-toc-margin-css'] ) ? false : true );
}
/**
* Check whether user is exising or new to override the hr tag styling for elementor
*
* @since 4.3.0
* @return boolean
*/
function astra_can_add_styling_for_hr() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_highlight_elementor_hr_tag', isset( $astra_settings['add-styling-for-hr'] ) ? false : true );
}
/**
* This will check if user is new and apply global color format. This is to manage backward compatibility for colors.
*
* @since 3.7.0
* @return boolean false if it is an existing user, true for new user.
*/
function astra_has_global_color_format_support() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_apply_global_color_format_support', isset( $astra_settings['support-global-color-format'] ) ? false : true );
}
/**
* Get Global Color Palettes
*
* @return array color palettes array.
* @since 3.7.0
*/
function astra_get_palette_colors() {
return get_option( 'astra-color-palettes', apply_filters( 'astra_global_color_palette', Astra_Global_Palette::get_default_color_palette() ) );
}
/**
* Get typography presets data.
*
* @return array Typography Presets data array.
* @since 3.7.0
*/
function astra_get_typography_presets() {
return get_option( 'astra-typography-presets', '' );
}
/**
* Clear Astra + Astra Pro assets cache.
*
* @since 3.6.9
* @return void
*/
function astra_clear_theme_addon_asset_cache() {
astra_clear_all_assets_cache();
}
add_action( 'astra_theme_update_after', 'astra_clear_theme_addon_asset_cache', 10 );
/**
* Check if Theme Global Colors need to be disable in Elementor global color settings.
*
* @since 3.7.4
* @return bool
*/
function astra_maybe_disable_global_color_in_elementor() {
return apply_filters( 'astra_disable_global_colors_in_elementor', false );
}
/**
* Check is Elementor Pro version is greater than or equal to beta 3.5 version.
*
* @since 3.7.5
* @return boolean
*/
function astra_check_elementor_pro_3_5_version() {
if ( defined( 'ELEMENTOR_PRO_VERSION' ) && version_compare( ELEMENTOR_PRO_VERSION, '3.5', '>=' ) ) {
return true;
}
return false;
}
/**
* Should Content BG settings apply to Fullwidth Contained/Stretched layout or not?
*
* Do not apply content background to fullwidth layouts in following cases -
* 1. For backward compatibility.
* 2. When site layout is Max-width.
* 3. When site layout is Padded.
*
* @since 3.7.8
* @return boolean
*/
function astra_apply_content_background_fullwidth_layouts() {
$astra_site_layout = astra_get_option( 'site-layout' );
$astra_apply_content_background = astra_get_option( 'apply-content-background-fullwidth-layouts', true );
return ( $astra_apply_content_background && 'ast-box-layout' !== $astra_site_layout && 'ast-padded-layout' !== $astra_site_layout );
}
/**
* Search Component static CSS.
*
* @return string
* @since 3.5.0
*/
function astra_search_static_css() {
$search_css = '
.main-header-bar .main-header-bar-navigation .ast-search-icon {
display: block;
z-index: 4;
position: relative;
}
.ast-search-icon .ast-icon {
z-index: 4;
}
.ast-search-icon {
z-index: 4;
position: relative;
line-height: normal;
}
.main-header-bar .ast-search-menu-icon .search-form {
background-color: #ffffff;
}
.ast-search-menu-icon.ast-dropdown-active.slide-search .search-form {
visibility: visible;
opacity: 1;
}
.ast-search-menu-icon .search-form {
border: 1px solid #e7e7e7;
line-height: normal;
padding: 0 3em 0 0;
border-radius: 2px;
display: inline-block;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
position: relative;
color: inherit;
background-color: #fff;
}
.ast-search-menu-icon .astra-search-icon {
-js-display: flex;
display: flex;
line-height: normal;
}
.ast-search-menu-icon .astra-search-icon:focus {
outline: none;
}
.ast-search-menu-icon .search-field {
border: none;
background-color: transparent;
transition: all .3s;
border-radius: inherit;
color: inherit;
font-size: inherit;
width: 0;
color: #757575;
}
.ast-search-menu-icon .search-submit {
display: none;
background: none;
border: none;
font-size: 1.3em;
color: #757575;
}
.ast-search-menu-icon.ast-dropdown-active {
visibility: visible;
opacity: 1;
position: relative;
}
.ast-search-menu-icon.ast-dropdown-active .search-field, .ast-dropdown-active.ast-search-menu-icon.slide-search input.search-field {
width: 235px;
}
.ast-header-search .ast-search-menu-icon.slide-search .search-form, .ast-header-search .ast-search-menu-icon.ast-inline-search .search-form {
-js-display: flex;
display: flex;
align-items: center;
}';
if ( is_rtl() ) {
$search_css .= '
.ast-search-menu-icon.ast-inline-search .search-field {
width : 100%;
padding : 0.60em;
padding-left : 5.5em;
transition: all 0.2s;
}
.site-header-section-left .ast-search-menu-icon.slide-search .search-form {
padding-right: 2em;
padding-left: unset;
right: -1em;
left: unset;
}
.site-header-section-left .ast-search-menu-icon.slide-search .search-form .search-field {
margin-left: unset;
}
.ast-search-menu-icon.slide-search .search-form {
-webkit-backface-visibility: visible;
backface-visibility: visible;
visibility: hidden;
opacity: 0;
transition: all .2s;
position: absolute;
z-index: 3;
left: -1em;
top: 50%;
transform: translateY(-50%);
}';
} else {
$search_css .= '
.ast-search-menu-icon.ast-inline-search .search-field {
width : 100%;
padding : 0.60em;
padding-right : 5.5em;
transition: all 0.2s;
}
.site-header-section-left .ast-search-menu-icon.slide-search .search-form {
padding-left: 2em;
padding-right: unset;
left: -1em;
right: unset;
}
.site-header-section-left .ast-search-menu-icon.slide-search .search-form .search-field {
margin-right: unset;
}
.ast-search-menu-icon.slide-search .search-form {
-webkit-backface-visibility: visible;
backface-visibility: visible;
visibility: hidden;
opacity: 0;
transition: all .2s;
position: absolute;
z-index: 3;
right: -1em;
top: 50%;
transform: translateY(-50%);
}';
}
return Astra_Enqueue_Scripts::trim_css( $search_css );
}
/**
* Showcase "Upgrade to Pro" notices for Astra & here is the filter work as central control to enable/disable those notices from customizer, meta settings, admin area, pro post types pages.
*
* @since 3.9.4
* @return bool
*/
function astra_showcase_upgrade_notices() {
return ( ! defined( 'ASTRA_EXT_VER' ) && astra_get_option( 'ast-disable-upgrade-notices', true ) ) ? true : false;
}
/**
* Function which will return CSS for font-extras control.
* It includes - line-height, letter-spacing, text-decoration, font-style.
*
* @param array $config contains extra font settings.
* @param string $setting basis on this setting will return.
* @param mixed $unit Unit.
*
* @since 4.0.0
*/
function astra_get_font_extras( $config, $setting, $unit = false ) {
$css = isset( $config[ $setting ] ) ? $config[ $setting ] : '';
if ( $unit && $css ) {
$unit_val = isset( $config[ $unit ] ) ? $config[ $unit ] : '';
$unit_val = 'line-height-unit' === $unit ? apply_filters( 'astra_font_line_height_unit', $unit_val ) : $unit_val;
$css .= $unit_val;
}
return $css;
}
/**
* Function which will return CSS array for font specific props for further parsing CSS.
* It includes - font-family, font-weight, font-size, line-height, text-transform, letter-spacing, text-decoration, color (optional).
*
* @param string $font_family Font family.
* @param string $font_weight Font weight.
* @param array $font_size Font size.
* @param string $font_extras contains all font controls.
* @param string $color In most of cases color is also added, so included optional param here.
* @return array array of build CSS font settings.
*
* @since 4.0.0
*/
function astra_get_font_array_css( $font_family, $font_weight, $font_size, $font_extras, $color = '' ) {
$font_extras_ast_option = astra_get_option(
$font_extras,
array(
'line-height' => '',
'line-height-unit' => 'em',
'letter-spacing' => '',
'letter-spacing-unit' => 'px',
'text-transform' => '',
'text-decoration' => '',
)
);
return array(
'color' => esc_attr( $color ),
'font-family' => astra_get_css_value( $font_family, 'font' ),
'font-weight' => astra_get_css_value( $font_weight, 'font' ),
'font-size' => ! empty( $font_size ) ? astra_responsive_font( $font_size, 'desktop' ) : '',
'line-height' => astra_get_font_extras( $font_extras_ast_option, 'line-height', 'line-height-unit' ),
'text-transform' => astra_get_font_extras( $font_extras_ast_option, 'text-transform' ),
'letter-spacing' => astra_get_font_extras( $font_extras_ast_option, 'letter-spacing', 'letter-spacing-unit' ),
'text-decoration' => astra_get_font_extras( $font_extras_ast_option, 'text-decoration' ),
);
}
/**
* Return the array of site's available image size.
*
* @param boolean $add_custom Add custom image size.
* @since 4.4.0
* @return array
*/
function astra_get_site_image_sizes( $add_custom = false ) {
$image_sizes = array(
'thumbnail' => esc_html__( 'Thumbnail', 'astra' ),
'medium' => esc_html__( 'Medium', 'astra' ),
'medium_large' => esc_html__( 'Medium Large', 'astra' ),
'large' => esc_html__( 'Large', 'astra' ),
'full' => esc_html__( 'Full Size', 'astra' ),
);
// Gets the available intermediate image size names on site.
$all_sizes = get_intermediate_image_sizes(); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_intermediate_image_sizes_get_intermediate_image_sizes -- Required for image sizes to work.
$refactored_sizes = array(
'full' => esc_html__( 'Full Size', 'astra' ),
);
foreach ( $all_sizes as $size ) {
if ( isset( $image_sizes[ $size ] ) ) {
$refactored_sizes[ $size ] = $image_sizes[ $size ];
} else {
$refactored_sizes[ $size ] = $size;
}
}
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( $add_custom && defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'blog-pro' ) ) {
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$refactored_sizes['custom'] = esc_html__( 'Custom', 'astra' );
}
return $refactored_sizes;
}
/**
* Return the aspect-ratio for dynamic image.
*
* @param string $aspect_ratio_type Aspect ratio type.
* @param string $predefined_scale Predefined scale.
* @param string $custom_scale_width Custom scale width.
* @param string $custom_scale_height Custom scale height.
*
* @since 4.4.0
* @return string
*/
function astra_get_dynamic_image_aspect_ratio( $aspect_ratio_type, $predefined_scale, $custom_scale_width, $custom_scale_height ) {
switch ( $aspect_ratio_type ) {
case 'predefined':
return $predefined_scale;
case 'custom':
return absint( $custom_scale_width ) . '/' . absint( $custom_scale_height );
}
return '';
}
/**
* Getting site active language & compatible with other plugins.
*
* @since 4.4.0
* @return string
*/
function astra_get_current_language_slug() {
$lang = '';
if ( function_exists( 'pll_current_language' ) ) {
$lang = pll_current_language();
}
return apply_filters( 'astra_addon_site_current_language', $lang );
}
/**
* Function which will return the supported post types from core.
*
* Further processing includes:
* 1. Dynamic customizer
* 2. Live Search
*
* @since 4.4.0
* @return array
*/
function astra_get_queried_post_types() {
$queried_post_types = array_keys(
get_post_types(
apply_filters(
'astra_dynamic_get_post_types_query_args',
array(
'public' => true,
'_builtin' => false,
)
)
)
);
$queried_post_types = array_diff(
$queried_post_types,
array(
'astra-advanced-hook',
'astra_adv_header',
'elementor_library',
'brizy_template',
'course',
'lesson',
'llms_membership',
'tutor_quiz',
'tutor_assignments',
'testimonial',
'frm_display',
'mec_esb',
'mec-events',
'sfwd-assignment',
'sfwd-essays',
'sfwd-transactions',
'sfwd-certificates',
'sfwd-quiz',
'e-landing-page',
)
);
$queried_post_types[] = 'post';
$queried_post_types[] = 'page';
return $queried_post_types;
}
/**
* Get Global Color Palette's presets
*
* @return array color presets array.
* @since 4.5.0
*/
function astra_get_palette_presets() {
$color_palette_reorganize = Astra_Dynamic_CSS::astra_4_8_0_compatibility();
return array(
'preset_1' => array(
'#0067FF',
'#005EE9',
'#0F172A',
'#364151',
$color_palette_reorganize ? '#FFFFFF' : '#E7F6FF',
$color_palette_reorganize ? '#E7F6FF' : '#FFFFFF',
$color_palette_reorganize ? '#070614' : '#D1DAE5',
$color_palette_reorganize ? '#D1DAE5' : '#070614',
'#222222',
),
'preset_2' => array(
'#6528F7',
'#5511F8',
'#0F172A',
'#454F5E',
$color_palette_reorganize ? '#FFFFFF' : '#F2F0FE',
$color_palette_reorganize ? '#F2F0FE' : '#FFFFFF',
$color_palette_reorganize ? '#0D0614' : '#D8D8F5',
$color_palette_reorganize ? '#D8D8F5' : '#0D0614',
'#222222',
),
'preset_3' => array(
'#DD183B',
'#CC1939',
'#0F172A',
'#3A3A3A',
$color_palette_reorganize ? '#FFFFFF' : '#FFEDE6',
$color_palette_reorganize ? '#FFEDE6' : '#FFFFFF',
$color_palette_reorganize ? '#140609' : '#FFD1BF',
$color_palette_reorganize ? '#FFD1BF' : '#140609',
'#222222',
),
'preset_4' => array(
'#54B435',
'#379237',
'#0F172A',
'#2F3B40',
$color_palette_reorganize ? '#FFFFFF' : '#EDFBE2',
$color_palette_reorganize ? '#EDFBE2' : '#FFFFFF',
$color_palette_reorganize ? '#0C1406' : '#D5EAD8',
$color_palette_reorganize ? '#D5EAD8' : '#0C1406',
'#222222',
),
'preset_5' => array(
'#DCA54A',
'#D09A40',
'#0F172A',
'#4A4A4A',
$color_palette_reorganize ? '#FFFFFF' : '#FAF5E5',
$color_palette_reorganize ? '#FAF5E5' : '#FFFFFF',
$color_palette_reorganize ? '#141004' : '#F0E6C5',
$color_palette_reorganize ? '#F0E6C5' : '#141004',
'#222222',
),
'preset_6' => array(
'#FB5FAB',
'#EA559D',
'#0F172A',
'#454F5E',
$color_palette_reorganize ? '#FFFFFF' : '#FCEEF5',
$color_palette_reorganize ? '#FCEEF5' : '#FFFFFF',
$color_palette_reorganize ? '#140610' : '#FAD8E9',
$color_palette_reorganize ? '#FAD8E9' : '#140610',
'#222222',
),
'preset_7' => array(
'#1B9C85',
'#178E79',
'#0F172A',
'#454F5E',
$color_palette_reorganize ? '#FFFFFF' : '#EDF6EE',
$color_palette_reorganize ? '#EDF6EE' : '#FFFFFF',
$color_palette_reorganize ? '#06140C' : '#D4F3D7',
$color_palette_reorganize ? '#D4F3D7' : '#06140C',
'#222222',
),
'preset_8' => array(
'#FD9800',
'#E98C00',
'#0F172A',
'#454F5E',
$color_palette_reorganize ? '#FFFFFF' : '#FEF9E1',
$color_palette_reorganize ? '#FEF9E1' : '#FFFFFF',
$color_palette_reorganize ? '#141006' : '#F9F0C8',
$color_palette_reorganize ? '#F9F0C8' : '#141006',
'#222222',
),
'preset_9' => array(
'#FF6210',
'#F15808',
'#1C0D0A',
'#353535',
$color_palette_reorganize ? '#FFFFFF' : '#FEF1E4',
$color_palette_reorganize ? '#FEF1E4' : '#FFFFFF',
$color_palette_reorganize ? '#140B06' : '#E5D7D1',
$color_palette_reorganize ? '#E5D7D1' : '#140B06',
'#222222',
),
'preset_10' => array(
'#737880',
'#65696F',
'#151616',
'#393C40',
$color_palette_reorganize ? '#FFFFFF' : '#F6F6F6',
$color_palette_reorganize ? '#F6F6F6' : '#FFFFFF',
$color_palette_reorganize ? '#232529' : '#F1F0F0',
$color_palette_reorganize ? '#F1F0F0' : '#232529',
'#222222',
),
);
}
/**
* Get Astra blog layout design.
* Search / Blog.
*
* @return string $blog_layout.
* @since 4.6.0
*/
function astra_get_blog_layout() {
return ( is_search() && '' !== astra_get_option( 'ast-search-results-style' ) ) ? astra_get_option( 'ast-search-results-style' ) : astra_get_option( 'blog-layout' );
}
/**
* Get Astra blog posts per page count.
* Search / Blog.
*
* @return int $blog_layout.
* @since 4.6.0
*/
function astra_get_blog_posts_per_page() {
return ( is_search() && astra_get_option( 'ast-search-results-per-page' ) ) ? astra_get_option( 'ast-search-results-per-page' ) : astra_get_option( 'blog-post-per-page' );
}
/**
* Get the remote WP-Astra docs data.
*
* @since 4.6.0
*/
function astra_remote_docs_data() {
$astra_docs_instance = astra_docs_loader_instance( ASTRA_WEBSITE_BASE_URL . '/wp-json/powerful-docs/v1/get-docs', 'astra-docs' );
return json_decode( $astra_docs_instance->get_remote_data() );
}
/**
* Post types for live search.
*
* @since 4.4.0
*/
function astra_customizer_live_search_posttypes() {
$supported_post_types = array();
if ( is_customize_preview() ) {
$supported_post_types = astra_get_queried_post_types();
}
return apply_filters( 'astra_live_search_posttypes', $supported_post_types );
}
/**
* Get formatted live search post types.
*
* @since 4.4.0
* @return array
*/
function astra_customizer_search_post_types_choices() {
$all_post_types = astra_customizer_live_search_posttypes();
$post_type_choices = array();
foreach ( $all_post_types as $post_type ) {
$post_type_object = get_post_type_object( $post_type );
/** @psalm-suppress PossiblyNullPropertyFetch */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$post_type_choices[ $post_type ] = ! empty( $post_type_object->labels->name ) ? $post_type_object->labels->name : $post_type;
/** @psalm-suppress PossiblyNullPropertyFetch */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
}
return $post_type_choices;
}
/**
* Adding backward compatibility fag to manage EDD featured image by default state.
*
* @since 4.7.0
* @return bool
*/
function astra_enable_edd_featured_image_defaults() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_enable_edd_featured_image_defaults', isset( $astra_settings['can-update-edd-featured-image-default'] ) ? false : true );
}
PK GmZ3 widgets.phpnu [ $tag ) {
if ( get_queried_object_id() === (int) $tags_data[ $key ]['id'] ) {
$tags_data[ $key ]['class'] = $tags_data[ $key ]['class'] . ' current-item';
}
}
}
return apply_filters( 'astra_filter_widget_tag_cloud', $tags_data );
}
add_filter( 'wp_generate_tag_cloud_data', 'astra_filter_widget_tag_cloud' );
endif;
/**
* Register widget area.
*/
if ( ! function_exists( 'astra_widgets_init' ) ) :
/**
* Register widget area.
*
* @see https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function astra_widgets_init() {
$default_args = array(
'before_widget' => '',
'before_title' => '
',
);
/**
* Register Main Sidebar
*/
register_sidebar(
apply_filters(
'astra_widgets_init',
array(
'name' => esc_html__( 'Main Sidebar', 'astra' ),
'id' => 'sidebar-1',
) + $default_args
)
);
/**
* Register Header Widgets area
*/
register_sidebar(
apply_filters(
'astra_header_widgets_init',
array(
'name' => esc_html__( 'Header', 'astra' ),
'id' => 'header-widget',
) + $default_args
)
);
/**
* Register Footer Bar Widgets area
*/
register_sidebar(
apply_filters(
'astra_footer_1_widgets_init',
array(
'name' => esc_html__( 'Footer Bar Section 1', 'astra' ),
'id' => 'footer-widget-1',
) + $default_args
)
);
register_sidebar(
apply_filters(
'astra_footer_2_widgets_init',
array(
'name' => esc_html__( 'Footer Bar Section 2', 'astra' ),
'id' => 'footer-widget-2',
) + $default_args
)
);
/**
* Register Footer Widgets area
*/
$default_args['before_widget'] = '';
$default_args['after_widget'] = '
';
register_sidebar(
apply_filters(
'astra_advanced_footer_widget_1_args',
array(
'name' => esc_html__( 'Footer Widget Area 1', 'astra' ),
'id' => 'advanced-footer-widget-1',
) + $default_args
)
);
register_sidebar(
apply_filters(
'astra_advanced_footer_widget_2_args',
array(
'name' => esc_html__( 'Footer Widget Area 2', 'astra' ),
'id' => 'advanced-footer-widget-2',
) + $default_args
)
);
register_sidebar(
apply_filters(
'astra_advanced_footer_widget_3_args',
array(
'name' => esc_html__( 'Footer Widget Area 3', 'astra' ),
'id' => 'advanced-footer-widget-3',
) + $default_args
)
);
register_sidebar(
apply_filters(
'astra_advanced_footer_widget_4_args',
array(
'name' => esc_html__( 'Footer Widget Area 4', 'astra' ),
'id' => 'advanced-footer-widget-4',
) + $default_args
)
);
}
add_action( 'widgets_init', 'astra_widgets_init' );
endif;
PK JmZ6U-* -* 5 theme-update/class-astra-theme-background-updater.phpnu [ array(
'astra_theme_background_updater_4_0_0',
),
'4.0.2' => array(
'astra_theme_background_updater_4_0_2',
),
'4.1.0' => array(
'astra_theme_background_updater_4_1_0',
),
'4.1.4' => array(
'astra_theme_background_updater_4_1_4',
),
'4.1.6' => array(
'astra_theme_background_updater_4_1_6',
),
'4.1.7' => array(
'astra_theme_background_updater_4_1_7',
),
'4.2.0' => array(
'astra_theme_background_updater_4_2_0',
),
'4.2.2' => array(
'astra_theme_background_updater_4_2_2',
),
'4.4.0' => array(
'astra_theme_background_updater_4_4_0',
),
'4.5.0' => array(
'astra_theme_background_updater_4_5_0',
),
'4.5.2' => array(
'astra_theme_background_updater_4_5_2',
),
'4.6.0' => array(
'astra_theme_background_updater_4_6_0',
),
'4.6.2' => array(
'astra_theme_background_updater_4_6_2',
),
'4.6.4' => array(
'astra_theme_background_updater_4_6_4',
),
'4.6.5' => array(
'astra_theme_background_updater_4_6_5',
),
'4.6.6' => array(
'astra_theme_background_updater_4_6_6',
),
'4.6.11' => array(
'astra_theme_background_updater_4_6_11',
),
'4.6.12' => array(
'astra_theme_background_updater_4_6_12',
),
'4.6.14' => array(
'astra_theme_background_updater_4_6_14',
),
'4.7.0' => array(
'astra_theme_background_updater_4_7_0',
),
'4.7.1' => array(
'astra_theme_background_updater_4_7_1',
),
'4.8.0' => array(
'astra_theme_background_updater_4_8_0',
),
'4.8.2' => array(
'astra_theme_background_updater_4_8_2',
),
'4.8.4' => array(
'astra_theme_background_updater_4_8_4',
),
'4.8.7' => array(
'astra_theme_background_updater_4_8_7',
),
'4.8.9' => array(
'astra_theme_background_updater_4_8_9',
),
'4.8.10' => array(
'astra_theme_background_updater_4_8_10',
),
);
/**
* Constructor
*/
public function __construct() {
// Theme Updates.
if ( is_admin() ) {
add_action( 'admin_init', array( $this, 'install_actions' ) );
} else {
add_action( 'wp', array( $this, 'install_actions' ) );
}
// Core Helpers - Batch Processing.
require_once ASTRA_THEME_DIR . 'inc/lib/batch-processing/class-astra-wp-async-request.php';// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
require_once ASTRA_THEME_DIR . 'inc/lib/batch-processing/class-astra-wp-background-process.php';// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
require_once ASTRA_THEME_DIR . 'inc/theme-update/class-astra-theme-wp-background-process.php';// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
self::$background_updater = new Astra_Theme_WP_Background_Process();
}
/**
* Check Cron Status
*
* Gets the current cron status by performing a test spawn. Cached for one hour when all is well.
*
* @since 2.3.0
*
* @return bool true if there is a problem spawning a call to WP-Cron system, else false.
*/
public function test_cron() {
global $wp_version;
if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
return true;
}
if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) {
return true;
}
$cached_status = get_transient( 'astra-theme-cron-test-ok' );
if ( $cached_status ) {
return false;
}
$sslverify = version_compare( $wp_version, 4.0, '<' );
$doing_wp_cron = sprintf( '%.22F', microtime( true ) );
$cron_request = apply_filters(
'cron_request', // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
array(
'url' => site_url( 'wp-cron.php?doing_wp_cron=' . $doing_wp_cron ),
'args' => array(
'timeout' => 3,
'blocking' => true,
'sslverify' => apply_filters( 'https_local_ssl_verify', $sslverify ), // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
),
)
);
$result = wp_remote_post( $cron_request['url'], $cron_request['args'] );
if ( wp_remote_retrieve_response_code( $result ) >= 300 ) {
return true;
}
set_transient( 'astra-theme-cron-test-ok', 1, 3600 );
return false;
}
/**
* Install actions when a update button is clicked within the admin area.
*
* This function is hooked into admin_init to affect admin and wp to affect the frontend.
*/
public function install_actions() {
do_action( 'astra_update_initiated', self::$background_updater );
if ( true === $this->is_new_install() ) {
self::update_db_version();
return;
}
$fallback = $this->test_cron();
$db_migrated = $this->check_if_data_migrated();
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$is_queue_running = astra_get_option( 'is_theme_queue_running', false );
$fallback = ( $db_migrated ) ? $db_migrated : $fallback;
if ( $this->needs_db_update() && ! $is_queue_running ) {
$this->update( $fallback );
} else {
if ( ! $is_queue_running ) {
self::update_db_version();
}
}
}
/**
* Is this a brand new theme install?
*
* @since 2.1.3
* @return boolean
*/
public function is_new_install() {
// Get auto saved version number.
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$saved_version = astra_get_option( 'theme-auto-version', false );
if ( false === $saved_version ) {
return true;
}
return false;
}
/**
* Is a DB update needed?
*
* @since 2.1.3
* @return boolean
*/
private function needs_db_update() {
$current_theme_version = astra_get_option( 'theme-auto-version', null );
$updates = $this->get_db_update_callbacks();
if ( empty( $updates ) ) {
return false;
}
$versions = array_keys( $updates );
$latest = $versions[ count( $versions ) - 1 ];
return ! is_null( $current_theme_version ) && version_compare( $current_theme_version, $latest, '<' );
}
/**
* Get list of DB update callbacks.
*
* @since 2.1.3
* @return array
*/
public function get_db_update_callbacks() {
return self::$db_updates;
}
/**
* Check if database is migrated
*
* @since 2.3.1
*
* @return true If the database migration should not be run through CRON.
*/
public function check_if_data_migrated() {
$fallback = false;
$is_db_version_updated = $this->is_db_version_updated();
/** @psalm-suppress DocblockTypeContradiction */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( ! $is_db_version_updated ) {
$db_migrated = get_transient( 'astra-theme-db-migrated' );
if ( ! $db_migrated ) {
$db_migrated = array();
}
array_push( $db_migrated, $is_db_version_updated );
set_transient( 'astra-theme-db-migrated', $db_migrated, 3600 );
$db_migrate_count = count( $db_migrated );
if ( $db_migrate_count >= 5 ) {
astra_delete_option( 'is_theme_queue_running' );
$fallback = true;
}
}
return $fallback;
}
/**
* Checks if astra addon version is updated in the database
*
* @since 2.3.1
*
* @return true if astra addon version is updated.
*/
public function is_db_version_updated() {
// Get auto saved version number.
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$saved_version = astra_get_option( 'theme-auto-version', false );
return version_compare( $saved_version, ASTRA_THEME_VERSION, '=' );
}
/**
* Push all needed DB updates to the queue for processing.
*
* @param bool $fallback Fallback migration.
*
* @return void
*/
private function update( $fallback ) {
$current_db_version = astra_get_option( 'theme-auto-version' );
if ( count( $this->get_db_update_callbacks() ) > 0 ) {
foreach ( $this->get_db_update_callbacks() as $version => $update_callbacks ) {
if ( version_compare( $current_db_version, $version, '<' ) ) {
foreach ( $update_callbacks as $update_callback ) {
if ( $fallback ) {
call_user_func( $update_callback );
} else {
self::$background_updater->push_to_queue( $update_callback );
}
}
}
}
if ( $fallback ) {
self::update_db_version();
} else {
astra_update_option( 'is_theme_queue_running', true );
self::$background_updater->push_to_queue( 'update_db_version' );
}
} else {
self::$background_updater->push_to_queue( 'update_db_version' );
}
self::$background_updater->save()->dispatch();
}
/**
* Update DB version to current.
*
* @param string|null $version New Astra theme version or null.
*/
public static function update_db_version( $version = null ) {
do_action( 'astra_theme_update_before' );
// Get auto saved version number.
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$saved_version = astra_get_option( 'theme-auto-version', false );
if ( false === $saved_version ) {
$saved_version = ASTRA_THEME_VERSION;
// Update auto saved version number.
astra_update_option( 'theme-auto-version', ASTRA_THEME_VERSION );
}
// If equals then return.
if ( version_compare( $saved_version, ASTRA_THEME_VERSION, '=' ) ) {
astra_update_option( 'is_theme_queue_running', false );
return;
}
// Not have stored?
if ( empty( $saved_version ) ) {
// Get old version.
$theme_version = get_option( '_astra_auto_version', ASTRA_THEME_VERSION );
// Remove option.
delete_option( '_astra_auto_version' );
} else {
// Get latest version.
$theme_version = ASTRA_THEME_VERSION;
}
// Update auto saved version number.
astra_update_option( 'theme-auto-version', $theme_version );
astra_update_option( 'is_theme_queue_running', false );
// Update variables.
Astra_Theme_Options::refresh();
delete_transient( 'astra-addon-db-migrated' );
do_action( 'astra_theme_update_after' );
}
}
}
/**
* Kicking this off by creating a new instance
*/
new Astra_Theme_Background_Updater();
PK LmZ- ' theme-update/astra-update-functions.phpnu [ refresh_assets( 'astra' );
// Clear Astra Addon's static and dynamic CSS asset cache.
$astra_addon_cache_base_instance = new Astra_Cache_Base( 'astra-addon' );
$astra_addon_cache_base_instance->refresh_assets( 'astra-addon' );
}
/**
* 4.0.0 backward handling part.
*
* 1. Migrate existing setting & do required onboarding for new admin dashboard v4.0.0 app.
* 2. Migrating Post Structure & Meta options in title area meta parts.
*
* @since 4.0.0
* @return void
*/
function astra_theme_background_updater_4_0_0() {
// Dynamic customizer migration starts here.
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['dynamic-blog-layouts'] ) && ! isset( $theme_options['theme-dynamic-customizer-support'] ) ) {
$theme_options['dynamic-blog-layouts'] = false;
$theme_options['theme-dynamic-customizer-support'] = true;
$post_types = Astra_Posts_Structure_Loader::get_supported_post_types();
// Archive summary box compatibility.
$archive_title_font_size = array(
'desktop' => isset( $theme_options['font-size-archive-summary-title']['desktop'] ) ? $theme_options['font-size-archive-summary-title']['desktop'] : 40,
'tablet' => isset( $theme_options['font-size-archive-summary-title']['tablet'] ) ? $theme_options['font-size-archive-summary-title']['tablet'] : '',
'mobile' => isset( $theme_options['font-size-archive-summary-title']['mobile'] ) ? $theme_options['font-size-archive-summary-title']['mobile'] : '',
'desktop-unit' => isset( $theme_options['font-size-archive-summary-title']['desktop-unit'] ) ? $theme_options['font-size-archive-summary-title']['desktop-unit'] : 'px',
'tablet-unit' => isset( $theme_options['font-size-archive-summary-title']['tablet-unit'] ) ? $theme_options['font-size-archive-summary-title']['tablet-unit'] : 'px',
'mobile-unit' => isset( $theme_options['font-size-archive-summary-title']['mobile-unit'] ) ? $theme_options['font-size-archive-summary-title']['mobile-unit'] : 'px',
);
$single_title_font_size = array(
'desktop' => isset( $theme_options['font-size-entry-title']['desktop'] ) ? $theme_options['font-size-entry-title']['desktop'] : '',
'tablet' => isset( $theme_options['font-size-entry-title']['tablet'] ) ? $theme_options['font-size-entry-title']['tablet'] : '',
'mobile' => isset( $theme_options['font-size-entry-title']['mobile'] ) ? $theme_options['font-size-entry-title']['mobile'] : '',
'desktop-unit' => isset( $theme_options['font-size-entry-title']['desktop-unit'] ) ? $theme_options['font-size-entry-title']['desktop-unit'] : 'px',
'tablet-unit' => isset( $theme_options['font-size-entry-title']['tablet-unit'] ) ? $theme_options['font-size-entry-title']['tablet-unit'] : 'px',
'mobile-unit' => isset( $theme_options['font-size-entry-title']['mobile-unit'] ) ? $theme_options['font-size-entry-title']['mobile-unit'] : 'px',
);
$archive_summary_box_bg = array(
'desktop' => array(
'background-color' => ! empty( $theme_options['archive-summary-box-bg-color'] ) ? $theme_options['archive-summary-box-bg-color'] : '',
'background-image' => '',
'background-repeat' => 'repeat',
'background-position' => 'center center',
'background-size' => 'auto',
'background-attachment' => 'scroll',
'background-type' => '',
'background-media' => '',
),
'tablet' => array(
'background-color' => '',
'background-image' => '',
'background-repeat' => 'repeat',
'background-position' => 'center center',
'background-size' => 'auto',
'background-attachment' => 'scroll',
'background-type' => '',
'background-media' => '',
),
'mobile' => array(
'background-color' => '',
'background-image' => '',
'background-repeat' => 'repeat',
'background-position' => 'center center',
'background-size' => 'auto',
'background-attachment' => 'scroll',
'background-type' => '',
'background-media' => '',
),
);
// Single post structure.
foreach ( $post_types as $index => $post_type ) {
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$single_post_structure = isset( $theme_options['blog-single-post-structure'] ) ? $theme_options['blog-single-post-structure'] : array( 'single-image', 'single-title-meta' );
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$migrated_post_structure = array();
if ( ! empty( $single_post_structure ) ) {
/** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
foreach ( $single_post_structure as $key ) {
/** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( 'single-title-meta' === $key ) {
$migrated_post_structure[] = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title';
if ( 'post' === $post_type ) {
$migrated_post_structure[] = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-meta';
}
}
if ( 'single-image' === $key ) {
$migrated_post_structure[] = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-image';
}
}
$theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-structure' ] = $migrated_post_structure;
}
// Single post meta.
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$single_post_meta = isset( $theme_options['blog-single-meta'] ) ? $theme_options['blog-single-meta'] : array( 'comments', 'category', 'author' );
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$migrated_post_metadata = array();
if ( ! empty( $single_post_meta ) ) {
$tax_counter = 0;
$tax_slug = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-taxonomy';
/** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
foreach ( $single_post_meta as $key ) {
/** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
switch ( $key ) {
case 'author':
$migrated_post_metadata[] = 'author';
break;
case 'date':
$migrated_post_metadata[] = 'date';
break;
case 'comments':
$migrated_post_metadata[] = 'comments';
break;
case 'category':
if ( 'post' === $post_type ) {
$migrated_post_metadata[] = $tax_slug;
$theme_options[ $tax_slug ] = 'category';
$tax_counter = ++$tax_counter;
$tax_slug = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-taxonomy-' . $tax_counter;
}
break;
case 'tag':
if ( 'post' === $post_type ) {
$migrated_post_metadata[] = $tax_slug;
$theme_options[ $tax_slug ] = 'post_tag';
$tax_counter = ++$tax_counter;
$tax_slug = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-taxonomy-' . $tax_counter;
}
break;
default:
break;
}
}
$theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-metadata' ] = $migrated_post_metadata;
}
// Archive layout compatibilities.
$archive_banner_layout = ( class_exists( 'WooCommerce' ) && 'product' === $post_type ) ? false : true; // Setting WooCommerce archive option disabled as WC already added their header content on archive.
$theme_options[ 'ast-archive-' . esc_attr( $post_type ) . '-title' ] = $archive_banner_layout;
// Single layout compatibilities.
$single_banner_layout = ( class_exists( 'WooCommerce' ) && 'product' === $post_type ) ? false : true; // Setting WC single option disabled as there is no any header set from default WooCommerce.
$theme_options[ 'ast-single-' . esc_attr( $post_type ) . '-title' ] = $single_banner_layout;
// BG color support.
$theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-image-type' ] = ! empty( $theme_options['archive-summary-box-bg-color'] ) ? 'custom' : 'none';
$theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-custom-bg' ] = $archive_summary_box_bg;
// Archive title font support.
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-title-font-family' ] = ! empty( $theme_options['font-family-archive-summary-title'] ) ? $theme_options['font-family-archive-summary-title'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-title-font-size' ] = $archive_title_font_size;
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-title-font-weight' ] = ! empty( $theme_options['font-weight-archive-summary-title'] ) ? $theme_options['font-weight-archive-summary-title'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$archive_dynamic_line_height = ! empty( $theme_options['line-height-archive-summary-title'] ) ? $theme_options['line-height-archive-summary-title'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$archive_dynamic_text_transform = ! empty( $theme_options['text-transform-archive-summary-title'] ) ? $theme_options['text-transform-archive-summary-title'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-title-font-extras' ] = array(
'line-height' => $archive_dynamic_line_height,
'line-height-unit' => 'em',
'letter-spacing' => '',
'letter-spacing-unit' => 'px',
'text-transform' => $archive_dynamic_text_transform,
'text-decoration' => '',
);
// Archive title colors support.
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-title-color' ] = ! empty( $theme_options['archive-summary-box-title-color'] ) ? $theme_options['archive-summary-box-title-color'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-text-color' ] = ! empty( $theme_options['archive-summary-box-text-color'] ) ? $theme_options['archive-summary-box-text-color'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
// Single title colors support.
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-banner-title-color' ] = ! empty( $theme_options['entry-title-color'] ) ? $theme_options['entry-title-color'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
// Single title font support.
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-family' ] = ! empty( $theme_options['font-family-entry-title'] ) ? $theme_options['font-family-entry-title'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-size' ] = $single_title_font_size;
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-weight' ] = ! empty( $theme_options['font-weight-entry-title'] ) ? $theme_options['font-weight-entry-title'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$single_dynamic_line_height = ! empty( $theme_options['line-height-entry-title'] ) ? $theme_options['line-height-entry-title'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$single_dynamic_text_transform = ! empty( $theme_options['text-transform-entry-title'] ) ? $theme_options['text-transform-entry-title'] : '';
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-extras' ] = array(
'line-height' => $single_dynamic_line_height,
'line-height-unit' => 'em',
'letter-spacing' => '',
'letter-spacing-unit' => 'px',
'text-transform' => $single_dynamic_text_transform,
'text-decoration' => '',
);
}
// Set page specific structure, as page only has featured image at top & title beneath to it, hardcoded writing it here.
$theme_options['ast-dynamic-single-page-structure'] = array( 'ast-dynamic-single-page-image', 'ast-dynamic-single-page-title' );
// EDD content layout & sidebar layout migration in new dynamic option.
$theme_options['archive-download-content-layout'] = isset( $theme_options['edd-archive-product-layout'] ) ? $theme_options['edd-archive-product-layout'] : 'default';
$theme_options['archive-download-sidebar-layout'] = isset( $theme_options['edd-sidebar-layout'] ) ? $theme_options['edd-sidebar-layout'] : 'no-sidebar';
$theme_options['single-download-content-layout'] = isset( $theme_options['edd-single-product-layout'] ) ? $theme_options['edd-single-product-layout'] : 'default';
$theme_options['single-download-sidebar-layout'] = isset( $theme_options['edd-single-product-sidebar-layout'] ) ? $theme_options['edd-single-product-sidebar-layout'] : 'default';
update_option( 'astra-settings', $theme_options );
}
// Admin backward handling starts here.
$admin_dashboard_settings = get_option( 'astra_admin_settings', array() );
if ( ! isset( $admin_dashboard_settings['theme-setup-admin-migrated'] ) ) {
if ( ! isset( $admin_dashboard_settings['self_hosted_gfonts'] ) ) {
$admin_dashboard_settings['self_hosted_gfonts'] = isset( $theme_options['load-google-fonts-locally'] ) ? $theme_options['load-google-fonts-locally'] : false;
}
if ( ! isset( $admin_dashboard_settings['preload_local_fonts'] ) ) {
$admin_dashboard_settings['preload_local_fonts'] = isset( $theme_options['preload-local-fonts'] ) ? $theme_options['preload-local-fonts'] : false;
}
// Consider admin part from theme side migrated.
$admin_dashboard_settings['theme-setup-admin-migrated'] = true;
update_option( 'astra_admin_settings', $admin_dashboard_settings );
}
// Check if existing user and disable smooth scroll-to-id.
if ( ! isset( $theme_options['enable-scroll-to-id'] ) ) {
$theme_options['enable-scroll-to-id'] = false;
update_option( 'astra-settings', $theme_options );
}
// Check if existing user and disable scroll to top if disabled from pro addons list.
$scroll_to_top_visibility = false;
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'scroll-to-top' ) ) {
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$scroll_to_top_visibility = true;
}
if ( ! isset( $theme_options['scroll-to-top-enable'] ) ) {
$theme_options['scroll-to-top-enable'] = $scroll_to_top_visibility;
update_option( 'astra-settings', $theme_options );
}
// Default colors & typography flag.
if ( ! isset( $theme_options['update-default-color-typo'] ) ) {
$theme_options['update-default-color-typo'] = false;
update_option( 'astra-settings', $theme_options );
}
// Block editor experience improvements compatibility flag.
if ( ! isset( $theme_options['v4-block-editor-compat'] ) ) {
$theme_options['v4-block-editor-compat'] = false;
update_option( 'astra-settings', $theme_options );
}
}
/**
* 4.0.2 backward handling part.
*
* 1. Read Time option backwards handling for old users.
*
* @since 4.0.2
* @return void
*/
function astra_theme_background_updater_4_0_2() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['v4-0-2-update-migration'] ) && isset( $theme_options['blog-single-meta'] ) && in_array( 'read-time', $theme_options['blog-single-meta'] ) ) {
if ( isset( $theme_options['ast-dynamic-single-post-metadata'] ) && ! in_array( 'read-time', $theme_options['ast-dynamic-single-post-metadata'] ) ) {
$theme_options['ast-dynamic-single-post-metadata'][] = 'read-time';
$theme_options['v4-0-2-update-migration'] = true;
update_option( 'astra-settings', $theme_options );
}
}
}
/**
* Handle backward compatibility on version 4.1.0
*
* @since 4.1.0
* @return void
*/
function astra_theme_background_updater_4_1_0() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['v4-1-0-update-migration'] ) ) {
$theme_options['v4-1-0-update-migration'] = true;
$current_payment_list = array();
$old_payment_list = isset( $theme_options['single-product-payment-list']['items'] ) ? $theme_options['single-product-payment-list']['items'] : array();
$visa_payment = isset( $theme_options['single-product-payment-visa'] ) ? $theme_options['single-product-payment-visa'] : '';
$mastercard_payment = isset( $theme_options['single-product-payment-mastercard'] ) ? $theme_options['single-product-payment-mastercard'] : '';
$discover_payment = isset( $theme_options['single-product-payment-discover'] ) ? $theme_options['single-product-payment-discover'] : '';
$paypal_payment = isset( $theme_options['single-product-payment-paypal'] ) ? $theme_options['single-product-payment-paypal'] : '';
$apple_pay_payment = isset( $theme_options['single-product-payment-apple-pay'] ) ? $theme_options['single-product-payment-apple-pay'] : '';
false !== $visa_payment ? array_push(
$current_payment_list,
array(
'id' => 'item-100',
'enabled' => true,
'source' => 'icon',
'icon' => 'cc-visa',
'image' => '',
'label' => __( 'Visa', 'astra' ),
)
) : '';
false !== $mastercard_payment ? array_push(
$current_payment_list,
array(
'id' => 'item-101',
'enabled' => true,
'source' => 'icon',
'icon' => 'cc-mastercard',
'image' => '',
'label' => __( 'Mastercard', 'astra' ),
)
) : '';
false !== $mastercard_payment ? array_push(
$current_payment_list,
array(
'id' => 'item-102',
'enabled' => true,
'source' => 'icon',
'icon' => 'cc-amex',
'image' => '',
'label' => __( 'Amex', 'astra' ),
)
) : '';
false !== $discover_payment ? array_push(
$current_payment_list,
array(
'id' => 'item-103',
'enabled' => true,
'source' => 'icon',
'icon' => 'cc-discover',
'image' => '',
'label' => __( 'Discover', 'astra' ),
)
) : '';
$paypal_payment ? array_push(
$current_payment_list,
array(
'id' => 'item-104',
'enabled' => true,
'source' => 'icon',
'icon' => 'cc-paypal',
'image' => '',
'label' => __( 'Paypal', 'astra' ),
)
) : '';
$apple_pay_payment ? array_push(
$current_payment_list,
array(
'id' => 'item-105',
'enabled' => true,
'source' => 'icon',
'icon' => 'cc-apple-pay',
'image' => '',
'label' => __( 'Apple Pay', 'astra' ),
)
) : '';
if ( $current_payment_list ) {
$theme_options['single-product-payment-list'] =
array(
'items' =>
array_merge(
$current_payment_list,
$old_payment_list
),
);
update_option( 'astra-settings', $theme_options );
}
if ( ! isset( $theme_options['woo_support_global_settings'] ) ) {
$theme_options['woo_support_global_settings'] = true;
update_option( 'astra-settings', $theme_options );
}
if ( isset( $theme_options['theme-dynamic-customizer-support'] ) ) {
$post_types = Astra_Posts_Structure_Loader::get_supported_post_types();
foreach ( $post_types as $index => $post_type ) {
$theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-extras' ]['text-transform'] = '';
}
update_option( 'astra-settings', $theme_options );
}
}
}
/**
* 4.1.4 backward handling cases.
*
* 1. Migrating users to combined color overlay option to new dedicated overlay options.
*
* @since 4.1.4
* @return void
*/
function astra_theme_background_updater_4_1_4() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['v4-1-4-update-migration'] ) ) {
$ast_bg_control_options = array(
'off-canvas-background',
'footer-adv-bg-obj',
'footer-bg-obj',
);
foreach ( $ast_bg_control_options as $key => $bg_option ) {
if ( isset( $theme_options[ $bg_option ] ) && ! isset( $theme_options[ $bg_option ]['overlay-type'] ) ) {
$bg_type = isset( $theme_options[ $bg_option ]['background-type'] ) ? $theme_options[ $bg_option ]['background-type'] : '';
$theme_options[ $bg_option ]['overlay-type'] = 'none';
$theme_options[ $bg_option ]['overlay-color'] = '';
$theme_options[ $bg_option ]['overlay-opacity'] = '';
$theme_options[ $bg_option ]['overlay-gradient'] = '';
if ( 'image' === $bg_type ) {
$bg_img = isset( $theme_options[ $bg_option ]['background-image'] ) ? $theme_options[ $bg_option ]['background-image'] : '';
$bg_color = isset( $theme_options[ $bg_option ]['background-color'] ) ? $theme_options[ $bg_option ]['background-color'] : '';
if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) {
$theme_options[ $bg_option ]['overlay-type'] = 'classic';
$theme_options[ $bg_option ]['overlay-color'] = $bg_color;
$theme_options[ $bg_option ]['overlay-opacity'] = '';
$theme_options[ $bg_option ]['overlay-gradient'] = '';
}
}
}
}
$ast_resp_bg_control_options = array(
'hba-footer-bg-obj-responsive',
'hbb-footer-bg-obj-responsive',
'footer-bg-obj-responsive',
'footer-menu-bg-obj-responsive',
'hb-footer-bg-obj-responsive',
'hba-header-bg-obj-responsive',
'hbb-header-bg-obj-responsive',
'hb-header-bg-obj-responsive',
'header-mobile-menu-bg-obj-responsive',
'site-layout-outside-bg-obj-responsive',
'content-bg-obj-responsive',
);
$post_types = Astra_Posts_Structure_Loader::get_supported_post_types();
foreach ( $post_types as $index => $post_type ) {
$ast_resp_bg_control_options[] = 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-custom-bg';
$ast_resp_bg_control_options[] = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-banner-background';
}
$component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_header_menu;
for ( $index = 1; $index <= $component_limit; $index++ ) {
$_prefix = 'menu' . $index;
$ast_resp_bg_control_options[] = 'header-' . $_prefix . '-bg-obj-responsive';
}
foreach ( $ast_resp_bg_control_options as $key => $resp_bg_option ) {
// Desktop version.
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( isset( $theme_options[ $resp_bg_option ]['desktop'] ) && is_array( $theme_options[ $resp_bg_option ]['desktop'] ) && ! isset( $theme_options[ $resp_bg_option ]['desktop']['overlay-type'] ) ) {
// @codingStandardsIgnoreStart
$desk_bg_type = isset( $theme_options[ $resp_bg_option ]['desktop']['background-type'] ) ? $theme_options[ $resp_bg_option ]['desktop']['background-type'] : '';
// @codingStandardsIgnoreEnd
$theme_options[ $resp_bg_option ]['desktop']['overlay-type'] = '';
$theme_options[ $resp_bg_option ]['desktop']['overlay-color'] = '';
$theme_options[ $resp_bg_option ]['desktop']['overlay-opacity'] = '';
$theme_options[ $resp_bg_option ]['desktop']['overlay-gradient'] = '';
if ( 'image' === $desk_bg_type ) {
$bg_img = isset( $theme_options[ $resp_bg_option ]['desktop']['background-image'] ) ? $theme_options[ $resp_bg_option ]['desktop']['background-image'] : '';
$bg_color = isset( $theme_options[ $resp_bg_option ]['desktop']['background-color'] ) ? $theme_options[ $resp_bg_option ]['desktop']['background-color'] : '';
if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) {
$theme_options[ $resp_bg_option ]['desktop']['overlay-type'] = 'classic';
$theme_options[ $resp_bg_option ]['desktop']['overlay-color'] = $bg_color;
$theme_options[ $resp_bg_option ]['desktop']['overlay-opacity'] = '';
$theme_options[ $resp_bg_option ]['desktop']['overlay-gradient'] = '';
}
}
}
// Tablet version.
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( isset( $theme_options[ $resp_bg_option ]['tablet'] ) && is_array( $theme_options[ $resp_bg_option ]['tablet'] ) && ! isset( $theme_options[ $resp_bg_option ]['tablet']['overlay-type'] ) ) {
// @codingStandardsIgnoreStart
$tablet_bg_type = isset( $theme_options[ $resp_bg_option ]['tablet']['background-type'] ) ? $theme_options[ $resp_bg_option ]['tablet']['background-type'] : '';
// @codingStandardsIgnoreEnd
$theme_options[ $resp_bg_option ]['tablet']['overlay-type'] = '';
$theme_options[ $resp_bg_option ]['tablet']['overlay-color'] = '';
$theme_options[ $resp_bg_option ]['tablet']['overlay-opacity'] = '';
$theme_options[ $resp_bg_option ]['tablet']['overlay-gradient'] = '';
if ( 'image' === $tablet_bg_type ) {
$bg_img = isset( $theme_options[ $resp_bg_option ]['tablet']['background-image'] ) ? $theme_options[ $resp_bg_option ]['tablet']['background-image'] : '';
$bg_color = isset( $theme_options[ $resp_bg_option ]['tablet']['background-color'] ) ? $theme_options[ $resp_bg_option ]['tablet']['background-color'] : '';
if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) {
$theme_options[ $resp_bg_option ]['tablet']['overlay-type'] = 'classic';
$theme_options[ $resp_bg_option ]['tablet']['overlay-color'] = $bg_color;
$theme_options[ $resp_bg_option ]['tablet']['overlay-opacity'] = '';
$theme_options[ $resp_bg_option ]['tablet']['overlay-gradient'] = '';
}
}
}
// Mobile version.
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( isset( $theme_options[ $resp_bg_option ]['mobile'] ) && is_array( $theme_options[ $resp_bg_option ]['mobile'] ) && ! isset( $theme_options[ $resp_bg_option ]['mobile']['overlay-type'] ) ) {
// @codingStandardsIgnoreStart
$mobile_bg_type = isset( $theme_options[ $resp_bg_option ]['mobile']['background-type'] ) ? $theme_options[ $resp_bg_option ]['mobile']['background-type'] : '';
// @codingStandardsIgnoreEnd
$theme_options[ $resp_bg_option ]['mobile']['overlay-type'] = '';
$theme_options[ $resp_bg_option ]['mobile']['overlay-color'] = '';
$theme_options[ $resp_bg_option ]['mobile']['overlay-opacity'] = '';
$theme_options[ $resp_bg_option ]['mobile']['overlay-gradient'] = '';
if ( 'image' === $mobile_bg_type ) {
$bg_img = isset( $theme_options[ $resp_bg_option ]['mobile']['background-image'] ) ? $theme_options[ $resp_bg_option ]['mobile']['background-image'] : '';
$bg_color = isset( $theme_options[ $resp_bg_option ]['mobile']['background-color'] ) ? $theme_options[ $resp_bg_option ]['mobile']['background-color'] : '';
if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) {
$theme_options[ $resp_bg_option ]['mobile']['overlay-type'] = 'classic';
$theme_options[ $resp_bg_option ]['mobile']['overlay-color'] = $bg_color;
$theme_options[ $resp_bg_option ]['mobile']['overlay-opacity'] = '';
$theme_options[ $resp_bg_option ]['mobile']['overlay-gradient'] = '';
}
}
}
}
$theme_options['v4-1-4-update-migration'] = true;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility on version 4.1.6
*
* @since 4.1.6
* @return void
*/
function astra_theme_background_updater_4_1_6() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['list-block-vertical-spacing'] ) ) {
$theme_options['list-block-vertical-spacing'] = false;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Set flag to avoid direct reflections on live site & to maintain backward compatibility for existing users.
*
* @since 4.1.7
* @return void
*/
function astra_theme_background_updater_4_1_7() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['add-hr-styling-css'] ) ) {
$theme_options['add-hr-styling-css'] = false;
update_option( 'astra-settings', $theme_options );
}
if ( ! isset( $theme_options['astra-site-svg-logo-equal-height'] ) ) {
$theme_options['astra-site-svg-logo-equal-height'] = false;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Migrating users to new container layout options
*
* @since 4.2.0
* @return void
*/
function astra_theme_background_updater_4_2_0() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['v4-2-0-update-migration'] ) ) {
$post_types = Astra_Posts_Structure_Loader::get_supported_post_types();
$theme_options = get_option( 'astra-settings' );
$blog_types = array( 'single', 'archive' );
$third_party_layouts = array( 'woocommerce', 'edd', 'lifterlms', 'lifterlms-course-lesson', 'learndash' );
// Global.
if ( isset( $theme_options['site-content-layout'] ) ) {
$theme_options = astra_apply_layout_migration( 'site-content-layout', 'ast-site-content-layout', 'site-content-style', 'site-sidebar-style', $theme_options );
}
// Single, archive.
foreach ( $blog_types as $index => $blog_type ) {
foreach ( $post_types as $index => $post_type ) {
$old_layout = $blog_type . '-' . esc_attr( $post_type ) . '-content-layout';
$new_layout = $blog_type . '-' . esc_attr( $post_type ) . '-ast-content-layout';
$content_style = $blog_type . '-' . esc_attr( $post_type ) . '-content-style';
$sidebar_style = $blog_type . '-' . esc_attr( $post_type ) . '-sidebar-style';
if ( isset( $theme_options[ $old_layout ] ) ) {
$theme_options = astra_apply_layout_migration( $old_layout, $new_layout, $content_style, $sidebar_style, $theme_options );
}
}
}
// Third party existing layout migrations to new layout options.
foreach ( $third_party_layouts as $index => $layout ) {
$old_layout = $layout . '-content-layout';
$new_layout = $layout . '-ast-content-layout';
$content_style = $layout . '-content-style';
$sidebar_style = $layout . '-sidebar-style';
if ( isset( $theme_options[ $old_layout ] ) ) {
if ( 'lifterlms' === $layout ) {
// Lifterlms course/lesson sidebar style migration case.
$theme_options = astra_apply_layout_migration( $old_layout, $new_layout, $content_style, 'lifterlms-course-lesson-sidebar-style', $theme_options );
}
$theme_options = astra_apply_layout_migration( $old_layout, $new_layout, $content_style, $sidebar_style, $theme_options );
}
}
if ( ! isset( $theme_options['fullwidth_sidebar_support'] ) ) {
$theme_options['fullwidth_sidebar_support'] = false;
}
$theme_options['v4-2-0-update-migration'] = true;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle migration from old to new layouts.
*
* Migration cases for old users, old layouts -> new layouts.
*
* @since 4.2.0
* @param mixed $old_layout old_layout.
* @param mixed $new_layout new_layout.
* @param mixed $content_style content_style.
* @param mixed $sidebar_style sidebar_style.
* @param array $theme_options theme_options.
* @return array $theme_options The updated theme options.
*/
function astra_apply_layout_migration( $old_layout, $new_layout, $content_style, $sidebar_style, $theme_options ) {
switch ( astra_get_option( $old_layout ) ) {
case 'boxed-container':
$theme_options[ $new_layout ] = 'normal-width-container';
$theme_options[ $content_style ] = 'boxed';
$theme_options[ $sidebar_style ] = 'boxed';
break;
case 'content-boxed-container':
$theme_options[ $new_layout ] = 'normal-width-container';
$theme_options[ $content_style ] = 'boxed';
$theme_options[ $sidebar_style ] = 'unboxed';
break;
case 'plain-container':
$theme_options[ $new_layout ] = 'normal-width-container';
$theme_options[ $content_style ] = 'unboxed';
$theme_options[ $sidebar_style ] = 'unboxed';
break;
case 'page-builder':
$theme_options[ $new_layout ] = 'full-width-container';
$theme_options[ $content_style ] = 'unboxed';
$theme_options[ $sidebar_style ] = 'unboxed';
break;
case 'narrow-container':
$theme_options[ $new_layout ] = 'narrow-width-container';
$theme_options[ $content_style ] = 'unboxed';
$theme_options[ $sidebar_style ] = 'unboxed';
break;
default:
$theme_options[ $new_layout ] = 'default';
$theme_options[ $content_style ] = 'default';
$theme_options[ $sidebar_style ] = 'default';
break;
}
return $theme_options;
}
/**
* Handle backward compatibility on version 4.2.2
*
* @since 4.2.2
* @return void
*/
function astra_theme_background_updater_4_2_2() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['v4-2-2-core-form-btns-styling'] ) ) {
$theme_options['v4-2-2-core-form-btns-styling'] = false;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility on version 4.6.0
*
* @since 4.4.0
* @return void
*/
function astra_theme_background_updater_4_4_0() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['v4-4-0-backward-option'] ) ) {
$theme_options['v4-4-0-backward-option'] = false;
// Migrate primary button outline styles to secondary buttons.
if ( isset( $theme_options['font-family-button'] ) ) {
$theme_options['secondary-font-family-button'] = $theme_options['font-family-button'];
}
if ( isset( $theme_options['font-size-button'] ) ) {
$theme_options['secondary-font-size-button'] = $theme_options['font-size-button'];
}
if ( isset( $theme_options['font-weight-button'] ) ) {
$theme_options['secondary-font-weight-button'] = $theme_options['font-weight-button'];
}
if ( isset( $theme_options['font-extras-button'] ) ) {
$theme_options['secondary-font-extras-button'] = $theme_options['font-extras-button'];
}
if ( isset( $theme_options['button-bg-color'] ) ) {
$theme_options['secondary-button-bg-color'] = $theme_options['button-bg-color'];
}
if ( isset( $theme_options['button-bg-h-color'] ) ) {
$theme_options['secondary-button-bg-h-color'] = $theme_options['button-bg-h-color'];
}
if ( isset( $theme_options['theme-button-border-group-border-color'] ) ) {
$theme_options['secondary-theme-button-border-group-border-color'] = $theme_options['theme-button-border-group-border-color'];
}
if ( isset( $theme_options['theme-button-border-group-border-h-color'] ) ) {
$theme_options['secondary-theme-button-border-group-border-h-color'] = $theme_options['theme-button-border-group-border-h-color'];
}
if ( isset( $theme_options['button-radius-fields'] ) ) {
$theme_options['secondary-button-radius-fields'] = $theme_options['button-radius-fields'];
}
// Single - Article Featured Image visibility migration.
$post_types = Astra_Posts_Structure_Loader::get_supported_post_types();
foreach ( $post_types as $index => $post_type ) {
$theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-article-featured-image-position-layout-1' ] = 'none';
$theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-article-featured-image-position-layout-2' ] = 'none';
$theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-article-featured-image-ratio-type' ] = 'default';
}
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility on version 4.5.0.
*
* @since 4.5.0
* @return void
*/
function astra_theme_background_updater_4_5_0() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['v4-5-0-backward-option'] ) ) {
$theme_options['v4-5-0-backward-option'] = false;
$palette_options = get_option( 'astra-color-palettes', Astra_Global_Palette::get_default_color_palette() );
if ( ! isset( $palette_options['presets'] ) ) {
$palette_options['presets'] = astra_get_palette_presets();
update_option( 'astra-color-palettes', $palette_options );
}
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility on version 4.5.2.
*
* @since 4.5.2
* @return void
*/
function astra_theme_background_updater_4_5_2() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['scndry-btn-default-padding'] ) ) {
$theme_options['scndry-btn-default-padding'] = false;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility on version 4.6.0
*
* @since 4.6.0
* @return void
*/
function astra_theme_background_updater_4_6_0() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['v4-6-0-backward-option'] ) ) {
$theme_options['v4-6-0-backward-option'] = false;
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$blog_post_structure = isset( $theme_options['blog-post-structure'] ) ? $theme_options['blog-post-structure'] : array( 'image', 'title-meta' );
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$migrated_post_structure = array();
if ( ! empty( $blog_post_structure ) ) {
/** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
foreach ( $blog_post_structure as $key ) {
/** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( 'title-meta' === $key ) {
$migrated_post_structure[] = 'title';
$migrated_post_structure[] = 'title-meta';
}
if ( 'image' === $key ) {
$migrated_post_structure[] = 'image';
}
}
$migrated_post_structure[] = 'excerpt';
$migrated_post_structure[] = 'read-more';
$theme_options['blog-post-structure'] = $migrated_post_structure;
}
if ( defined( 'ASTRA_EXT_VER' ) ) {
$theme_options['ast-sub-section-author-box-border-width'] = isset( $theme_options['author-box-border-width'] ) ? $theme_options['author-box-border-width'] : array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
);
$theme_options['ast-sub-section-author-box-border-radius'] = isset( $theme_options['author-box-border-radius'] ) ? $theme_options['author-box-border-radius'] : array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
);
$theme_options['ast-sub-section-author-box-border-color'] = isset( $theme_options['author-box-border-color'] ) ? $theme_options['author-box-border-color'] : '';
if ( isset( $theme_options['single-post-inside-spacing'] ) ) {
$theme_options['ast-sub-section-author-box-padding'] = $theme_options['single-post-inside-spacing'];
}
if ( isset( $theme_options['font-family-post-meta'] ) ) {
$theme_options['font-family-post-read-more'] = $theme_options['font-family-post-meta'];
}
if ( isset( $theme_options['font-extras-post-meta'] ) ) {
$theme_options['font-extras-post-read-more'] = $theme_options['font-extras-post-meta'];
}
}
if ( isset( $theme_options['single-post-inside-spacing'] ) ) {
$theme_options['ast-sub-section-related-posts-padding'] = $theme_options['single-post-inside-spacing'];
}
$theme_options['single-content-images-shadow'] = false;
$theme_options['ast-font-style-update'] = false;
update_option( 'astra-settings', $theme_options );
}
$docs_legacy_data = get_option( 'astra_docs_data', array() );
if ( ! empty( $docs_legacy_data ) ) {
delete_option( 'astra_docs_data' );
}
}
/**
* Handle backward compatibility on version 4.6.2.
*
* @since 4.6.2
* @return void
*/
function astra_theme_background_updater_4_6_2() {
$theme_options = get_option( 'astra-settings', array() );
// Unset "featured image" for pages structure.
if ( ! isset( $theme_options['v4-6-2-backward-option'] ) ) {
$theme_options['v4-6-2-backward-option'] = false;
$page_banner_layout = isset( $theme_options['ast-dynamic-single-page-layout'] ) ? $theme_options['ast-dynamic-single-page-layout'] : 'layout-1';
$page_structure = isset( $theme_options['ast-dynamic-single-page-structure'] ) ? $theme_options['ast-dynamic-single-page-structure'] : array( 'ast-dynamic-single-page-image', 'ast-dynamic-single-page-title' );
$layout_1_image_position = isset( $theme_options['ast-dynamic-single-page-article-featured-image-position-layout-1'] ) ? $theme_options['ast-dynamic-single-page-article-featured-image-position-layout-1'] : 'behind';
$migrated_page_structure = array();
if ( 'layout-1' === $page_banner_layout && 'none' === $layout_1_image_position && ! empty( $page_structure ) ) {
foreach ( $page_structure as $key ) {
if ( 'ast-dynamic-single-page-image' !== $key ) {
$migrated_page_structure[] = $key;
}
}
$theme_options['ast-dynamic-single-page-structure'] = $migrated_page_structure;
}
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility on version 4.6.4.
*
* @since 4.6.4
* @return void
*/
function astra_theme_background_updater_4_6_4() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['btn-stylings-upgrade'] ) ) {
$theme_options['btn-stylings-upgrade'] = false;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility for Elementor Pro heading's margin.
*
* @since 4.6.5
* @return void
*/
function astra_theme_background_updater_4_6_5() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['elementor-headings-style'] ) ) {
$theme_options['elementor-headings-style'] = defined( 'ELEMENTOR_PRO_VERSION' ) ? true : false;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility for Elementor Loop block post div container padding.
*
* @since 4.6.6
* @return void
*/
function astra_theme_background_updater_4_6_6() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['elementor-container-padding-style'] ) ) {
$theme_options['elementor-container-padding-style'] = defined( 'ELEMENTOR_PRO_VERSION' ) ? true : false;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility for Starter template library preview line height cases.
*
* @since 4.6.11
* @return void
*/
function astra_theme_background_updater_4_6_11() {
$theme_options = get_option( 'astra-settings', array() );
if ( isset( $theme_options['global-headings-line-height-update'] ) ) {
return;
}
$headers_fonts = array(
'h1' => '1.4',
'h2' => '1.3',
'h3' => '1.3',
'h4' => '1.2',
'h5' => '1.2',
'h6' => '1.25',
);
foreach ( $headers_fonts as $header_tag => $header_font_value ) {
if ( empty( $theme_options[ 'font-extras-' . $header_tag ]['line-height'] ) ) {
$theme_options[ 'font-extras-' . $header_tag ]['line-height'] = $header_font_value;
if ( empty( $theme_options[ 'font-extras-' . $header_tag ]['line-height-unit'] ) ) {
$theme_options[ 'font-extras-' . $header_tag ]['line-height-unit'] = 'em';
}
}
}
$theme_options['global-headings-line-height-update'] = true;
update_option( 'astra-settings', $theme_options );
}
/**
* Handle backward compatibility for heading `clear:both` css in single posts and pages.
*
* @since 4.6.12
* @return void
*/
function astra_theme_background_updater_4_6_12() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['single_posts_pages_heading_clear_none'] ) ) {
$theme_options['single_posts_pages_heading_clear_none'] = false;
update_option( 'astra-settings', $theme_options );
}
if ( ! isset( $theme_options['elementor-btn-styling'] ) ) {
$theme_options['elementor-btn-styling'] = defined( 'ELEMENTOR_VERSION' ) ? true : false;
update_option( 'astra-settings', $theme_options );
}
if ( ! isset( $theme_options['remove_single_posts_navigation_mobile_device_padding'] ) ) {
$theme_options['remove_single_posts_navigation_mobile_device_padding'] = true;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility for following pointers.
*
* 1. unit less line-height support.
* 2. H5 font size case.
*
* @since 4.6.14
* @return void
*/
function astra_theme_background_updater_4_6_14() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['enable-4-6-14-compatibility'] ) ) {
$theme_options['enable-4-6-14-compatibility'] = false;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility for following cases.
*
* 1. Making edd default option enable by default.
* 2. Handle backward compatibility for Heading font size fix.
*
* @since 4.7.0
* @return void
*/
function astra_theme_background_updater_4_7_0() {
$theme_options = get_option( 'astra-settings', array() );
if ( class_exists( 'Easy_Digital_Downloads' ) && ! isset( $theme_options['can-update-edd-featured-image-default'] ) ) {
$theme_options['can-update-edd-featured-image-default'] = false;
update_option( 'astra-settings', $theme_options );
}
if ( ! isset( $theme_options['heading-widget-font-size'] ) ) {
$theme_options['heading-widget-font-size'] = false;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility for version 4.7.1
*
* @since 4.7.1
* @return void
*/
function astra_theme_background_updater_4_7_1() {
$theme_options = get_option( 'astra-settings', array() );
// Setting same background color for above and below transparent headers as on transparent primary header.
if ( isset( $theme_options['transparent-header-bg-color-responsive'] ) ) {
if ( ! isset( $theme_options['hba-transparent-header-bg-color-responsive'] ) ) {
$theme_options['hba-transparent-header-bg-color-responsive'] = $theme_options['transparent-header-bg-color-responsive'];
}
if ( ! isset( $theme_options['hbb-transparent-header-bg-color-responsive'] ) ) {
$theme_options['hbb-transparent-header-bg-color-responsive'] = $theme_options['transparent-header-bg-color-responsive'];
}
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility Spectra Heading max-width with Astra when fullwidth layout is selected.
*
* @since 4.8.0
* @return void
*/
function astra_theme_background_updater_4_8_0() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['enable-4-8-0-compatibility'] ) ) {
$theme_options['enable-4-8-0-compatibility'] = false;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility Single post outside spacing issue.
*
* @since 4.8.2
* @return void
*/
function astra_theme_background_updater_4_8_2() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['v4-8-2-backward-option'] ) ) {
$theme_options['v4-8-2-backward-option'] = false;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility for Spectra container margin left and right.
* Handle backward compatibility for Heading font size px to em conversion cases.
*
* @since 4.8.4
* @return void
*/
function astra_theme_background_updater_4_8_4() {
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['enable-4-8-4-compatibility'] ) ) {
$theme_options['enable-4-8-4-compatibility'] = false;
update_option( 'astra-settings', $theme_options );
}
if ( ! isset( $theme_options['astra-heading-font-size-compatibility'] ) ) {
$theme_options['astra-heading-font-size-compatibility'] = false;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Set key to show NPS survey popup immediately for old user.
*
* @since 4.8.7
* @return void
*/
function astra_theme_background_updater_4_8_7() {
// Bail early if the starter template is being imported.
if ( get_option( 'astra_sites_import_started' ) === 'yes' ) {
return;
}
update_option( 'astra_nps_show', true );
}
/**
* Handle backward compatibility on version 4.8.9.
* 1. Reorganizing color palettes.
*
* @since 4.8.9
* @return void
*/
function astra_theme_background_updater_4_8_9() {
// Bail early if the starter template is being imported.
if ( get_option( 'astra_sites_import_started' ) === 'yes' || astra_get_option( 'new-color-labels' ) ) {
astra_update_option( 'new-color-labels', true );
}
$theme_options = get_option( 'astra-settings', array() );
if ( ! isset( $theme_options['enable-4-8-9-compatibility'] ) ) {
$theme_options['enable-4-8-9-compatibility'] = false;
update_option( 'astra-settings', $theme_options );
}
// Enable off canvas move body option for existing users.
if ( ! isset( $theme_options['off-canvas-move-body'] ) ) {
$theme_options['off-canvas-move-body'] = true;
update_option( 'astra-settings', $theme_options );
}
}
/**
* Handle backward compatibility on version 4.8.10.
*
* @since 4.8.10
* @return void
*/
function astra_theme_background_updater_4_8_10() {
$theme_options = get_option( 'astra-settings', array() );
/**
* Enable star rating compatibility for existing users, excluding template import scenarios.
*/
if ( get_option( 'astra_sites_import_started' ) !== 'yes' ) {
$theme_options['star-rating-comp'] = false;
update_option( 'astra-settings', $theme_options );
}
}
PK OmZ[. . 0 theme-update/astra-builder-migration-updater.phpnu [ $theme_options,
'used_elements' => $used_elements,
'widget_options' => $widget_options,
);
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$options = astra_primary_header_builder_migration( $options['theme_options'], $options['used_elements'], $options['widget_options'] );
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$options = astra_below_header_builder_migration( $options['theme_options'], $options['used_elements'], $options['widget_options'] );
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$options = astra_above_header_builder_migration( $options['theme_options'], $options['used_elements'], $options['widget_options'] );
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$options = astra_footer_builder_migration( $options['theme_options'], $options['used_elements'], $options['widget_options'] );
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$options = astra_footer_widgets_migration( $options['theme_options'], $options['used_elements'], $options['widget_options'] );
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$options = astra_primary_menu_builder_migration( $options['theme_options'], $options['used_elements'], $options['widget_options'] );
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$options = astra_sticky_header_builder_migration( $options['theme_options'], $options['used_elements'], $options['widget_options'] );
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$theme_options = $options['theme_options'];
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$widget_options = $options['widget_options'];
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$theme_options['v3-option-migration'] = true;
update_option( 'astra-settings', $theme_options );
update_option( 'sidebars_widgets', $widget_options );
}
/**
* Header Footer builder - Migration of Primary Header.
*
* @since 3.0.0
* @param array $theme_options Theme options.
* @param array $used_elements Used Elements array.
* @param array $widget_options Widget options.
* @return array
*/
function astra_primary_header_builder_migration( $theme_options, $used_elements, $widget_options ) {
/**
* Primary Header.
*/
// Header : Primary Header - Layout.
$primary_header_layout = ( isset( $theme_options['header-layouts'] ) ) ? $theme_options['header-layouts'] : '';
// Header : Primary Header - Last Menu Item.
$last_menu_item = ( isset( $theme_options['header-main-rt-section'] ) ) ? $theme_options['header-main-rt-section'] : '';
$last_menu_item_mobile_flag = ( isset( $theme_options['hide-custom-menu-mobile'] ) ) ? $theme_options['hide-custom-menu-mobile'] : '';
$last_menu_item_mobile_outside = ( isset( $theme_options['header-display-outside-menu'] ) ) ? $theme_options['header-display-outside-menu'] : '';
$new_menu_item = '';
$theme_options['mobile-header-type'] = 'dropdown';
if ( isset( $theme_options['mobile-menu-style'] ) ) {
switch ( $theme_options['mobile-menu-style'] ) {
case 'flyout':
$theme_options['mobile-header-type'] = 'off-canvas';
if ( isset( $theme_options['flyout-mobile-menu-alignment'] ) ) {
$theme_options['off-canvas-slide'] = $theme_options['flyout-mobile-menu-alignment'];
}
break;
case 'fullscreen':
$theme_options['mobile-header-type'] = 'full-width';
break;
case 'default':
default:
$theme_options['mobile-header-type'] = 'dropdown';
break;
}
}
switch ( $last_menu_item ) {
case 'search':
$new_menu_item = 'search';
if ( isset( $theme_options['header-main-rt-section-search-box-type'] ) ) {
$theme_options['header-search-box-type'] = $theme_options['header-main-rt-section-search-box-type'];
}
break;
case 'button':
$new_menu_item = 'button-1';
if ( isset( $theme_options['header-main-rt-section-button-text'] ) ) {
$theme_options['header-button1-text'] = $theme_options['header-main-rt-section-button-text'];
}
if ( isset( $theme_options['header-main-rt-section-button-link-option'] ) ) {
$theme_options['header-button1-link-option'] = $theme_options['header-main-rt-section-button-link-option'];
}
if ( isset( $theme_options['header-main-rt-section-button-text-color'] ) ) {
$theme_options['header-button1-text-color'] = array(
'desktop' => $theme_options['header-main-rt-section-button-text-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['header-main-rt-section-button-back-color'] ) ) {
$theme_options['header-button1-back-color'] = array(
'desktop' => $theme_options['header-main-rt-section-button-back-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['header-main-rt-section-button-text-h-color'] ) ) {
$theme_options['header-button1-text-h-color'] = array(
'desktop' => $theme_options['header-main-rt-section-button-text-h-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['header-main-rt-section-button-back-h-color'] ) ) {
$theme_options['header-button1-back-h-color'] = array(
'desktop' => $theme_options['header-main-rt-section-button-back-h-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['header-main-rt-section-button-border-size'] ) ) {
$theme_options['header-button1-border-size'] = $theme_options['header-main-rt-section-button-border-size'];
}
if ( isset( $theme_options['header-main-rt-section-button-border-color'] ) ) {
$theme_options['header-button1-border-color'] = array(
'desktop' => $theme_options['header-main-rt-section-button-border-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['header-main-rt-section-button-border-h-color'] ) ) {
$theme_options['header-button1-border-h-color'] = array(
'desktop' => $theme_options['header-main-rt-section-button-border-h-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['header-main-rt-section-button-border-radius'] ) ) {
$theme_options['header-button1-border-radius'] = $theme_options['header-main-rt-section-button-border-radius'];
}
if ( isset( $theme_options['primary-header-button-font-family'] ) ) {
$theme_options['header-button1-font-family'] = $theme_options['primary-header-button-font-family'];
}
if ( isset( $theme_options['primary-header-button-font-size'] ) ) {
$theme_options['header-button1-font-size'] = $theme_options['primary-header-button-font-size'];
}
if ( isset( $theme_options['primary-header-button-font-weight'] ) ) {
$theme_options['header-button1-font-weight'] = $theme_options['primary-header-button-font-weight'];
}
if ( isset( $theme_options['primary-header-button-text-transform'] ) ) {
$theme_options['header-button1-text-transform'] = $theme_options['primary-header-button-text-transform'];
}
if ( isset( $theme_options['primary-header-button-line-height'] ) ) {
$theme_options['header-button1-line-height'] = $theme_options['primary-header-button-line-height'];
}
if ( isset( $theme_options['primary-header-button-letter-spacing'] ) ) {
$theme_options['header-button1-letter-spacing'] = $theme_options['primary-header-button-letter-spacing'];
}
if ( isset( $theme_options['header-main-rt-section-button-padding'] ) ) {
$theme_options['section-hb-button-1-padding'] = $theme_options['header-main-rt-section-button-padding'];
}
// Sticky Header Button options.
// Text Color.
if ( isset( $theme_options['header-main-rt-sticky-section-button-text-color'] ) ) {
$theme_options['sticky-header-button1-text-color'] = array(
'desktop' => $theme_options['header-main-rt-sticky-section-button-text-color'],
'tablet' => '',
'mobile' => '',
);
}
// BG Color.
if ( isset( $theme_options['header-main-rt-sticky-section-button-back-color'] ) ) {
$theme_options['sticky-header-button1-back-color'] = array(
'desktop' => $theme_options['header-main-rt-sticky-section-button-back-color'],
'tablet' => '',
'mobile' => '',
);
}
// Text Hover Color.
if ( isset( $theme_options['header-main-rt-sticky-section-button-text-h-color'] ) ) {
$theme_options['sticky-header-button1-text-h-color'] = array(
'desktop' => $theme_options['header-main-rt-sticky-section-button-text-h-color'],
'tablet' => '',
'mobile' => '',
);
}
// BG Hover Color.
if ( isset( $theme_options['header-main-rt-sticky-section-button-back-h-color'] ) ) {
$theme_options['sticky-header-button1-back-h-color'] = array(
'desktop' => $theme_options['header-main-rt-sticky-section-button-back-h-color'],
'tablet' => '',
'mobile' => '',
);
}
// Border Width.
if ( isset( $theme_options['header-main-rt-sticky-section-button-border-size'] ) ) {
$theme_options['sticky-header-button1-border-size'] = $theme_options['header-main-rt-sticky-section-button-border-size'];
}
// Border Color.
if ( isset( $theme_options['header-main-rt-sticky-section-button-border-color'] ) ) {
$theme_options['sticky-header-button1-border-color'] = array(
'desktop' => $theme_options['header-main-rt-sticky-section-button-border-color'],
'tablet' => '',
'mobile' => '',
);
}
// Border Hover Color.
if ( isset( $theme_options['header-main-rt-sticky-section-button-border-h-color'] ) ) {
$theme_options['sticky-header-button1-border-h-color'] = array(
'desktop' => $theme_options['header-main-rt-sticky-section-button-border-h-color'],
'tablet' => '',
'mobile' => '',
);
}
// Border Radius.
if ( isset( $theme_options['header-main-rt-sticky-section-button-border-radius'] ) ) {
$theme_options['sticky-header-button1-border-radius'] = $theme_options['header-main-rt-sticky-section-button-border-radius'];
}
// Padding.
if ( isset( $theme_options['header-main-rt-sticky-section-button-padding'] ) ) {
$theme_options['sticky-header-button1-padding'] = $theme_options['header-main-rt-sticky-section-button-padding'];
}
break;
case 'text-html':
$new_menu_item = 'html-1';
if ( isset( $theme_options['header-main-rt-section-html'] ) ) {
$theme_options['header-html-1'] = $theme_options['header-main-rt-section-html'];
}
break;
case 'widget':
$new_menu_item = 'widget-1';
if ( isset( $widget_options['header-widget'] ) ) {
$widget_options['header-widget-1'] = $widget_options['header-widget'];
}
break;
case 'woocommerce':
$new_menu_item = 'woo-cart';
if ( ! empty( $theme_options['woo-header-cart-icon-color'] ) ) {
$theme_options['header-woo-cart-icon-color'] = $theme_options['woo-header-cart-icon-color'];
}
break;
case 'edd':
$new_menu_item = 'edd-cart';
break;
}
$used_elements[] = $new_menu_item;
$new_menu_item_mobile = ( ! $last_menu_item_mobile_flag ) ? $new_menu_item : '';
$new_menu_item_mobile_outside = '';
if ( ! $last_menu_item_mobile_flag && $last_menu_item_mobile_outside ) {
$new_menu_item_mobile_outside = $new_menu_item;
$new_menu_item_mobile = '';
}
$theme_options['header-desktop-items']['above'] = array(
'above_left' => array(),
'above_left_center' => array(),
'above_center' => array(),
'above_right_center' => array(),
'above_right' => array(),
);
$theme_options['header-mobile-items']['above'] = array(
'above_left' => array(),
'above_center' => array(),
'above_right' => array(),
);
$theme_options['header-desktop-items']['below'] = array(
'below_left' => array(),
'below_left_center' => array(),
'below_center' => array(),
'below_right_center' => array(),
'below_right' => array(),
);
$theme_options['header-mobile-items']['below'] = array(
'below_left' => array(),
'below_center' => array(),
'below_right' => array(),
);
/**
* Assign the new locations.
*/
switch ( $primary_header_layout ) {
case 'header-main-layout-1':
$theme_options['header-desktop-items']['primary'] = array(
'primary_left' => array( 'logo' ),
'primary_left_center' => array(),
'primary_center' => array(),
'primary_right_center' => array(),
'primary_right' => ( '' !== $new_menu_item ) ? array( 'menu-1', $new_menu_item ) : array( 'menu-1' ),
);
break;
case 'header-main-layout-2':
$theme_options['header-desktop-items']['primary'] = array(
'primary_left' => array(),
'primary_left_center' => array(),
'primary_center' => array( 'logo' ),
'primary_right_center' => array(),
'primary_right' => array(),
);
$theme_options['header-desktop-items']['below'] = array(
'below_left' => array(),
'below_left_center' => array(),
'below_center' => ( '' !== $new_menu_item ) ? array( 'menu-1', $new_menu_item ) : array( 'menu-1' ),
'below_right_center' => array(),
'below_right' => array(),
);
break;
case 'header-main-layout-3':
$theme_options['header-desktop-items']['primary'] = array(
'primary_left' => ( '' !== $new_menu_item ) ? array( 'menu-1', $new_menu_item ) : array( 'menu-1' ),
'primary_left_center' => array(),
'primary_center' => array(),
'primary_right_center' => array(),
'primary_right' => array( 'logo' ),
);
break;
default:
$theme_options['header-desktop-items']['primary'] = array(
'primary_left' => array( 'logo' ),
'primary_left_center' => array(),
'primary_center' => array(),
'primary_right_center' => array(),
'primary_right' => array( 'menu-1' ),
);
}
// Header : Primary Header - Mobile Layout.
$mobile_layout = astra_get_option( 'header-main-menu-align' );
if ( 'stack' === $mobile_layout ) {
$theme_options['header-mobile-items']['popup'] = array( 'popup_content' => ( '' !== $new_menu_item_mobile && '' !== $new_menu_item_mobile_outside ) ? array( 'menu-1', $new_menu_item_mobile ) : array( 'menu-1' ) );
$theme_options['header-mobile-items']['primary'] = array(
'primary_left' => array(),
'primary_center' => array( 'logo' ),
'primary_right' => array(),
);
$theme_options['header-mobile-items']['below'] = array(
'below_left' => array(),
'below_center' => ( '' !== $new_menu_item_mobile_outside ) ? array( $new_menu_item_mobile_outside, 'mobile-trigger' ) : array( 'mobile-trigger' ),
'below_right' => array(),
);
} else {
$theme_options['header-mobile-items']['popup'] = array( 'popup_content' => ( '' !== $new_menu_item_mobile ) ? array( 'menu-1', $new_menu_item_mobile ) : array( 'menu-1' ) );
if ( 'header-main-layout-3' === $primary_header_layout ) {
$theme_options['header-mobile-items']['primary'] = array(
'primary_left' => ( '' !== $new_menu_item_mobile_outside ) ? array( $new_menu_item_mobile_outside, 'mobile-trigger' ) : array( 'mobile-trigger' ),
'primary_center' => array(),
'primary_right' => array( 'logo' ),
);
} else {
$theme_options['header-mobile-items']['primary'] = array(
'primary_left' => array( 'logo' ),
'primary_center' => array(),
'primary_right' => ( '' !== $new_menu_item_mobile_outside ) ? array( $new_menu_item_mobile_outside, 'mobile-trigger' ) : array( 'mobile-trigger' ),
);
}
}
// Header - Primary Header - Content Width.
if ( isset( $theme_options['header-main-layout-width'] ) ) {
$theme_options['hb-header-main-layout-width'] = $theme_options['header-main-layout-width'];
}
// Header - Primary Header - Border Bottom.
if ( isset( $theme_options['header-main-sep'] ) ) {
$theme_options['hb-header-main-sep'] = $theme_options['header-main-sep'];
}
if ( isset( $theme_options['header-main-sep-color'] ) ) {
$theme_options['hb-header-main-sep-color'] = $theme_options['header-main-sep-color'];
}
if ( isset( $theme_options['header-bg-obj-responsive'] ) ) {
$theme_options['hb-header-bg-obj-responsive'] = $theme_options['header-bg-obj-responsive'];
}
if ( isset( $theme_options['header-spacing'] ) ) {
$theme_options['section-primary-header-builder-padding'] = $theme_options['header-spacing'];
}
return array(
'theme_options' => $theme_options,
'used_elements' => $used_elements,
'widget_options' => $widget_options,
);
}
/**
* Header Footer builder - Migration of Below Header.
*
* @since 3.0.0
* @param array $theme_options Theme options.
* @param array $used_elements Used Elements array.
* @param array $widget_options Widget options.
* @return array
*/
function astra_below_header_builder_migration( $theme_options, $used_elements, $widget_options ) {
/**
* Below Header
*/
$below_header_layout = ( isset( $theme_options['below-header-layout'] ) ) ? $theme_options['below-header-layout'] : '';
$below_header_on_mobile = ( isset( $theme_options['below-header-on-mobile'] ) ) ? $theme_options['below-header-on-mobile'] : '';
$below_header_merge_menu = ( isset( $theme_options['below-header-merge-menu'] ) ) ? $theme_options['below-header-merge-menu'] : '';
$below_header_swap_mobile = ( isset( $theme_options['below-header-swap-mobile'] ) ) ? $theme_options['below-header-swap-mobile'] : '';
if ( isset( $theme_options['below-header-height'] ) ) {
$theme_options['hbb-header-height'] = array(
'desktop' => $theme_options['below-header-height'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['below-header-divider'] ) ) {
$theme_options['hbb-header-separator'] = $theme_options['below-header-divider'];
}
if ( isset( $theme_options['below-header-divider-color'] ) ) {
$theme_options['hbb-header-bottom-border-color'] = $theme_options['below-header-divider-color'];
}
if ( isset( $theme_options['below-header-bg-obj-responsive'] ) ) {
$theme_options['hbb-header-bg-obj-responsive'] = $theme_options['below-header-bg-obj-responsive'];
}
if ( isset( $theme_options['below-header-spacing'] ) ) {
$theme_options['section-below-header-builder-padding'] = $theme_options['below-header-spacing'];
}
// Below Header Section 1.
$below_header_section_1 = ( isset( $theme_options['below-header-section-1'] ) ) ? $theme_options['below-header-section-1'] : '';
$new_below_header_section_1_item = '';
switch ( $below_header_section_1 ) {
case 'menu':
$new_below_header_section_1_item = 'menu-2';
break;
case 'search':
if ( ! in_array( 'search', $used_elements ) ) {
$new_below_header_section_1_item = 'search';
if ( isset( $theme_options['below-header-section-1-search-box-type'] ) ) {
$theme_options['header-search-box-type'] = $theme_options['below-header-section-1-search-box-type'];
}
}
break;
case 'text-html':
if ( ! in_array( 'html-2', $used_elements ) ) {
$new_below_header_section_1_item = 'html-2';
if ( isset( $theme_options['below-header-section-1-html'] ) ) {
$theme_options['header-html-2'] = $theme_options['below-header-section-1-html'];
}
}
break;
case 'widget':
if ( ! in_array( 'widget-2', $used_elements ) ) {
$new_below_header_section_1_item = 'widget-2';
if ( isset( $widget_options['below-header-widget-1'] ) ) {
$widget_options['header-widget-2'] = $widget_options['below-header-widget-1'];
}
}
break;
case 'woocommerce':
if ( ! in_array( 'woo-cart', $used_elements ) ) {
$new_below_header_section_1_item = 'woo-cart';
}
break;
case 'edd':
if ( ! in_array( 'edd-cart', $used_elements ) ) {
$new_below_header_section_1_item = 'edd-cart';
}
break;
}
// Below Header Section 2.
$below_header_section_2 = ( isset( $theme_options['below-header-section-2'] ) ) ? $theme_options['below-header-section-2'] : '';
$new_below_header_section_2_item = '';
switch ( $below_header_section_2 ) {
case 'menu':
$new_below_header_section_2_item = 'menu-2';
break;
case 'search':
if ( ! in_array( 'search', $used_elements ) ) {
$new_below_header_section_2_item = 'search';
if ( isset( $theme_options['below-header-section-2-search-box-type'] ) ) {
$theme_options['header-search-box-type'] = $theme_options['below-header-section-2-search-box-type'];
}
}
break;
case 'text-html':
if ( ! in_array( 'html-2', $used_elements ) ) {
$new_below_header_section_2_item = 'html-2';
if ( isset( $theme_options['below-header-section-2-html'] ) ) {
$theme_options['header-html-2'] = $theme_options['below-header-section-2-html'];
}
}
break;
case 'widget':
if ( ! in_array( 'widget-2', $used_elements ) ) {
$new_below_header_section_2_item = 'widget-2';
if ( isset( $widget_options['below-header-widget-2'] ) ) {
$widget_options['header-widget-2'] = $widget_options['below-header-widget-2'];
}
}
break;
case 'woocommerce':
if ( ! in_array( 'woo-cart', $used_elements ) ) {
$new_below_header_section_2_item = 'woo-cart';
}
break;
case 'edd':
if ( ! in_array( 'edd-cart', $used_elements ) ) {
$new_below_header_section_2_item = 'edd-cart';
}
break;
}
if ( 'menu' === $below_header_section_1 || 'menu' === $below_header_section_2 ) {
$theme_options['header-menu2-menu-stack-on-mobile'] = false;
/**
* Menu - 2
*/
if ( isset( $theme_options['below-header-submenu-container-animation'] ) ) {
$theme_options['header-menu2-submenu-container-animation'] = $theme_options['below-header-submenu-container-animation'];
}
if ( isset( $theme_options['below-header-submenu-border'] ) ) {
$theme_options['header-menu2-submenu-border'] = $theme_options['below-header-submenu-border'];
}
if ( isset( $theme_options['below-header-submenu-b-color'] ) ) {
$theme_options['header-menu2-submenu-b-color'] = $theme_options['below-header-submenu-b-color'];
}
if ( isset( $theme_options['below-header-submenu-item-border'] ) ) {
$theme_options['header-menu2-submenu-item-border'] = $theme_options['below-header-submenu-item-border'];
}
if ( isset( $theme_options['below-header-submenu-item-b-color'] ) ) {
$theme_options['header-menu2-submenu-item-b-color'] = $theme_options['below-header-submenu-item-b-color'];
}
if ( isset( $theme_options['below-header-menu-text-color-responsive'] ) ) {
$theme_options['header-menu2-color-responsive'] = $theme_options['below-header-menu-text-color-responsive'];
}
if ( isset( $theme_options['below-header-menu-bg-obj-responsive'] ) ) {
$theme_options['header-menu2-bg-obj-responsive'] = $theme_options['below-header-menu-bg-obj-responsive'];
}
if ( isset( $theme_options['below-header-menu-text-hover-color-responsive'] ) ) {
$theme_options['header-menu2-h-color-responsive'] = $theme_options['below-header-menu-text-hover-color-responsive'];
}
if ( isset( $theme_options['below-header-menu-bg-hover-color-responsive'] ) ) {
$theme_options['header-menu2-h-bg-color-responsive'] = $theme_options['below-header-menu-bg-hover-color-responsive'];
}
if ( isset( $theme_options['below-header-current-menu-text-color-responsive'] ) ) {
$theme_options['header-menu2-a-color-responsive'] = $theme_options['below-header-current-menu-text-color-responsive'];
}
if ( isset( $theme_options['below-header-current-menu-bg-color-responsive'] ) ) {
$theme_options['header-menu2-a-bg-color-responsive'] = $theme_options['below-header-current-menu-bg-color-responsive'];
}
if ( isset( $theme_options['below-header-font-size'] ) ) {
$theme_options['header-menu2-font-size'] = $theme_options['below-header-font-size'];
}
if ( isset( $theme_options['below-header-font-weight'] ) ) {
$theme_options['header-menu2-font-weight'] = $theme_options['below-header-font-weight'];
}
if ( isset( $theme_options['below-header-line-height'] ) ) {
$theme_options['header-menu2-line-height'] = $theme_options['below-header-line-height'];
}
if ( isset( $theme_options['below-header-font-family'] ) ) {
$theme_options['header-menu2-font-family'] = $theme_options['below-header-font-family'];
}
if ( isset( $theme_options['below-header-text-transform'] ) ) {
$theme_options['header-menu2-text-transform'] = $theme_options['below-header-text-transform'];
}
if ( isset( $theme_options['below-header-menu-spacing'] ) ) {
$theme_options['header-menu2-menu-spacing'] = $theme_options['below-header-menu-spacing'];
}
// Menu 2 - Submenu.
if ( isset( $theme_options['below-header-submenu-text-color-responsive'] ) ) {
$theme_options['header-menu2-submenu-color-responsive'] = $theme_options['below-header-submenu-text-color-responsive'];
}
if ( isset( $theme_options['below-header-submenu-bg-color-responsive'] ) ) {
$theme_options['header-menu2-submenu-bg-color-responsive'] = $theme_options['below-header-submenu-bg-color-responsive'];
}
if ( isset( $theme_options['below-header-submenu-hover-color-responsive'] ) ) {
$theme_options['header-menu2-submenu-h-color-responsive'] = $theme_options['below-header-submenu-hover-color-responsive'];
}
if ( isset( $theme_options['below-header-submenu-bg-hover-color-responsive'] ) ) {
$theme_options['header-menu2-submenu-h-bg-color-responsive'] = $theme_options['below-header-submenu-bg-hover-color-responsive'];
}
if ( isset( $theme_options['below-header-submenu-active-color-responsive'] ) ) {
$theme_options['header-menu2-submenu-a-color-responsive'] = $theme_options['below-header-submenu-active-color-responsive'];
}
if ( isset( $theme_options['below-header-submenu-active-bg-color-responsive'] ) ) {
$theme_options['header-menu2-submenu-a-bg-color-responsive'] = $theme_options['below-header-submenu-active-bg-color-responsive'];
}
if ( isset( $theme_options['font-size-below-header-dropdown-menu'] ) ) {
$theme_options['header-font-size-menu2-sub-menu'] = $theme_options['font-size-below-header-dropdown-menu'];
}
if ( isset( $theme_options['font-weight-below-header-dropdown-menu'] ) ) {
$theme_options['header-font-weight-menu2-sub-menu'] = $theme_options['font-weight-below-header-dropdown-menu'];
}
if ( isset( $theme_options['line-height-below-header-dropdown-menu'] ) ) {
$theme_options['header-line-height-menu2-sub-menu'] = $theme_options['line-height-below-header-dropdown-menu'];
}
if ( isset( $theme_options['font-family-below-header-dropdown-menu'] ) ) {
$theme_options['header-font-family-menu2-sub-menu'] = $theme_options['font-family-below-header-dropdown-menu'];
}
if ( isset( $theme_options['text-transform-below-header-dropdown-menu'] ) ) {
$theme_options['header-text-transform-menu2-sub-menu'] = $theme_options['text-transform-below-header-dropdown-menu'];
}
if ( isset( $theme_options['below-header-submenu-spacing'] ) ) {
$theme_options['header-menu2-submenu-spacing'] = $theme_options['below-header-submenu-spacing'];
}
}
if ( 'search' === $below_header_section_1 || 'search' === $below_header_section_2 ) {
if ( isset( $theme_options['below-header-text-color-responsive'] ) ) {
$theme_options['header-search-icon-color'] = $theme_options['below-header-text-color-responsive'];
}
}
if ( 'text-html' === $below_header_section_1 || 'text-html' === $below_header_section_2 ) {
if ( isset( $theme_options['below-header-text-color-responsive'] ) ) {
$theme_options['header-html-2color'] = $theme_options['below-header-text-color-responsive'];
}
if ( isset( $theme_options['below-header-link-color-responsive'] ) ) {
$theme_options['header-html-2link-color'] = $theme_options['below-header-link-color-responsive'];
}
if ( isset( $theme_options['below-header-link-hover-color-responsive'] ) ) {
$theme_options['header-html-2link-h-color'] = $theme_options['below-header-link-hover-color-responsive'];
}
if ( isset( $theme_options['font-size-below-header-content'] ) ) {
$theme_options['font-size-section-hb-html-2'] = $theme_options['font-size-below-header-content'];
}
if ( isset( $theme_options['font-weight-below-header-content'] ) ) {
$theme_options['font-weight-section-hb-html-2'] = $theme_options['font-weight-below-header-content'];
}
if ( isset( $theme_options['line-height-below-header-content'] ) ) {
$theme_options['line-height-section-hb-html-2'] = $theme_options['line-height-below-header-content'];
}
if ( isset( $theme_options['font-family-below-header-content'] ) ) {
$theme_options['font-family-section-hb-html-2'] = $theme_options['font-family-below-header-content'];
}
if ( isset( $theme_options['text-transform-below-header-content'] ) ) {
$theme_options['text-transform-section-hb-html-2'] = $theme_options['text-transform-below-header-content'];
}
}
if ( 'widget' === $below_header_section_1 || 'widget' === $below_header_section_2 ) {
if ( isset( $theme_options['below-header-text-color-responsive'] ) ) {
$theme_options['header-widget-2-color'] = $theme_options['below-header-text-color-responsive'];
$theme_options['header-widget-2-title-color'] = $theme_options['below-header-text-color-responsive'];
}
if ( isset( $theme_options['below-header-link-color-responsive'] ) ) {
$theme_options['header-widget-2-link-color'] = $theme_options['below-header-link-color-responsive'];
}
if ( isset( $theme_options['below-header-link-hover-color-responsive'] ) ) {
$theme_options['header-widget-2-link-h-color'] = $theme_options['below-header-link-hover-color-responsive'];
}
if ( isset( $theme_options['font-size-below-header-content'] ) ) {
$theme_options['header-widget-2-content-font-size'] = $theme_options['font-size-below-header-content'];
}
if ( isset( $theme_options['font-weight-below-header-content'] ) ) {
$theme_options['header-widget-2-content-font-weight'] = $theme_options['font-weight-below-header-content'];
}
if ( isset( $theme_options['line-height-below-header-content'] ) ) {
$theme_options['header-widget-2-content-line-height'] = $theme_options['line-height-below-header-content'];
}
if ( isset( $theme_options['font-family-below-header-content'] ) ) {
$theme_options['header-widget-2-content-font-family'] = $theme_options['font-family-below-header-content'];
}
if ( isset( $theme_options['text-transform-below-header-content'] ) ) {
$theme_options['header-widget-2-content-text-transform'] = $theme_options['text-transform-below-header-content'];
}
}
switch ( $below_header_layout ) {
case 'below-header-layout-1':
$theme_options['header-desktop-items']['below'] = array(
'below_left' => ( '' !== $new_below_header_section_1_item ) ? array( $new_below_header_section_1_item ) : array(),
'below_left_center' => array(),
'below_center' => array(),
'below_right_center' => array(),
'below_right' => ( '' !== $new_below_header_section_2_item ) ? array( $new_below_header_section_2_item ) : array(),
);
break;
case 'below-header-layout-2':
$theme_options['header-desktop-items']['below'] = array(
'below_left' => array(),
'below_left_center' => array(),
'below_center' => ( '' !== $new_below_header_section_1_item ) ? array( $new_below_header_section_1_item ) : array(),
'below_right_center' => array(),
'below_right' => array(),
);
break;
}
if ( $below_header_on_mobile ) {
if ( $below_header_swap_mobile && ( 'menu' === $below_header_section_1 || 'menu' === $below_header_section_2 ) ) {
$temp = $new_below_header_section_1_item;
$new_below_header_section_1_item = $new_below_header_section_2_item;
$new_below_header_section_2_item = $temp;
}
if ( $below_header_merge_menu && ( 'menu' === $below_header_section_1 || 'menu' === $below_header_section_2 ) ) {
if ( '' !== $new_below_header_section_1_item ) {
$theme_options['header-mobile-items']['popup']['popup_content'][] = $new_below_header_section_1_item;
}
if ( '' !== $new_below_header_section_2_item ) {
$theme_options['header-mobile-items']['popup']['popup_content'][] = $new_below_header_section_2_item;
}
$theme_options['header-menu2-menu-stack-on-mobile'] = true;
$theme_options['header-mobile-items']['below'] = array(
'below_left' => array(),
'below_center' => array(),
'below_right' => array(),
);
} else {
switch ( $below_header_layout ) {
case 'below-header-layout-1':
$theme_options['header-mobile-items']['below'] = array(
'below_left' => ( '' !== $new_below_header_section_1_item ) ? array( $new_below_header_section_1_item ) : array(),
'below_center' => array(),
'below_right' => ( '' !== $new_below_header_section_2_item ) ? array( $new_below_header_section_2_item ) : array(),
);
break;
case 'below-header-layout-2':
$theme_options['header-mobile-items']['below'] = array(
'below_left' => array(),
'below_center' => ( '' !== $new_below_header_section_1_item ) ? array( $new_below_header_section_1_item ) : array(),
'below_right' => array(),
);
break;
}
}
}
return array(
'theme_options' => $theme_options,
'used_elements' => $used_elements,
'widget_options' => $widget_options,
);
}
/**
* Header Footer builder - Migration of Above Header.
*
* @since 3.0.0
* @param array $theme_options Theme options.
* @param array $used_elements Used Elements array.
* @param array $widget_options Widget options.
* @return array
*/
function astra_above_header_builder_migration( $theme_options, $used_elements, $widget_options ) {
/**
* Above Header.
*/
$above_header_layout = ( isset( $theme_options['above-header-layout'] ) ) ? $theme_options['above-header-layout'] : '';
$above_header_on_mobile = ( isset( $theme_options['above-header-on-mobile'] ) ) ? $theme_options['above-header-on-mobile'] : '';
$above_header_merge_menu = ( isset( $theme_options['above-header-merge-menu'] ) ) ? $theme_options['above-header-merge-menu'] : '';
$above_header_swap_mobile = ( isset( $theme_options['above-header-swap-mobile'] ) ) ? $theme_options['above-header-swap-mobile'] : '';
if ( isset( $theme_options['above-header-height'] ) ) {
$theme_options['hba-header-height'] = array(
'desktop' => $theme_options['above-header-height'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['above-header-divider'] ) ) {
$theme_options['hba-header-separator'] = $theme_options['above-header-divider'];
}
if ( isset( $theme_options['above-header-divider-color'] ) ) {
$theme_options['hba-header-bottom-border-color'] = $theme_options['above-header-divider-color'];
}
if ( isset( $theme_options['above-header-bg-obj-responsive'] ) ) {
$theme_options['hba-header-bg-obj-responsive'] = $theme_options['above-header-bg-obj-responsive'];
}
if ( isset( $theme_options['above-header-spacing'] ) ) {
$theme_options['section-above-header-builder-padding'] = $theme_options['above-header-spacing'];
}
// Above Header Section 1.
$above_header_section_1 = ( isset( $theme_options['above-header-section-1'] ) ) ? $theme_options['above-header-section-1'] : '';
$new_above_header_section_1_item = '';
switch ( $above_header_section_1 ) {
case 'menu':
$new_above_header_section_1_item = 'menu-3';
break;
case 'search':
if ( ! in_array( 'search', $used_elements ) ) {
$new_above_header_section_1_item = 'search';
if ( isset( $theme_options['above-header-section-1-search-box-type'] ) ) {
$theme_options['header-search-box-type'] = $theme_options['above-header-section-1-search-box-type'];
}
}
break;
case 'text-html':
if ( ! in_array( 'html-3', $used_elements ) ) {
$new_above_header_section_1_item = 'html-3';
if ( isset( $theme_options['above-header-section-1-html'] ) ) {
$theme_options['header-html-3'] = $theme_options['above-header-section-1-html'];
}
}
break;
case 'widget':
if ( ! in_array( 'widget-3', $used_elements ) ) {
$new_above_header_section_1_item = 'widget-3';
if ( isset( $widget_options['above-header-widget-1'] ) ) {
$widget_options['header-widget-3'] = $widget_options['above-header-widget-1'];
}
}
break;
case 'woocommerce':
if ( ! in_array( 'woo-cart', $used_elements ) ) {
$new_above_header_section_1_item = 'woo-cart';
}
break;
case 'edd':
if ( ! in_array( 'edd-cart', $used_elements ) ) {
$new_above_header_section_1_item = 'edd-cart';
}
break;
}
// Above Header Section 2.
$above_header_section_2 = ( isset( $theme_options['above-header-section-2'] ) ) ? $theme_options['above-header-section-2'] : '';
$new_above_header_section_2_item = '';
switch ( $above_header_section_2 ) {
case 'menu':
$new_above_header_section_2_item = 'menu-3';
break;
case 'search':
if ( ! in_array( 'search', $used_elements ) ) {
$new_above_header_section_2_item = 'search';
if ( isset( $theme_options['above-header-section-2-search-box-type'] ) ) {
$theme_options['header-search-box-type'] = $theme_options['above-header-section-2-search-box-type'];
}
}
break;
case 'text-html':
if ( ! in_array( 'html-3', $used_elements ) ) {
$new_above_header_section_2_item = 'html-3';
if ( isset( $theme_options['above-header-section-2-html'] ) ) {
$theme_options['header-html-3'] = $theme_options['above-header-section-2-html'];
}
}
break;
case 'widget':
if ( ! in_array( 'widget-3', $used_elements ) ) {
$new_above_header_section_2_item = 'widget-3';
if ( isset( $widget_options['above-header-widget-2'] ) ) {
$widget_options['header-widget-3'] = $widget_options['above-header-widget-2'];
}
}
break;
case 'woocommerce':
if ( ! in_array( 'woo-cart', $used_elements ) ) {
$new_above_header_section_2_item = 'woo-cart';
}
break;
case 'edd':
if ( ! in_array( 'edd-cart', $used_elements ) ) {
$new_above_header_section_2_item = 'edd-cart';
}
break;
}
if ( 'menu' === $above_header_section_1 || 'menu' === $above_header_section_2 ) {
$theme_options['header-menu3-menu-stack-on-mobile'] = false;
/**
* Menu - 3
*/
if ( isset( $theme_options['above-header-submenu-container-animation'] ) ) {
$theme_options['header-menu3-submenu-container-animation'] = $theme_options['above-header-submenu-container-animation'];
}
if ( isset( $theme_options['above-header-submenu-border'] ) ) {
$theme_options['header-menu3-submenu-border'] = $theme_options['above-header-submenu-border'];
}
if ( isset( $theme_options['above-header-submenu-b-color'] ) ) {
$theme_options['header-menu3-submenu-b-color'] = $theme_options['above-header-submenu-b-color'];
}
if ( isset( $theme_options['above-header-submenu-item-border'] ) ) {
$theme_options['header-menu3-submenu-item-border'] = $theme_options['above-header-submenu-item-border'];
}
if ( isset( $theme_options['above-header-submenu-item-b-color'] ) ) {
$theme_options['header-menu3-submenu-item-b-color'] = $theme_options['above-header-submenu-item-b-color'];
}
if ( isset( $theme_options['above-header-menu-text-color-responsive'] ) ) {
$theme_options['header-menu3-color-responsive'] = $theme_options['above-header-menu-text-color-responsive'];
}
if ( isset( $theme_options['above-header-menu-bg-obj-responsive'] ) ) {
$theme_options['header-menu3-bg-obj-responsive'] = $theme_options['above-header-menu-bg-obj-responsive'];
}
if ( isset( $theme_options['above-header-menu-text-hover-color-responsive'] ) ) {
$theme_options['header-menu3-h-color-responsive'] = $theme_options['above-header-menu-text-hover-color-responsive'];
}
if ( isset( $theme_options['above-header-menu-bg-hover-color-responsive'] ) ) {
$theme_options['header-menu3-h-bg-color-responsive'] = $theme_options['above-header-menu-bg-hover-color-responsive'];
}
if ( isset( $theme_options['above-header-current-menu-text-color-responsive'] ) ) {
$theme_options['header-menu3-a-color-responsive'] = $theme_options['above-header-current-menu-text-color-responsive'];
}
if ( isset( $theme_options['above-header-current-menu-bg-color-responsive'] ) ) {
$theme_options['header-menu3-a-bg-color-responsive'] = $theme_options['above-header-current-menu-bg-color-responsive'];
}
if ( isset( $theme_options['above-header-font-size'] ) ) {
$theme_options['header-menu3-font-size'] = $theme_options['above-header-font-size'];
}
if ( isset( $theme_options['above-header-font-weight'] ) ) {
$theme_options['header-menu3-font-weight'] = $theme_options['above-header-font-weight'];
}
if ( isset( $theme_options['above-header-line-height'] ) ) {
$theme_options['header-menu3-line-height'] = $theme_options['above-header-line-height'];
}
if ( isset( $theme_options['above-header-font-family'] ) ) {
$theme_options['header-menu3-font-family'] = $theme_options['above-header-font-family'];
}
if ( isset( $theme_options['above-header-text-transform'] ) ) {
$theme_options['header-menu3-text-transform'] = $theme_options['above-header-text-transform'];
}
if ( isset( $theme_options['above-header-menu-spacing'] ) ) {
$theme_options['header-menu3-menu-spacing'] = $theme_options['above-header-menu-spacing'];
}
// Menu 3 - Submenu.
if ( isset( $theme_options['above-header-submenu-text-color-responsive'] ) ) {
$theme_options['header-menu3-submenu-color-responsive'] = $theme_options['above-header-submenu-text-color-responsive'];
}
if ( isset( $theme_options['above-header-submenu-bg-color-responsive'] ) ) {
$theme_options['header-menu3-submenu-bg-color-responsive'] = $theme_options['above-header-submenu-bg-color-responsive'];
}
if ( isset( $theme_options['above-header-submenu-hover-color-responsive'] ) ) {
$theme_options['header-menu3-submenu-h-color-responsive'] = $theme_options['above-header-submenu-hover-color-responsive'];
}
if ( isset( $theme_options['above-header-submenu-bg-hover-color-responsive'] ) ) {
$theme_options['header-menu3-submenu-h-bg-color-responsive'] = $theme_options['above-header-submenu-bg-hover-color-responsive'];
}
if ( isset( $theme_options['above-header-submenu-active-color-responsive'] ) ) {
$theme_options['header-menu3-submenu-a-color-responsive'] = $theme_options['above-header-submenu-active-color-responsive'];
}
if ( isset( $theme_options['above-header-submenu-active-bg-color-responsive'] ) ) {
$theme_options['header-menu3-submenu-a-bg-color-responsive'] = $theme_options['above-header-submenu-active-bg-color-responsive'];
}
if ( isset( $theme_options['font-size-above-header-dropdown-menu'] ) ) {
$theme_options['header-font-size-menu3-sub-menu'] = $theme_options['font-size-above-header-dropdown-menu'];
}
if ( isset( $theme_options['font-weight-above-header-dropdown-menu'] ) ) {
$theme_options['header-font-weight-menu3-sub-menu'] = $theme_options['font-weight-above-header-dropdown-menu'];
}
if ( isset( $theme_options['line-height-above-header-dropdown-menu'] ) ) {
$theme_options['header-line-height-menu3-sub-menu'] = $theme_options['line-height-above-header-dropdown-menu'];
}
if ( isset( $theme_options['font-family-above-header-dropdown-menu'] ) ) {
$theme_options['header-font-family-menu3-sub-menu'] = $theme_options['font-family-above-header-dropdown-menu'];
}
if ( isset( $theme_options['text-transform-above-header-dropdown-menu'] ) ) {
$theme_options['header-text-transform-menu3-sub-menu'] = $theme_options['text-transform-above-header-dropdown-menu'];
}
if ( isset( $theme_options['above-header-submenu-spacing'] ) ) {
$theme_options['header-menu3-submenu-spacing'] = $theme_options['above-header-submenu-spacing'];
}
}
if ( 'search' === $above_header_section_1 || 'search' === $above_header_section_2 ) {
if ( isset( $theme_options['above-header-text-color-responsive'] ) ) {
$theme_options['header-search-icon-color'] = $theme_options['above-header-text-color-responsive'];
}
}
if ( 'text-html' === $above_header_section_1 || 'text-html' === $above_header_section_2 ) {
if ( isset( $theme_options['above-header-text-color-responsive'] ) ) {
$theme_options['header-html-3color'] = $theme_options['above-header-text-color-responsive'];
}
if ( isset( $theme_options['above-header-link-color-responsive'] ) ) {
$theme_options['header-html-3link-color'] = $theme_options['above-header-link-color-responsive'];
}
if ( isset( $theme_options['above-header-link-hover-color-responsive'] ) ) {
$theme_options['header-html-3link-h-color'] = $theme_options['above-header-link-hover-color-responsive'];
}
if ( isset( $theme_options['font-size-above-header-content'] ) ) {
$theme_options['font-size-section-hb-html-3'] = $theme_options['font-size-above-header-content'];
}
if ( isset( $theme_options['font-weight-above-header-content'] ) ) {
$theme_options['font-weight-section-hb-html-3'] = $theme_options['font-weight-above-header-content'];
}
if ( isset( $theme_options['line-height-above-header-content'] ) ) {
$theme_options['line-height-section-hb-html-3'] = $theme_options['line-height-above-header-content'];
}
if ( isset( $theme_options['font-family-above-header-content'] ) ) {
$theme_options['font-family-section-hb-html-3'] = $theme_options['font-family-above-header-content'];
}
if ( isset( $theme_options['text-transform-above-header-content'] ) ) {
$theme_options['text-transform-section-hb-html-3'] = $theme_options['text-transform-above-header-content'];
}
}
if ( 'widget' === $above_header_section_1 || 'widget' === $above_header_section_2 ) {
if ( isset( $theme_options['above-header-text-color-responsive'] ) ) {
$theme_options['header-widget-3-color'] = $theme_options['above-header-text-color-responsive'];
$theme_options['header-widget-3-title-color'] = $theme_options['above-header-text-color-responsive'];
}
if ( isset( $theme_options['above-header-link-color-responsive'] ) ) {
$theme_options['header-widget-3-link-color'] = $theme_options['above-header-link-color-responsive'];
}
if ( isset( $theme_options['above-header-link-hover-color-responsive'] ) ) {
$theme_options['header-widget-3-link-h-color'] = $theme_options['above-header-link-hover-color-responsive'];
}
if ( isset( $theme_options['font-size-above-header-content'] ) ) {
$theme_options['header-widget-3-content-font-size'] = $theme_options['font-size-above-header-content'];
}
if ( isset( $theme_options['font-weight-above-header-content'] ) ) {
$theme_options['header-widget-3-content-font-weight'] = $theme_options['font-weight-above-header-content'];
}
if ( isset( $theme_options['line-height-above-header-content'] ) ) {
$theme_options['header-widget-3-content-line-height'] = $theme_options['line-height-above-header-content'];
}
if ( isset( $theme_options['font-family-above-header-content'] ) ) {
$theme_options['header-widget-3-content-font-family'] = $theme_options['font-family-above-header-content'];
}
if ( isset( $theme_options['text-transform-above-header-content'] ) ) {
$theme_options['header-widget-3-content-text-transform'] = $theme_options['text-transform-above-header-content'];
}
}
switch ( $above_header_layout ) {
case 'above-header-layout-1':
$theme_options['header-desktop-items']['above'] = array(
'above_left' => ( '' !== $new_above_header_section_1_item ) ? array( $new_above_header_section_1_item ) : array(),
'above_left_center' => array(),
'above_center' => array(),
'above_right_center' => array(),
'above_right' => ( '' !== $new_above_header_section_2_item ) ? array( $new_above_header_section_2_item ) : array(),
);
break;
case 'above-header-layout-2':
$theme_options['header-desktop-items']['above'] = array(
'above_left' => array(),
'above_left_center' => array(),
'above_center' => ( '' !== $new_above_header_section_1_item ) ? array( $new_above_header_section_1_item ) : array(),
'above_right_center' => array(),
'above_right' => array(),
);
break;
}
if ( $above_header_on_mobile ) {
if ( $above_header_swap_mobile && ( 'menu' === $above_header_section_1 || 'menu' === $above_header_section_2 ) ) {
$temp = $new_above_header_section_1_item;
$new_above_header_section_1_item = $new_above_header_section_2_item;
$new_above_header_section_2_item = $temp;
}
if ( $above_header_merge_menu && ( 'menu' === $above_header_section_1 || 'menu' === $above_header_section_2 ) ) {
if ( '' !== $new_above_header_section_1_item ) {
$theme_options['header-mobile-items']['popup']['popup_content'][] = $new_above_header_section_1_item;
}
if ( '' !== $new_above_header_section_2_item ) {
$theme_options['header-mobile-items']['popup']['popup_content'][] = $new_above_header_section_2_item;
}
$theme_options['header-menu3-menu-stack-on-mobile'] = true;
$theme_options['header-mobile-items']['above'] = array(
'above_left' => array(),
'above_center' => array(),
'above_right' => array(),
);
} else {
switch ( $above_header_layout ) {
case 'above-header-layout-1':
$theme_options['header-mobile-items']['above'] = array(
'above_left' => ( '' !== $new_above_header_section_1_item ) ? array( $new_above_header_section_1_item ) : array(),
'above_center' => array(),
'above_right' => ( '' !== $new_above_header_section_2_item ) ? array( $new_above_header_section_2_item ) : array(),
);
break;
case 'above-header-layout-2':
$theme_options['header-mobile-items']['above'] = array(
'above_left' => array(),
'above_center' => ( '' !== $new_above_header_section_1_item ) ? array( $new_above_header_section_1_item ) : array(),
'above_right' => array(),
);
break;
}
}
}
return array(
'theme_options' => $theme_options,
'used_elements' => $used_elements,
'widget_options' => $widget_options,
);
}
/**
* Header Footer builder - Migration of Footer.
*
* @since 3.0.0
* @param array $theme_options Theme options.
* @param array $used_elements Used Elements array.
* @param array $widget_options Widget options.
* @return array
*/
function astra_footer_builder_migration( $theme_options, $used_elements, $widget_options ) {
/**
* Footer
*/
$footer_layout = ( isset( $theme_options['footer-sml-layout'] ) ) ? $theme_options['footer-sml-layout'] : '';
if ( isset( $theme_options['footer-layout-width'] ) ) {
$theme_options['hb-footer-layout-width'] = $theme_options['footer-layout-width'];
}
if ( isset( $theme_options['footer-sml-divider'] ) ) {
$theme_options['hbb-footer-separator'] = $theme_options['footer-sml-divider'];
}
if ( isset( $theme_options['footer-sml-divider-color'] ) ) {
$theme_options['hbb-footer-top-border-color'] = $theme_options['footer-sml-divider-color'];
}
if ( isset( $theme_options['footer-bg-obj'] ) ) {
$theme_options['hbb-footer-bg-obj-responsive'] = array(
'desktop' => $theme_options['footer-bg-obj'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['footer-sml-spacing'] ) ) {
$theme_options['section-below-footer-builder-padding'] = $theme_options['footer-sml-spacing'];
}
// Footer Section 1.
$footer_section_1 = ( isset( $theme_options['footer-sml-section-1'] ) ) ? $theme_options['footer-sml-section-1'] : '';
$new_section_1_item = '';
$used_elements[] = $new_section_1_item;
$footer_section_2 = ( isset( $theme_options['footer-sml-section-2'] ) ) ? $theme_options['footer-sml-section-2'] : '';
$new_section_2_item = '';
$used_elements[] = $new_section_2_item;
switch ( $footer_section_1 ) {
case 'custom':
$new_section_1_item = 'copyright';
$theme_options['footer-copyright-alignment'] = array(
'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'left',
'tablet' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'left',
'mobile' => 'center',
);
break;
case 'widget':
$new_section_1_item = 'widget-1';
$theme_options['footer-widget-alignment-1'] = array(
'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'left',
'tablet' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'left',
'mobile' => 'center',
);
if ( isset( $theme_options['footer-color'] ) ) {
$theme_options['footer-widget-1-color'] = array(
'desktop' => $theme_options['footer-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['footer-link-color'] ) ) {
$theme_options['footer-widget-1-link-color'] = array(
'desktop' => $theme_options['footer-link-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['footer-link-h-color'] ) ) {
$theme_options['footer-widget-1-link-h-color'] = array(
'desktop' => $theme_options['footer-link-h-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['font-size-footer-content'] ) ) {
$theme_options['footer-widget-1-content-font-size'] = $theme_options['font-size-footer-content'];
}
if ( isset( $theme_options['font-weight-footer-content'] ) ) {
$theme_options['footer-widget-1-content-font-weight'] = $theme_options['font-weight-footer-content'];
}
if ( isset( $theme_options['line-height-footer-content'] ) ) {
$theme_options['footer-widget-1-content-line-height'] = $theme_options['line-height-footer-content'];
}
if ( isset( $theme_options['font-family-footer-content'] ) ) {
$theme_options['footer-widget-1-content-font-family'] = $theme_options['font-family-footer-content'];
}
if ( isset( $theme_options['text-transform-footer-content'] ) ) {
$theme_options['footer-widget-1-content-text-transform'] = $theme_options['text-transform-footer-content'];
}
break;
case 'menu':
$theme_options['footer-menu-alignment'] = array(
'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'flex-start',
'tablet' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'flex-start',
'mobile' => 'center',
);
$new_section_1_item = 'menu';
break;
}
// Footer Section 2.
switch ( $footer_section_2 ) {
case 'custom':
$new_section_2_item = ( 'copyright' !== $new_section_1_item ) ? 'copyright' : 'html-1';
if ( 'copyright' !== $new_section_1_item ) {
$theme_options['footer-copyright-alignment'] = array(
'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'right',
'tablet' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'right',
'mobile' => 'center',
);
if ( isset( $theme_options['footer-sml-section-2-credit'] ) ) {
$theme_options['footer-copyright-editor'] = $theme_options['footer-sml-section-2-credit'];
}
} else {
$theme_options['footer-html-1-alignment'] = array(
'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'right',
'tablet' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'right',
'mobile' => 'center',
);
if ( isset( $theme_options['footer-sml-section-2-credit'] ) ) {
$theme_options['footer-html-1'] = $theme_options['footer-sml-section-2-credit'];
}
}
break;
case 'widget':
$new_section_2_item = 'widget-2';
$theme_options['footer-widget-alignment-2'] = array(
'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'right',
'tablet' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'right',
'mobile' => 'center',
);
if ( isset( $theme_options['footer-color'] ) ) {
$theme_options['footer-widget-2-color'] = array(
'desktop' => $theme_options['footer-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['footer-link-color'] ) ) {
$theme_options['footer-widget-2-link-color'] = array(
'desktop' => $theme_options['footer-link-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['footer-link-h-color'] ) ) {
$theme_options['footer-widget-2-link-h-color'] = array(
'desktop' => $theme_options['footer-link-h-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['font-size-footer-content'] ) ) {
$theme_options['footer-widget-2-content-font-size'] = $theme_options['font-size-footer-content'];
}
if ( isset( $theme_options['font-weight-footer-content'] ) ) {
$theme_options['footer-widget-2-content-font-weight'] = $theme_options['font-weight-footer-content'];
}
if ( isset( $theme_options['line-height-footer-content'] ) ) {
$theme_options['footer-widget-2-content-line-height'] = $theme_options['line-height-footer-content'];
}
if ( isset( $theme_options['font-family-footer-content'] ) ) {
$theme_options['footer-widget-2-content-font-family'] = $theme_options['font-family-footer-content'];
}
if ( isset( $theme_options['text-transform-footer-content'] ) ) {
$theme_options['footer-widget-2-content-text-transform'] = $theme_options['text-transform-footer-content'];
}
break;
case 'menu':
$new_section_2_item = 'menu';
$theme_options['footer-menu-alignment'] = array(
'desktop' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'flex-end',
'tablet' => ( 'footer-sml-layout-1' === $footer_layout ) ? 'center' : 'flex-end',
'mobile' => 'center',
);
break;
}
if ( 'custom' === $footer_section_1 || 'custom' === $footer_section_2 ) {
// Footer Content Color migrated to Copyright.
if ( isset( $theme_options['footer-sml-section-1-credit'] ) ) {
$theme_options['footer-copyright-editor'] = $theme_options['footer-sml-section-1-credit'];
}
if ( isset( $theme_options['footer-color'] ) ) {
$theme_options['footer-copyright-color'] = $theme_options['footer-color'];
}
if ( isset( $theme_options['footer-link-color'] ) ) {
$theme_options['footer-copyright-link-color'] = $theme_options['footer-link-color'];
}
if ( isset( $theme_options['footer-link-h-color'] ) ) {
$theme_options['footer-copyright-link-h-color'] = $theme_options['footer-link-h-color'];
}
if ( isset( $theme_options['font-size-footer-content'] ) ) {
$theme_options['font-size-section-footer-copyright'] = $theme_options['font-size-footer-content'];
}
if ( isset( $theme_options['font-weight-footer-content'] ) ) {
$theme_options['font-weight-section-footer-copyright'] = $theme_options['font-weight-footer-content'];
}
if ( isset( $theme_options['line-height-footer-content'] ) ) {
$theme_options['line-height-section-footer-copyright'] = $theme_options['line-height-footer-content'];
}
if ( isset( $theme_options['font-family-footer-content'] ) ) {
$theme_options['font-family-section-footer-copyright'] = $theme_options['font-family-footer-content'];
}
if ( isset( $theme_options['text-transform-footer-content'] ) ) {
$theme_options['text-transform-section-footer-copyright'] = $theme_options['text-transform-footer-content'];
}
if ( 'html-1' === $new_section_2_item ) {
// Footer Content Color migrated to HTML 1.
if ( isset( $theme_options['footer-color'] ) ) {
$theme_options['footer-html-1-color'] = array(
'desktop' => $theme_options['footer-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['footer-link-color'] ) ) {
$theme_options['footer-html-1-link-color'] = array(
'desktop' => $theme_options['footer-link-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['footer-link-h-color'] ) ) {
$theme_options['footer-html-1-link-h-color'] = array(
'desktop' => $theme_options['footer-link-h-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['font-size-footer-content'] ) ) {
$theme_options['font-size-section-fb-html-1'] = $theme_options['font-size-footer-content'];
}
if ( isset( $theme_options['font-weight-footer-content'] ) ) {
$theme_options['font-weight-section-fb-html-1'] = $theme_options['font-weight-footer-content'];
}
if ( isset( $theme_options['line-height-footer-content'] ) ) {
$theme_options['line-height-section-fb-html-1'] = $theme_options['line-height-footer-content'];
}
if ( isset( $theme_options['font-family-footer-content'] ) ) {
$theme_options['font-family-section-fb-html-1'] = $theme_options['font-family-footer-content'];
}
if ( isset( $theme_options['text-transform-footer-content'] ) ) {
$theme_options['text-transform-section-fb-html-1'] = $theme_options['text-transform-footer-content'];
}
}
}
if ( 'menu' === $footer_section_1 || 'menu' === $footer_section_2 ) {
if ( isset( $theme_options['footer-link-color'] ) ) {
$theme_options['footer-menu-color-responsive'] = array(
'desktop' => $theme_options['footer-link-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['footer-link-h-color'] ) ) {
$theme_options['footer-menu-h-color-responsive'] = array(
'desktop' => $theme_options['footer-link-h-color'],
'tablet' => '',
'mobile' => '',
);
}
$theme_options['footer-menu-layout'] = array(
'desktop' => 'horizontal',
'tablet' => 'horizontal',
'mobile' => 'horizontal',
);
if ( isset( $theme_options['font-size-footer-content'] ) ) {
$theme_options['footer-menu-font-size'] = $theme_options['font-size-footer-content'];
}
if ( isset( $theme_options['font-weight-footer-content'] ) ) {
$theme_options['footer-menu-font-weight'] = $theme_options['font-weight-footer-content'];
}
if ( isset( $theme_options['line-height-footer-content'] ) ) {
$theme_options['footer-menu-line-height'] = $theme_options['line-height-footer-content'];
}
if ( isset( $theme_options['font-family-footer-content'] ) ) {
$theme_options['footer-menu-font-family'] = $theme_options['font-family-footer-content'];
}
if ( isset( $theme_options['text-transform-footer-content'] ) ) {
$theme_options['footer-menu-text-transform'] = $theme_options['text-transform-footer-content'];
}
if ( isset( $theme_options['footer-menu-spacing'] ) ) {
$theme_options['footer-main-menu-spacing'] = $theme_options['footer-menu-spacing'];
}
}
if ( '' !== $footer_layout ) {
$theme_options['footer-desktop-items'] = array(
'above' =>
array(
'above_1' => array(),
'above_2' => array(),
'above_3' => array(),
'above_4' => array(),
'above_5' => array(),
),
'primary' =>
array(
'primary_1' => array(),
'primary_2' => array(),
'primary_3' => array(),
'primary_4' => array(),
'primary_5' => array(),
),
'below' =>
array(
'below_1' => array(),
'below_2' => array(),
'below_3' => array(),
'below_4' => array(),
'below_5' => array(),
),
);
switch ( $footer_layout ) {
case 'footer-sml-layout-1':
$theme_options['footer-desktop-items']['below'] = array(
'below_1' => array( $new_section_1_item, $new_section_2_item ),
'below_2' => array(),
'below_3' => array(),
'below_4' => array(),
'below_5' => array(),
);
$theme_options['hbb-footer-column'] = 1;
$theme_options['hbb-footer-layout'] = array(
'desktop' => 'full',
'tablet' => 'full',
'mobile' => 'full',
);
break;
case 'footer-sml-layout-2':
$theme_options['footer-desktop-items']['below'] = array(
'below_1' => array( $new_section_1_item ),
'below_2' => array( $new_section_2_item ),
'below_3' => array(),
'below_4' => array(),
'below_5' => array(),
);
$theme_options['hbb-footer-column'] = 2;
$theme_options['hbb-footer-layout'] = array(
'desktop' => '2-equal',
'tablet' => '2-equal',
'mobile' => 'full',
);
break;
default:
$theme_options['footer-desktop-items']['below'] = array(
'below_1' => array( 'copyright' ),
'below_2' => array(),
'below_3' => array(),
'below_4' => array(),
'below_5' => array(),
);
}
}
return array(
'theme_options' => $theme_options,
'used_elements' => $used_elements,
'widget_options' => $widget_options,
);
}
/**
* Header Footer builder - Migration of Footer Widgets.
*
* @since 3.0.0
* @param array $theme_options Theme options.
* @param array $used_elements Used Elements array.
* @param array $widget_options Widget options.
* @return array
*/
function astra_footer_widgets_migration( $theme_options, $used_elements, $widget_options ) {
$footer_widget_layouts = ( isset( $theme_options['footer-adv'] ) ) ? $theme_options['footer-adv'] : '';
if ( '' !== $footer_widget_layouts ) {
$column = 2;
$layout = array(
'desktop' => '2-equal',
'tablet' => '2-equal',
'mobile' => 'full',
);
$items = array(
'above_1' => array(),
'above_2' => array(),
'above_3' => array(),
'above_4' => array(),
'above_5' => array(),
);
switch ( $footer_widget_layouts ) {
case 'layout-1':
$column = '1';
$layout = array(
'desktop' => 'full',
'tablet' => 'full',
'mobile' => 'full',
);
$items = array(
'above_1' => array( 'widget-1' ),
'above_2' => array(),
'above_3' => array(),
'above_4' => array(),
'above_5' => array(),
);
break;
case 'layout-2':
$column = '2';
$layout = array(
'desktop' => '2-equal',
'tablet' => '2-equal',
'mobile' => '2-equal',
);
$items = array(
'above_1' => array( 'widget-1' ),
'above_2' => array( 'widget-2' ),
'above_3' => array(),
'above_4' => array(),
'above_5' => array(),
);
break;
case 'layout-3':
$column = '3';
$layout = array(
'desktop' => '3-equal',
'tablet' => 'full',
'mobile' => 'full',
);
$items = array(
'above_1' => array( 'widget-1' ),
'above_2' => array( 'widget-2' ),
'above_3' => array( 'widget-3' ),
'above_4' => array(),
'above_5' => array(),
);
break;
case 'layout-4':
$column = '4';
$layout = array(
'desktop' => '4-equal',
'tablet' => 'full',
'mobile' => 'full',
);
$items = array(
'above_1' => array( 'widget-1' ),
'above_2' => array( 'widget-2' ),
'above_3' => array( 'widget-3' ),
'above_4' => array( 'widget-4' ),
'above_5' => array(),
);
break;
case 'layout-5':
$column = '5';
$layout = array(
'desktop' => '5-equal',
'tablet' => 'full',
'mobile' => 'full',
);
$items = array(
'above_1' => array( 'widget-1' ),
'above_2' => array( 'widget-2' ),
'above_3' => array( 'widget-3' ),
'above_4' => array( 'widget-4' ),
'above_5' => array( 'widget-5' ),
);
break;
case 'layout-6':
case 'layout-7':
$column = '3';
$layout = array(
'desktop' => '3-lheavy',
'tablet' => 'full',
'mobile' => 'full',
);
$items = array(
'above_1' => array( 'widget-1' ),
'above_2' => array( 'widget-2' ),
'above_3' => array( 'widget-3' ),
'above_4' => array(),
'above_5' => array(),
);
break;
}
$theme_options['hba-footer-column'] = $column;
$theme_options['hba-footer-layout'] = $layout;
if ( isset( $theme_options['footer-desktop-items'] ) ) {
$theme_options['footer-desktop-items']['above'] = $items;
}
for ( $i = 1; $i <= $column; $i++ ) {
if ( isset( $theme_options['footer-adv-wgt-title-color'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-title-color' ] = array(
'desktop' => $theme_options['footer-adv-wgt-title-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['footer-adv-text-color'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-color' ] = array(
'desktop' => $theme_options['footer-adv-text-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['footer-adv-link-color'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-link-color' ] = array(
'desktop' => $theme_options['footer-adv-link-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['footer-adv-link-h-color'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-link-h-color' ] = array(
'desktop' => $theme_options['footer-adv-link-h-color'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['footer-adv-wgt-title-font-size'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-font-size' ] = $theme_options['footer-adv-wgt-title-font-size'];
}
if ( isset( $theme_options['footer-adv-wgt-title-font-weight'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-font-weight' ] = $theme_options['footer-adv-wgt-title-font-weight'];
}
if ( isset( $theme_options['footer-adv-wgt-title-line-height'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-line-height' ] = $theme_options['footer-adv-wgt-title-line-height'];
}
if ( isset( $theme_options['footer-adv-wgt-title-font-family'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-font-family' ] = $theme_options['footer-adv-wgt-title-font-family'];
}
if ( isset( $theme_options['footer-adv-wgt-title-text-transform'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-text-transform' ] = $theme_options['footer-adv-wgt-title-text-transform'];
}
if ( isset( $theme_options['footer-adv-wgt-content-font-size'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-content-font-size' ] = $theme_options['footer-adv-wgt-content-font-size'];
}
if ( isset( $theme_options['footer-adv-wgt-content-font-weight'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-content-font-weight' ] = $theme_options['footer-adv-wgt-content-font-weight'];
}
if ( isset( $theme_options['footer-adv-wgt-content-line-height'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-content-line-height' ] = $theme_options['footer-adv-wgt-content-line-height'];
}
if ( isset( $theme_options['footer-adv-wgt-content-font-family'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-content-font-family' ] = $theme_options['footer-adv-wgt-content-font-family'];
}
if ( isset( $theme_options['footer-adv-wgt-content-text-transform'] ) ) {
$theme_options[ 'footer-widget-' . $i . '-content-text-transform' ] = $theme_options['footer-adv-wgt-content-text-transform'];
}
if ( isset( $widget_options[ 'advanced-footer-widget-' . $i ] ) ) {
$widget_options[ 'footer-widget-' . $i ] = $widget_options[ 'advanced-footer-widget-' . $i ];
}
}
}
if ( isset( $theme_options['footer-adv-border-width'] ) ) {
$theme_options['hba-footer-separator'] = $theme_options['footer-adv-border-width'];
}
if ( isset( $theme_options['footer-adv-border-color'] ) ) {
$theme_options['hba-footer-top-border-color'] = $theme_options['footer-adv-border-color'];
}
if ( isset( $theme_options['footer-adv-bg-obj'] ) ) {
$theme_options['hba-footer-bg-obj-responsive'] = array(
'desktop' => $theme_options['footer-adv-bg-obj'],
'tablet' => '',
'mobile' => '',
);
}
if ( isset( $theme_options['footer-adv-area-padding'] ) ) {
$theme_options['section-above-footer-builder-padding'] = $theme_options['footer-adv-area-padding'];
}
return array(
'theme_options' => $theme_options,
'used_elements' => $used_elements,
'widget_options' => $widget_options,
);
}
/**
* Header Footer builder - Migration of Primary Menu.
*
* @since 3.0.0
* @param array $theme_options Theme options.
* @param array $used_elements Used Elements array.
* @param array $widget_options Widget options.
* @return array
*/
function astra_primary_menu_builder_migration( $theme_options, $used_elements, $widget_options ) {
/**
* Primary Menu.
*/
if ( isset( $theme_options['header-main-submenu-container-animation'] ) ) {
$theme_options['header-menu1-submenu-container-animation'] = $theme_options['header-main-submenu-container-animation'];
}
if ( isset( $theme_options['primary-submenu-border'] ) ) {
$theme_options['header-menu1-submenu-border'] = $theme_options['primary-submenu-border'];
}
if ( isset( $theme_options['primary-submenu-b-color'] ) ) {
$theme_options['header-menu1-submenu-b-color'] = $theme_options['primary-submenu-b-color'];
}
if ( isset( $theme_options['primary-submenu-item-border'] ) ) {
$theme_options['header-menu1-submenu-item-border'] = $theme_options['primary-submenu-item-border'];
}
if ( isset( $theme_options['primary-submenu-item-b-color'] ) ) {
$theme_options['header-menu1-submenu-item-b-color'] = $theme_options['primary-submenu-item-b-color'];
}
/**
* Primary Menu.
*/
if ( isset( $theme_options['primary-menu-color-responsive'] ) ) {
$theme_options['header-menu1-color-responsive'] = $theme_options['primary-menu-color-responsive'];
}
if ( isset( $theme_options['primary-menu-bg-obj-responsive'] ) ) {
$theme_options['header-menu1-bg-obj-responsive'] = $theme_options['primary-menu-bg-obj-responsive'];
}
if ( isset( $theme_options['primary-menu-text-h-color-responsive'] ) ) {
$theme_options['header-menu1-h-color-responsive'] = $theme_options['primary-menu-text-h-color-responsive'];
}
if ( isset( $theme_options['primary-menu-h-bg-color-responsive'] ) ) {
$theme_options['header-menu1-h-bg-color-responsive'] = $theme_options['primary-menu-h-bg-color-responsive'];
}
if ( isset( $theme_options['primary-menu-a-color-responsive'] ) ) {
$theme_options['header-menu1-a-color-responsive'] = $theme_options['primary-menu-a-color-responsive'];
}
if ( isset( $theme_options['primary-menu-a-bg-color-responsive'] ) ) {
$theme_options['header-menu1-a-bg-color-responsive'] = $theme_options['primary-menu-a-bg-color-responsive'];
}
if ( isset( $theme_options['font-size-primary-menu'] ) ) {
$theme_options['header-menu1-font-size'] = $theme_options['font-size-primary-menu'];
}
if ( isset( $theme_options['font-weight-primary-menu'] ) ) {
$theme_options['header-menu1-font-weight'] = $theme_options['font-weight-primary-menu'];
}
if ( isset( $theme_options['line-height-primary-menu'] ) ) {
$theme_options['header-menu1-line-height'] = $theme_options['line-height-primary-menu'];
}
if ( isset( $theme_options['font-family-primary-menu'] ) ) {
$theme_options['header-menu1-font-family'] = $theme_options['font-family-primary-menu'];
}
if ( isset( $theme_options['text-transform-primary-menu'] ) ) {
$theme_options['header-menu1-text-transform'] = $theme_options['text-transform-primary-menu'];
}
if ( isset( $theme_options['primary-menu-spacing'] ) ) {
$theme_options['header-menu1-menu-spacing'] = $theme_options['primary-menu-spacing'];
}
// Primary Menu - Submenu.
if ( isset( $theme_options['primary-submenu-color-responsive'] ) ) {
$theme_options['header-menu1-submenu-color-responsive'] = $theme_options['primary-submenu-color-responsive'];
}
if ( isset( $theme_options['primary-submenu-bg-color-responsive'] ) ) {
$theme_options['header-menu1-submenu-bg-color-responsive'] = $theme_options['primary-submenu-bg-color-responsive'];
}
if ( isset( $theme_options['primary-submenu-h-color-responsive'] ) ) {
$theme_options['header-menu1-submenu-h-color-responsive'] = $theme_options['primary-submenu-h-color-responsive'];
}
if ( isset( $theme_options['primary-submenu-h-bg-color-responsive'] ) ) {
$theme_options['header-menu1-submenu-h-bg-color-responsive'] = $theme_options['primary-submenu-h-bg-color-responsive'];
}
if ( isset( $theme_options['primary-submenu-a-color-responsive'] ) ) {
$theme_options['header-menu1-submenu-a-color-responsive'] = $theme_options['primary-submenu-a-color-responsive'];
}
if ( isset( $theme_options['primary-submenu-a-bg-color-responsive'] ) ) {
$theme_options['header-menu1-submenu-a-bg-color-responsive'] = $theme_options['primary-submenu-a-bg-color-responsive'];
}
if ( isset( $theme_options['font-size-primary-dropdown-menu'] ) ) {
$theme_options['header-font-size-menu1-sub-menu'] = $theme_options['font-size-primary-dropdown-menu'];
}
if ( isset( $theme_options['font-weight-primary-dropdown-menu'] ) ) {
$theme_options['header-font-weight-menu1-sub-menu'] = $theme_options['font-weight-primary-dropdown-menu'];
}
if ( isset( $theme_options['line-height-primary-dropdown-menu'] ) ) {
$theme_options['header-line-height-menu1-sub-menu'] = $theme_options['line-height-primary-dropdown-menu'];
}
if ( isset( $theme_options['font-family-primary-dropdown-menu'] ) ) {
$theme_options['header-font-family-menu1-sub-menu'] = $theme_options['font-family-primary-dropdown-menu'];
}
if ( isset( $theme_options['text-transform-primary-dropdown-menu'] ) ) {
$theme_options['header-text-transform-menu1-sub-menu'] = $theme_options['text-transform-primary-dropdown-menu'];
}
if ( isset( $theme_options['primary-submenu-spacing'] ) ) {
$theme_options['header-menu1-submenu-spacing'] = $theme_options['primary-submenu-spacing'];
}
// Primary Menu - Mega Menu.
if ( isset( $theme_options['primary-header-megamenu-heading-color'] ) ) {
$theme_options['header-menu1-header-megamenu-heading-color'] = $theme_options['primary-header-megamenu-heading-color'];
}
if ( isset( $theme_options['primary-header-megamenu-heading-h-color'] ) ) {
$theme_options['header-menu1-header-megamenu-heading-h-color'] = $theme_options['primary-header-megamenu-heading-h-color'];
}
if ( isset( $theme_options['primary-header-megamenu-heading-font-size'] ) ) {
$theme_options['header-menu1-megamenu-heading-font-size'] = $theme_options['primary-header-megamenu-heading-font-size'];
}
if ( isset( $theme_options['primary-header-megamenu-heading-font-weight'] ) ) {
$theme_options['header-menu1-megamenu-heading-font-weight'] = $theme_options['primary-header-megamenu-heading-font-weight'];
}
if ( isset( $theme_options['primary-header-megamenu-heading-line-height'] ) ) {
$theme_options['header-menu1-megamenu-heading-line-height'] = $theme_options['primary-header-megamenu-heading-line-height'];
}
if ( isset( $theme_options['primary-header-megamenu-heading-font-family'] ) ) {
$theme_options['header-menu1-megamenu-heading-font-family'] = $theme_options['primary-header-megamenu-heading-font-family'];
}
if ( isset( $theme_options['primary-header-megamenu-heading-text-transform'] ) ) {
$theme_options['header-menu1-megamenu-heading-text-transform'] = $theme_options['primary-header-megamenu-heading-text-transform'];
}
if ( isset( $theme_options['primary-header-megamenu-heading-space'] ) ) {
$theme_options['header-menu1-megamenu-heading-space'] = $theme_options['primary-header-megamenu-heading-space'];
}
/**
* Primary Menu - Mobile.
*/
if ( isset( $theme_options['header-main-menu-label'] ) ) {
$theme_options['mobile-header-menu-label'] = $theme_options['header-main-menu-label'];
}
if ( isset( $theme_options['mobile-header-toggle-btn-style-color'] ) ) {
$theme_options['mobile-header-toggle-btn-color'] = $theme_options['mobile-header-toggle-btn-style-color'];
$theme_options['mobile-header-toggle-border-color'] = $theme_options['mobile-header-toggle-btn-style-color'];
}
if ( isset( $theme_options['mobile-header-toggle-btn-border-radius'] ) ) {
$theme_options['mobile-header-toggle-border-radius'] = $theme_options['mobile-header-toggle-btn-border-radius'];
}
return array(
'theme_options' => $theme_options,
'used_elements' => $used_elements,
'widget_options' => $widget_options,
);
}
/**
* Header Footer builder - Migration of Sticky Header.
*
* @since 3.0.0
* @param array $theme_options Theme options.
* @param array $used_elements Used Elements array.
* @param array $widget_options Widget options.
* @return array
*/
function astra_sticky_header_builder_migration( $theme_options, $used_elements, $widget_options ) {
// Menu.
$is_menu_in_primary = false;
$is_menu_in_above = false;
$is_menu_in_below = false;
if ( isset( $theme_options['header-desktop-items']['primary'] ) ) {
foreach ( $theme_options['header-desktop-items']['primary'] as $zone ) {
if ( false !== array_search( 'menu-1', $zone ) ) {
$is_menu_in_primary = true;
}
}
}
if ( isset( $theme_options['header-desktop-items']['above'] ) ) {
foreach ( $theme_options['header-desktop-items']['above'] as $zone ) {
if ( false !== array_search( 'menu-1', $zone ) ) {
$is_menu_in_above = true;
}
}
}
if ( isset( $theme_options['header-desktop-items']['below'] ) ) {
foreach ( $theme_options['header-desktop-items']['below'] as $zone ) {
if ( false !== array_search( 'menu-1', $zone ) ) {
$is_menu_in_below = true;
}
}
}
if ( $is_menu_in_primary ) {
// Menu.
// Normal.
if ( isset( $theme_options['sticky-header-menu-color-responsive'] ) ) {
$theme_options['sticky-header-menu1-color-responsive'] = $theme_options['sticky-header-menu-color-responsive'];
}
if ( isset( $theme_options['sticky-header-menu-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu1-bg-obj-responsive'] = $theme_options['sticky-header-menu-bg-color-responsive'];
}
// Hover.
if ( isset( $theme_options['sticky-header-menu-h-color-responsive'] ) ) {
$theme_options['sticky-header-menu1-h-color-responsive'] = $theme_options['sticky-header-menu-h-color-responsive'];
}
if ( isset( $theme_options['sticky-header-menu-h-a-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu1-h-bg-color-responsive'] = $theme_options['sticky-header-menu-h-a-bg-color-responsive'];
}
// Active.
if ( isset( $theme_options['sticky-header-menu-h-color-responsive'] ) ) {
$theme_options['sticky-header-menu1-a-color-responsive'] = $theme_options['sticky-header-menu-h-color-responsive'];
}
if ( isset( $theme_options['sticky-header-menu-h-a-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu1-a-bg-color-responsive'] = $theme_options['sticky-header-menu-h-a-bg-color-responsive'];
}
// Submenu.
// Normal.
if ( isset( $theme_options['sticky-header-submenu-color-responsive'] ) ) {
$theme_options['sticky-header-menu1-submenu-color-responsive'] = $theme_options['sticky-header-submenu-color-responsive'];
}
if ( isset( $theme_options['sticky-header-submenu-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu1-submenu-bg-color-responsive'] = $theme_options['sticky-header-submenu-bg-color-responsive'];
}
// Hover.
if ( isset( $theme_options['sticky-header-submenu-h-color-responsive'] ) ) {
$theme_options['sticky-header-menu1-submenu-h-color-responsive'] = $theme_options['sticky-header-submenu-h-color-responsive'];
}
if ( isset( $theme_options['sticky-header-submenu-h-a-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu1-submenu-h-bg-color-responsive'] = $theme_options['sticky-header-submenu-h-a-bg-color-responsive'];
}
// Active.
if ( isset( $theme_options['sticky-header-submenu-h-color-responsive'] ) ) {
$theme_options['sticky-header-menu1-submenu-a-color-responsive'] = $theme_options['sticky-header-submenu-h-color-responsive'];
}
if ( isset( $theme_options['sticky-header-submenu-h-a-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu1-submenu-a-bg-color-responsive'] = $theme_options['sticky-header-submenu-h-a-bg-color-responsive'];
}
// Mega menu.
// Normal.
if ( isset( $theme_options['sticky-primary-header-megamenu-heading-color'] ) ) {
$theme_options['sticky-header-menu1-header-megamenu-heading-color'] = $theme_options['sticky-primary-header-megamenu-heading-color'];
}
// Hover.
if ( isset( $theme_options['sticky-primary-header-megamenu-heading-h-color'] ) ) {
$theme_options['sticky-header-menu1-header-megamenu-heading-h-color'] = $theme_options['sticky-primary-header-megamenu-heading-h-color'];
}
}
if ( $is_menu_in_above ) {
// Menu.
// Normal.
if ( isset( $theme_options['sticky-above-header-menu-color-responsive'] ) ) {
$theme_options['sticky-header-menu3-color-responsive'] = $theme_options['sticky-above-header-menu-color-responsive'];
}
if ( isset( $theme_options['sticky-above-header-menu-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu3-bg-obj-responsive'] = $theme_options['sticky-above-header-menu-bg-color-responsive'];
}
// Hover.
if ( isset( $theme_options['sticky-above-header-menu-h-color-responsive'] ) ) {
$theme_options['sticky-header-menu3-h-color-responsive'] = $theme_options['sticky-above-header-menu-h-color-responsive'];
}
if ( isset( $theme_options['sticky-above-header-menu-h-a-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu3-h-bg-color-responsive'] = $theme_options['sticky-above-header-menu-h-a-bg-color-responsive'];
}
// Active.
if ( isset( $theme_options['sticky-above-header-menu-h-color-responsive'] ) ) {
$theme_options['sticky-header-menu3-a-color-responsive'] = $theme_options['sticky-above-header-menu-h-color-responsive'];
}
if ( isset( $theme_options['sticky-above-header-menu-h-a-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu3-a-bg-color-responsive'] = $theme_options['sticky-above-header-menu-h-a-bg-color-responsive'];
}
// Submenu.
// Normal.
if ( isset( $theme_options['sticky-above-header-submenu-color-responsive'] ) ) {
$theme_options['sticky-header-menu3-submenu-color-responsive'] = $theme_options['sticky-above-header-submenu-color-responsive'];
}
if ( isset( $theme_options['sticky-above-header-submenu-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu3-submenu-bg-obj-responsive'] = $theme_options['sticky-above-header-submenu-bg-color-responsive'];
}
// Hover.
if ( isset( $theme_options['sticky-above-header-submenu-h-color-responsive'] ) ) {
$theme_options['sticky-header-menu3-submenu-h-color-responsive'] = $theme_options['sticky-above-header-submenu-h-color-responsive'];
}
if ( isset( $theme_options['sticky-above-header-submenu-h-a-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu3-submenu-h-bg-color-responsive'] = $theme_options['sticky-above-header-submenu-h-a-bg-color-responsive'];
}
// Active.
if ( isset( $theme_options['sticky-above-header-submenu-h-color-responsive'] ) ) {
$theme_options['sticky-header-menu3-submenu-a-color-responsive'] = $theme_options['sticky-above-header-submenu-h-color-responsive'];
}
if ( isset( $theme_options['sticky-above-header-submenu-h-a-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu3-submenu-a-bg-color-responsive'] = $theme_options['sticky-above-header-submenu-h-a-bg-color-responsive'];
}
// Mega menu.
// Normal.
if ( isset( $theme_options['sticky-above-header-megamenu-heading-color'] ) ) {
$theme_options['sticky-header-menu3-header-megamenu-heading-color'] = $theme_options['sticky-above-header-megamenu-heading-color'];
}
// Hover.
if ( isset( $theme_options['sticky-above-header-megamenu-heading-h-color'] ) ) {
$theme_options['sticky-header-menu3-header-megamenu-heading-h-color'] = $theme_options['sticky-above-header-megamenu-heading-h-color'];
}
}
if ( $is_menu_in_below ) {
// Menu.
// Normal.
if ( isset( $theme_options['sticky-below-header-menu-color-responsive'] ) ) {
$theme_options['sticky-header-menu2-color-responsive'] = $theme_options['sticky-below-header-menu-color-responsive'];
}
if ( isset( $theme_options['sticky-below-header-menu-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu2-bg-obj-responsive'] = $theme_options['sticky-below-header-menu-bg-color-responsive'];
}
// Hover.
if ( isset( $theme_options['sticky-below-header-menu-h-color-responsive'] ) ) {
$theme_options['sticky-header-menu2-h-color-responsive'] = $theme_options['sticky-below-header-menu-h-color-responsive'];
}
if ( isset( $theme_options['sticky-below-header-menu-h-a-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu2-h-bg-color-responsive'] = $theme_options['sticky-below-header-menu-h-a-bg-color-responsive'];
}
// Active.
if ( isset( $theme_options['sticky-below-header-menu-h-color-responsive'] ) ) {
$theme_options['sticky-header-menu2-a-color-responsive'] = $theme_options['sticky-below-header-menu-h-color-responsive'];
}
if ( isset( $theme_options['sticky-below-header-menu-h-a-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu2-a-bg-color-responsive'] = $theme_options['sticky-below-header-menu-h-a-bg-color-responsive'];
}
// Submenu.
// Normal.
if ( isset( $theme_options['sticky-below-header-submenu-color-responsive'] ) ) {
$theme_options['sticky-header-menu2-submenu-color-responsive'] = $theme_options['sticky-below-header-submenu-color-responsive'];
}
if ( isset( $theme_options['sticky-below-header-submenu-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu2-submenu-bg-obj-responsive'] = $theme_options['sticky-below-header-submenu-bg-color-responsive'];
}
// Hover.
if ( isset( $theme_options['sticky-below-header-submenu-h-color-responsive'] ) ) {
$theme_options['sticky-header-menu2-submenu-h-color-responsive'] = $theme_options['sticky-below-header-submenu-h-color-responsive'];
}
if ( isset( $theme_options['sticky-below-header-submenu-h-a-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu2-submenu-h-bg-color-responsive'] = $theme_options['sticky-below-header-submenu-h-a-bg-color-responsive'];
}
// Active.
if ( isset( $theme_options['sticky-below-header-submenu-h-color-responsive'] ) ) {
$theme_options['sticky-header-menu2-submenu-a-color-responsive'] = $theme_options['sticky-below-header-submenu-h-color-responsive'];
}
if ( isset( $theme_options['sticky-below-header-submenu-h-a-bg-color-responsive'] ) ) {
$theme_options['sticky-header-menu2-submenu-a-bg-color-responsive'] = $theme_options['sticky-below-header-submenu-h-a-bg-color-responsive'];
}
// Mega menu.
// Normal.
if ( isset( $theme_options['sticky-below-header-megamenu-heading-color'] ) ) {
$theme_options['sticky-header-menu2-header-megamenu-heading-color'] = $theme_options['sticky-below-header-megamenu-heading-color'];
}
// Hover.
if ( isset( $theme_options['sticky-below-header-megamenu-heading-h-color'] ) ) {
$theme_options['sticky-header-menu2-header-megamenu-heading-h-color'] = $theme_options['sticky-below-header-megamenu-heading-h-color'];
}
}
// Sticky Site Title.
// Normal.
if ( isset( $theme_options['sticky-header-color-site-title-responsive']['desktop'] ) ) {
$theme_options['sticky-header-builder-site-title-color'] = $theme_options['sticky-header-color-site-title-responsive']['desktop'];
}
// Hover.
if ( isset( $theme_options['sticky-header-color-h-site-title-responsive']['desktop'] ) ) {
$theme_options['sticky-header-builder-site-title-h-color'] = $theme_options['sticky-header-color-h-site-title-responsive']['desktop'];
}
// Sticky Site Tagline.
if ( isset( $theme_options['sticky-header-color-site-tagline-responsive']['desktop'] ) ) {
$theme_options['sticky-header-builder-site-tagline-color'] = $theme_options['sticky-header-color-site-tagline-responsive']['desktop'];
}
// Sticky Above/Below Header HTML.
$is_html_in_above = false;
$is_html_in_below = false;
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
foreach ( $theme_options['header-desktop-items']['above'] as $zone ) {
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( false !== array_search( 'html-3', $zone ) ) {
$is_html_in_above = true;
}
}
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
foreach ( $theme_options['header-desktop-items']['below'] as $zone ) {
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( false !== array_search( 'html-2', $zone ) ) {
$is_html_in_below = true;
}
}
if ( $is_html_in_above ) {
if ( isset( $theme_options['sticky-above-header-content-section-text-color-responsive']['desktop'] ) ) {
$theme_options['sticky-header-html-3color'] = $theme_options['sticky-above-header-content-section-text-color-responsive']['desktop'];
}
}
if ( $is_html_in_below ) {
if ( isset( $theme_options['sticky-below-header-content-section-text-color-responsive']['desktop'] ) ) {
$theme_options['sticky-header-html-2color'] = $theme_options['sticky-below-header-content-section-text-color-responsive']['desktop'];
}
}
// Sticky Above/Below Header Search.
$is_search_in_above = false;
$is_search_in_below = false;
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
foreach ( $theme_options['header-desktop-items']['above'] as $zone ) {
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( false !== array_search( 'search', $zone ) ) {
$is_search_in_above = true;
}
}
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
foreach ( $theme_options['header-desktop-items']['below'] as $zone ) {
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( false !== array_search( 'search', $zone ) ) {
$is_search_in_below = true;
}
}
if ( $is_search_in_above ) {
if ( isset( $theme_options['sticky-above-header-content-section-link-color-responsive']['desktop'] ) ) {
$theme_options['sticky-header-search-icon-color'] = $theme_options['sticky-above-header-content-section-link-color-responsive']['desktop'];
}
}
if ( $is_search_in_below ) {
if ( isset( $theme_options['sticky-below-header-content-section-link-color-responsive']['desktop'] ) ) {
$theme_options['sticky-header-search-icon-color'] = $theme_options['sticky-below-header-content-section-link-color-responsive']['desktop'];
}
}
// Sticky Above/Below Header Widget.
$is_widget_in_above = false;
$is_widget_in_below = false;
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
foreach ( $theme_options['header-desktop-items']['above'] as $zone ) {
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( false !== array_search( 'widget-3', $zone ) ) {
$is_widget_in_above = true;
}
}
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
foreach ( $theme_options['header-desktop-items']['below'] as $zone ) {
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( false !== array_search( 'widget-2', $zone ) ) {
$is_widget_in_below = true;
}
}
if ( $is_widget_in_above ) {
if ( isset( $theme_options['sticky-above-header-content-section-text-color-responsive']['desktop'] ) ) {
$theme_options['sticky-header-widget-3-title-color'] = $theme_options['sticky-above-header-content-section-text-color-responsive']['desktop'];
}
if ( isset( $theme_options['sticky-above-header-content-section-text-color-responsive']['desktop'] ) ) {
$theme_options['sticky-header-widget-3-color'] = $theme_options['sticky-above-header-content-section-text-color-responsive']['desktop'];
}
if ( isset( $theme_options['sticky-above-header-content-section-link-color-responsive']['desktop'] ) ) {
$theme_options['sticky-header-widget-3-link-color'] = $theme_options['sticky-above-header-content-section-link-color-responsive']['desktop'];
}
if ( isset( $theme_options['sticky-above-header-content-section-link-h-color-responsive']['desktop'] ) ) {
$theme_options['sticky-header-widget-3-link-h-color'] = $theme_options['sticky-above-header-content-section-link-h-color-responsive']['desktop'];
}
}
if ( $is_widget_in_below ) {
if ( isset( $theme_options['sticky-below-header-content-section-text-color-responsive']['desktop'] ) ) {
$theme_options['sticky-header-widget-2-title-color'] = $theme_options['sticky-below-header-content-section-text-color-responsive']['desktop'];
}
if ( isset( $theme_options['sticky-below-header-content-section-text-color-responsive']['desktop'] ) ) {
$theme_options['sticky-header-widget-2-color'] = $theme_options['sticky-below-header-content-section-text-color-responsive']['desktop'];
}
if ( isset( $theme_options['sticky-below-header-content-section-link-color-responsive']['desktop'] ) ) {
$theme_options['sticky-header-widget-2-link-color'] = $theme_options['sticky-below-header-content-section-link-color-responsive']['desktop'];
}
if ( isset( $theme_options['sticky-below-header-content-section-link-h-color-responsive']['desktop'] ) ) {
$theme_options['sticky-header-widget-2-link-h-color'] = $theme_options['sticky-below-header-content-section-link-h-color-responsive']['desktop'];
}
}
return array(
'theme_options' => $theme_options,
'used_elements' => $used_elements,
'widget_options' => $widget_options,
);
}
PK QmZG9 9 8 theme-update/class-astra-theme-wp-background-process.phpnu [ astra_responsive_font( $heading_h4_font_size, 'desktop' ),
'line-height' => esc_attr( $headings_line_height ),
);
$h5_properties = array(
'font-size' => astra_responsive_font( $heading_h5_font_size, 'desktop' ),
'line-height' => esc_attr( $headings_line_height ),
);
$h6_properties = array(
'font-size' => astra_responsive_font( $heading_h6_font_size, 'desktop' ),
'line-height' => esc_attr( $headings_line_height ),
);
if ( astra_has_gcp_typo_preset_compatibility() ) {
$h4_font_properties = array(
'font-weight' => astra_get_css_value( $h4_font_weight, 'font' ),
'font-family' => astra_get_css_value( $h4_font_family, 'font' ),
'text-transform' => esc_attr( $h4_text_transform ),
'line-height' => esc_attr( $h4_line_height ),
'text-decoration' => esc_attr( $h4_text_decoration ),
'letter-spacing' => esc_attr( $h4_letter_spacing ),
);
$h4_properties = array_merge( $h4_properties, $h4_font_properties );
$h5_font_properties = array(
'font-weight' => astra_get_css_value( $h5_font_weight, 'font' ),
'font-family' => astra_get_css_value( $h5_font_family, 'font' ),
'text-transform' => esc_attr( $h5_text_transform ),
'line-height' => esc_attr( $h5_line_height ),
'text-decoration' => esc_attr( $h5_text_decoration ),
'letter-spacing' => esc_attr( $h5_letter_spacing ),
);
$h5_properties = array_merge( $h5_properties, $h5_font_properties );
$h6_font_properties = array(
'font-weight' => astra_get_css_value( $h6_font_weight, 'font' ),
'font-family' => astra_get_css_value( $h6_font_family, 'font' ),
'text-transform' => esc_attr( $h6_text_transform ),
'line-height' => esc_attr( $h6_line_height ),
'text-decoration' => esc_attr( $h6_text_decoration ),
'letter-spacing' => esc_attr( $h6_letter_spacing ),
);
$h6_properties = array_merge( $h6_properties, $h6_font_properties );
}
$link_selector = ( true === $update_customizer_strctural_defaults ) ? 'a' : 'a, .page-title';
$transparent_search_box_bg_color = astra_get_option( 'transparent-header-search-box-background-color', '#fff' );
$article_space = self::astra_4_6_0_compatibility() ? '2.5em' : '3em';
$color_palette_reorganize = self::astra_4_8_9_compatibility();
$css_output = array(
':root' => array(
'--ast-post-nav-space' => 0, // Moved from inc/dynamic-css/single-post.php for the fix of post-navigation issue for the old users. @since 4.6.13
'--ast-container-default-xlg-padding' => ( true === $update_customizer_strctural_defaults ) ? $article_space : '6.67em',
'--ast-container-default-lg-padding' => ( true === $update_customizer_strctural_defaults ) ? $article_space : '5.67em',
'--ast-container-default-slg-padding' => ( true === $update_customizer_strctural_defaults ) ? '2em' : '4.34em',
'--ast-container-default-md-padding' => ( true === $update_customizer_strctural_defaults ) ? $article_space : '3.34em',
'--ast-container-default-sm-padding' => ( true === $update_customizer_strctural_defaults ) ? $article_space : '6.67em',
'--ast-container-default-xs-padding' => ( true === $update_customizer_strctural_defaults ) ? '2.4em' : '2.4em',
'--ast-container-default-xxs-padding' => ( true === $update_customizer_strctural_defaults ) ? '1.8em' : '1.4em',
'--ast-code-block-background' => ( true === self::astra_check_default_color_typo() ) ? '#ECEFF3' : '#EEEEEE',
'--ast-comment-inputs-background' => ( true === self::astra_check_default_color_typo() ) ? '#F9FAFB' : '#FAFAFA',
'--ast-normal-container-width' => $site_content_width . 'px',
'--ast-narrow-container-width' => $narrow_container_max_width . 'px',
'--ast-blog-title-font-weight' => self::astra_4_6_0_compatibility() ? '600' : 'normal',
'--ast-blog-meta-weight' => self::astra_4_6_0_compatibility() ? '600' : 'inherit',
'--ast-global-color-primary' => $color_palette_reorganize ? 'var(--ast-global-color-4)' : 'var(--ast-global-color-5)',
'--ast-global-color-secondary' => $color_palette_reorganize ? 'var(--ast-global-color-5)' : 'var(--ast-global-color-4)',
'--ast-global-color-alternate-background' => $color_palette_reorganize ? 'var(--ast-global-color-6)' : 'var(--ast-global-color-7)',
'--ast-global-color-subtle-background' => $color_palette_reorganize ? 'var(--ast-global-color-7)' : 'var(--ast-global-color-6)',
),
// HTML.
'html' => array(
'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 6.25, '%' ),
),
$link_selector => array(
'color' => esc_attr( $link_color ),
),
'a:hover, a:focus' => array(
'color' => esc_attr( $link_hover_color ),
),
'body, button, input, select, textarea, .ast-button, .ast-custom-button' => 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' => ! empty( $body_line_height ) ? 'var(--ast-body-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 ),
),
'blockquote' => array(
'border-color' => astra_hex_to_rgba( $link_color, 0.15 ),
),
'p, .entry-content p' => array(
'margin-bottom' => astra_get_css_value( $para_margin_bottom, 'em' ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h1, .entry-content h1, .entry-content h1 a, h2, .entry-content h2, .entry-content h2 a, h3, .entry-content h3, .entry-content h3 a, h4, .entry-content h4, .entry-content h4 a, h5, .entry-content h5, .entry-content h5 a, h6, .entry-content h6, .entry-content h6 a, .site-title, .site-title a',
'h1, .entry-content h1, h2, .entry-content h2, h3, .entry-content h3, h4, .entry-content h4, h5, .entry-content h5, h6, .entry-content h6, .site-title, .site-title a'
) => astra_get_font_array_css( astra_get_option( 'headings-font-family' ), astra_get_option( 'headings-font-weight' ), array(), 'headings-font-extras' ),
'.ast-site-identity .site-title a' => array(
'color' => esc_attr( $title_color ),
),
'.ast-site-identity .site-title a:hover' => array(
'color' => esc_attr( $title_hover_color ),
),
'.ast-site-identity .site-description' => array(
'color' => esc_attr( $tagline_color ),
),
'.site-title' => array(
'font-size' => astra_responsive_font( $site_title_font_size, 'desktop' ),
'display' => esc_attr( $desktop_title_visibility ),
),
is_customize_preview() ? '.ast-sg-logo-section .custom-logo-link img, header .custom-logo-link img' : 'header .custom-logo-link img' => array(
'max-width' => astra_get_css_value( $header_logo_width['desktop'], 'px' ),
'width' => astra_get_css_value( $header_logo_width['desktop'], 'px' ),
),
'.astra-logo-svg' => array(
'width' => astra_get_css_value( $header_logo_width['desktop'], 'px' ),
),
'.site-header .site-description' => array(
'font-size' => astra_responsive_font( $site_tagline_font_size, 'desktop' ),
'display' => esc_attr( $desktop_tagline_visibility ),
),
'.entry-title' => array(
'font-size' => astra_responsive_font( $archive_post_title_font_size, 'desktop' ),
),
'.ast-blog-single-element.ast-taxonomy-container a' => array(
'font-size' => astra_responsive_font( $archive_post_tax_font_size, 'desktop' ),
),
'.ast-blog-meta-container' => array(
'font-size' => astra_responsive_font( $archive_post_meta_font_size, 'desktop' ),
),
'blog-layout-5' === $blog_layout ? '.archive .ast-article-post, .blog .ast-article-post, .archive .ast-article-post:hover, .blog .ast-article-post:hover' : '.archive .ast-article-post .ast-article-inner, .blog .ast-article-post .ast-article-inner, .archive .ast-article-post .ast-article-inner:hover, .blog .ast-article-post .ast-article-inner:hover' => array(
'border-top-left-radius' => astra_responsive_spacing( $archive_cards_radius, 'top', 'desktop' ),
'border-top-right-radius' => astra_responsive_spacing( $archive_cards_radius, 'right', 'desktop' ),
'border-bottom-right-radius' => astra_responsive_spacing( $archive_cards_radius, 'bottom', 'desktop' ),
'border-bottom-left-radius' => astra_responsive_spacing( $archive_cards_radius, 'left', 'desktop' ),
'overflow' => 'hidden',
),
// Conditionally select the css selectors with or without anchors.
self::conditional_headings_css_selectors(
'h1, .entry-content h1, .entry-content h1 a',
'h1, .entry-content h1'
) => array(
'font-size' => astra_responsive_font( $heading_h1_font_size, 'desktop' ),
'font-weight' => astra_get_css_value( $h1_font_weight, 'font' ),
'font-family' => astra_get_css_value( $h1_font_family, '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 ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h2, .entry-content h2, .entry-content h2 a',
'h2, .entry-content h2'
) => array(
'font-size' => astra_responsive_font( $heading_h2_font_size, 'desktop' ),
'font-weight' => astra_get_css_value( $h2_font_weight, 'font' ),
'font-family' => astra_get_css_value( $h2_font_family, '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 ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h3, .entry-content h3, .entry-content h3 a',
'h3, .entry-content h3'
) => array(
'font-size' => astra_responsive_font( $heading_h3_font_size, 'desktop' ),
'font-weight' => astra_get_css_value( $h3_font_weight, 'font' ),
'font-family' => astra_get_css_value( $h3_font_family, '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 ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h4, .entry-content h4, .entry-content h4 a',
'h4, .entry-content h4'
) => $h4_properties,
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h5, .entry-content h5, .entry-content h5 a',
'h5, .entry-content h5'
) => $h5_properties,
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h6, .entry-content h6, .entry-content h6 a',
'h6, .entry-content h6'
) => $h6_properties,
// Global CSS.
'::selection' => array(
'background-color' => esc_attr( $theme_color ),
'color' => esc_attr( $selection_text_color ),
),
// Conditionally select selectors with annchors or withour anchors for text color.
self::conditional_headings_css_selectors(
'body, h1, .entry-title a, .entry-content h1, .entry-content h1 a, h2, .entry-content h2, .entry-content h2 a, h3, .entry-content h3, .entry-content h3 a, h4, .entry-content h4, .entry-content h4 a, h5, .entry-content h5, .entry-content h5 a, h6, .entry-content h6, .entry-content h6 a',
'body, h1, .entry-title a, .entry-content h1, h2, .entry-content h2, h3, .entry-content h3, h4, .entry-content h4, h5, .entry-content h5, h6, .entry-content h6'
) => array(
'color' => esc_attr( $text_color ),
),
// Typography.
'.tagcloud a:hover, .tagcloud a:focus, .tagcloud a.current-item' => array(
'color' => astra_get_foreground_color( $link_color ),
'border-color' => esc_attr( $link_color ),
'background-color' => esc_attr( $link_color ),
),
// Input tags.
'input:focus, input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, input[type="reset"]:focus, input[type="search"]:focus, textarea:focus' => array(
'border-color' => esc_attr( $link_color ),
),
'input[type="radio"]:checked, input[type=reset], input[type="checkbox"]:checked, input[type="checkbox"]:hover:checked, input[type="checkbox"]:focus:checked, input[type=range]::-webkit-slider-thumb' => array(
'border-color' => esc_attr( $link_color ),
'background-color' => esc_attr( $link_color ),
'box-shadow' => 'none',
),
// Small Footer.
'.site-footer a:hover + .post-count, .site-footer a:focus + .post-count' => array(
'background' => esc_attr( $link_color ),
'border-color' => esc_attr( $link_color ),
),
'.single .nav-links .nav-previous, .single .nav-links .nav-next' => array(
'color' => esc_attr( $link_color ),
),
// Blog Post Meta Typography.
'.entry-meta, .entry-meta *' => array(
'line-height' => '1.45',
'color' => esc_attr( $link_color ),
'font-weight' => self::astra_4_6_0_compatibility() && ! defined( 'ASTRA_EXT_VER' ) ? '600' : '',
),
'.entry-meta a:not(.ast-button):hover, .entry-meta a:not(.ast-button):hover *, .entry-meta a:not(.ast-button):focus, .entry-meta a:not(.ast-button):focus *, .page-links > .page-link, .page-links .page-link:hover, .post-navigation a:hover' => array(
'color' => esc_attr( $link_hover_color ),
),
// Blockquote Text Color.
'blockquote' => array(
'color' => astra_adjust_brightness( $text_color, 75, 'darken' ),
),
'#cat option, .secondary .calendar_wrap thead a, .secondary .calendar_wrap thead a:visited' => array(
'color' => esc_attr( $link_color ),
),
'.secondary .calendar_wrap #today, .ast-progress-val span' => array(
'background' => esc_attr( $link_color ),
),
'.secondary a:hover + .post-count, .secondary a:focus + .post-count' => array(
'background' => esc_attr( $link_color ),
'border-color' => esc_attr( $link_color ),
),
'.calendar_wrap #today > a' => array(
'color' => astra_get_foreground_color( $link_color ),
),
// Pagination.
'.page-links .page-link, .single .post-navigation a' => array(
'color' => esc_attr( self::astra_4_6_0_compatibility() ? $text_color : $link_color ),
),
// Menu Toggle Border Radius.
'.ast-header-break-point .main-header-bar .ast-button-wrap .menu-toggle' => array(
'border-radius' => ( '' !== $mobile_header_toggle_btn_border_radius ) ? esc_attr( $mobile_header_toggle_btn_border_radius ) . 'px' : '',
),
// Search.
'.ast-search-menu-icon .search-form button.search-submit' => array(
'padding' => '0 4px',
),
'.ast-search-menu-icon form.search-form' => array(
'padding-right' => '0',
),
'.ast-search-menu-icon.slide-search input.search-field' => array(
'width' => Astra_Builder_Helper::$is_header_footer_builder_active ? '0' : '',
),
'.ast-header-search .ast-search-menu-icon.ast-dropdown-active .search-form, .ast-header-search .ast-search-menu-icon.ast-dropdown-active .search-field:focus' => array(
'transition' => 'all 0.2s',
'border-color' => astra_get_option( 'site-accessibility-highlight-input-color' ),
),
'.search-form input.search-field:focus' => array(
'outline' => 'none', // Making highlight by border that's why making outline none.
),
);
if ( 'blog-layout-6' === $blog_layout ) {
$css_output['.ast-blog-layout-6-grid .ast-article-inner .post-thumb::after'] = array(
'content' => '""',
'background' => $archive_cards_overlay,
'position' => 'absolute',
'top' => '0',
'right' => '0',
'bottom' => '0',
'left' => '0',
);
}
if ( self::astra_4_4_0_compatibility() ) {
$css_output['.ast-search-menu-icon .search-form button.search-submit:focus, .ast-theme-transparent-header .ast-header-search .ast-dropdown-active .ast-icon, .ast-theme-transparent-header .ast-inline-search .search-field:focus .ast-icon'] = array(
'color' => 'var(--ast-global-color-1)',
);
$css_output['.ast-header-search .slide-search .search-form'] = array(
'border' => '2px solid var(--ast-global-color-0)',
);
// Reduced specificity so that it does not override customizer background color option.
$css_output['.ast-header-search .slide-search .search-field'] = array(
'background-color' => '#fff', // Referred by main.css.
);
}
/* This is a fix issue with logo height for normal and transparent logo so that they are the same */
if ( ! apply_filters( 'astra_site_svg_logo_equal_height', astra_get_option( 'astra-site-svg-logo-equal-height', true ) ) ) {
$css_output['.astra-logo-svg:not(.sticky-custom-logo .astra-logo-svg, .transparent-custom-logo .astra-logo-svg, .advanced-header-logo .astra-logo-svg)'] = array(
'height' => astra_get_css_value( ( ! empty( $header_logo_width['desktop-svg-height'] ) && ! is_customize_preview() ) ? $header_logo_width['desktop-svg-height'] : '', 'px' ),
);
}
/* Compatibility with cost calculator plugin range slider*/
if ( defined( 'CALC_VERSION' ) ) {
$css_output['.calc-range-slider input::-webkit-slider-runnable-track'] = array(
'height' => 'auto',
'box-shadow' => 'none',
'background' => 'transparent',
'border-radius' => 'none',
'border' => 'none',
);
$css_output['.calc-range-slider input::-moz-range-track'] = array(
'height' => 'auto',
'box-shadow' => 'none',
'background' => 'transparent',
'border-radius' => 'none',
'border' => 'none',
);
$css_output['.calc-range-slider input::-webkit-slider-thumb'] = array(
'margin-top' => 'auto',
);
}
if ( astra_has_global_color_format_support() ) {
$css_output['.ast-archive-title'] = array(
'color' => esc_attr( $heading_base_color ),
);
}
if ( ! $block_editor_legacy_setup && false === $update_customizer_strctural_defaults ) {
$css_output['.wp-block-latest-posts > li > a'] = array(
'color' => esc_attr( $heading_base_color ),
);
}
// Construct the selector string conditionally
$selectors = '.widget-title';
if ( ! self::astra_heading_inside_widget_font_size_comp() ) {
$selectors .= ', .widget .wp-block-heading';
}
// Default widget title color.
$css_output[ $selectors ] = array(
'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 1.428571429 ),
'color' => astra_has_global_color_format_support() ? esc_attr( $heading_base_color ) : esc_attr( $text_color ),
);
// Remove this condition after 2-3 updates of add-on.
if ( defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, '3.0.1', '>=' ) ) {
$css_output['.single .ast-author-details .author-title'] = array(
'color' => esc_attr( $link_hover_color ),
);
}
if ( 'no-sidebar' !== astra_page_layout() ) {
$css_output['#secondary, #secondary button, #secondary input, #secondary select, #secondary textarea'] = array(
'font-size' => astra_responsive_font( $body_font_size, 'desktop' ),
);
}
// Add underline to every link in content area.
$content_links_underline = astra_get_option( 'underline-content-links' );
if ( $content_links_underline ) {
$text_decoration_selector = class_exists( 'WooCommerce' ) ? '.ast-single-post .entry-content a, .ast-comment-content a:not(.ast-comment-edit-reply-wrap a), .woocommerce-js .woocommerce-product-details__short-description a' : '.ast-single-post .entry-content a, .ast-comment-content a:not(.ast-comment-edit-reply-wrap a)';
$css_output[ $text_decoration_selector ] = array(
'text-decoration' => 'underline',
);
$reset_underline_from_anchors = self::unset_builder_elements_underline();
$buttons_exclusion_selectors = $button_styling_improved ? '.ast-single-post .elementor-button-wrapper .elementor-button, .ast-single-post .entry-content .uagb-tab a, .ast-single-post .entry-content .uagb-ifb-cta a, .ast-single-post .entry-content .uabb-module-content a, .ast-single-post .entry-content .uagb-post-grid a, .ast-single-post .entry-content .uagb-timeline a, .ast-single-post .entry-content .uagb-toc__wrap a, .ast-single-post .entry-content .uagb-taxomony-box a, .ast-single-post .entry-content .woocommerce a, .entry-content .wp-block-latest-posts > li > a, .ast-single-post .entry-content .wp-block-file__button, li.ast-post-filter-single, .ast-single-post .ast-comment-content .comment-reply-link, .ast-single-post .ast-comment-content .comment-edit-link' : '.ast-single-post .wp-block-button .wp-block-button__link, .ast-single-post .elementor-button-wrapper .elementor-button, .ast-single-post .entry-content .uagb-tab a, .ast-single-post .entry-content .uagb-ifb-cta a, .ast-single-post .entry-content .wp-block-uagb-buttons a, .ast-single-post .entry-content .uabb-module-content a, .ast-single-post .entry-content .uagb-post-grid a, .ast-single-post .entry-content .uagb-timeline a, .ast-single-post .entry-content .uagb-toc__wrap a, .ast-single-post .entry-content .uagb-taxomony-box a, .ast-single-post .entry-content .woocommerce a, .entry-content .wp-block-latest-posts > li > a, .ast-single-post .entry-content .wp-block-file__button, li.ast-post-filter-single, .ast-single-post .wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link, .ast-single-post .ast-comment-content .comment-reply-link, .ast-single-post .ast-comment-content .comment-edit-link';
$excluding_anchor_selectors = $reset_underline_from_anchors ? $buttons_exclusion_selectors : '.ast-single-post .wp-block-button .wp-block-button__link, .ast-single-post .elementor-button-wrapper .elementor-button, li.ast-post-filter-single, .ast-single-post .wp-block-button.is-style-outline .wp-block-button__link, div.ast-custom-button, .ast-single-post .ast-comment-content .comment-reply-link, .ast-single-post .ast-comment-content .comment-edit-link';
if ( class_exists( 'WooCommerce' ) ) {
$excluding_anchor_selectors .= ', .entry-content [CLASS*="wc-block"] .wc-block-components-button, .entry-content [CLASS*="wc-block"] .wc-block-components-totals-coupon-link, .entry-content [CLASS*="wc-block"] .wc-block-components-product-name';
}
$excluding_anchor_selectors = apply_filters( 'astra_remove_underline_anchor_links', $excluding_anchor_selectors );
$css_output[ $excluding_anchor_selectors ] = array(
'text-decoration' => 'none',
);
}
// Accessibility options.
$enable_site_accessibility = astra_get_option( 'site-accessibility-toggle', false );
$html_selectors_focus_visible = '.ast-search-menu-icon.slide-search a:focus-visible:focus-visible, .astra-search-icon:focus-visible, #close:focus-visible, a:focus-visible, .ast-menu-toggle:focus-visible, .site .skip-link:focus-visible, .wp-block-loginout input:focus-visible, .wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper, .ast-header-navigation-arrow:focus-visible, .woocommerce .wc-proceed-to-checkout > .checkout-button:focus-visible, .woocommerce .woocommerce-MyAccount-navigation ul li a:focus-visible, .ast-orders-table__row .ast-orders-table__cell:focus-visible, .woocommerce .woocommerce-order-details .order-again > .button:focus-visible, .woocommerce .woocommerce-message a.button.wc-forward:focus-visible, .woocommerce #minus_qty:focus-visible, .woocommerce #plus_qty:focus-visible, a#ast-apply-coupon:focus-visible, .woocommerce .woocommerce-info a:focus-visible, .woocommerce .astra-shop-summary-wrap a:focus-visible, .woocommerce a.wc-forward:focus-visible, #ast-apply-coupon:focus-visible, .woocommerce-js .woocommerce-mini-cart-item a.remove:focus-visible, #close:focus-visible, .button.search-submit:focus-visible, #search_submit:focus, .normal-search:focus-visible, .ast-header-account-wrap:focus-visible, .woocommerce .ast-on-card-button.ast-quick-view-trigger:focus';
$html_selectors_focus_only_inputs = 'input:focus, input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, input[type="reset"]:focus, input[type="search"]:focus, input[type="number"]:focus, textarea:focus, .wp-block-search__input:focus, [data-section="section-header-mobile-trigger"] .ast-button-wrap .ast-mobile-menu-trigger-minimal:focus, .ast-mobile-popup-drawer.active .menu-toggle-close:focus, .woocommerce-ordering select.orderby:focus, #ast-scroll-top:focus, #coupon_code:focus, .woocommerce-page #comment:focus, .woocommerce #reviews #respond input#submit:focus, .woocommerce a.add_to_cart_button:focus, .woocommerce .button.single_add_to_cart_button:focus, .woocommerce .woocommerce-cart-form button:focus, .woocommerce .woocommerce-cart-form__cart-item .quantity .qty:focus, .woocommerce .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper .woocommerce-input-wrapper > .input-text:focus, .woocommerce #order_comments:focus, .woocommerce #place_order:focus, .woocommerce .woocommerce-address-fields .woocommerce-address-fields__field-wrapper .woocommerce-input-wrapper > .input-text:focus, .woocommerce .woocommerce-MyAccount-content form button:focus, .woocommerce .woocommerce-MyAccount-content .woocommerce-EditAccountForm .woocommerce-form-row .woocommerce-Input.input-text:focus, .woocommerce .ast-woocommerce-container .woocommerce-pagination ul.page-numbers li a:focus, body #content .woocommerce form .form-row .select2-container--default .select2-selection--single:focus, #ast-coupon-code:focus, .woocommerce.woocommerce-js .quantity input[type=number]:focus, .woocommerce-js .woocommerce-mini-cart-item .quantity input[type=number]:focus, .woocommerce p#ast-coupon-trigger:focus';
if ( $enable_site_accessibility ) {
$outline_style = astra_get_option( 'site-accessibility-highlight-type' );
$outline_color = astra_get_option( 'site-accessibility-highlight-color' );
$outline_input_style = astra_get_option( 'site-accessibility-highlight-input-type' );
// If the outline input style is set to 'disable', change it to 'unset' css value.
if ( $outline_input_style === 'disable' ) {
$outline_input_style = 'unset';
}
$outline_input_color = astra_get_option( 'site-accessibility-highlight-input-color' );
$css_output[ $html_selectors_focus_visible ] = array(
'outline-style' => $outline_style ? $outline_style : 'inherit',
'outline-color' => $outline_color ? $outline_color : 'inherit',
'outline-width' => 'thin',
'border-color' => astra_get_option( 'site-accessibility-highlight-input-color' ),
);
if ( 'unset' !== $outline_input_style ) {
$css_output[ $html_selectors_focus_only_inputs ] = array(
'border-style' => $outline_input_style ? $outline_input_style : 'inherit',
'border-color' => $outline_input_color ? $outline_input_color : 'inherit',
'border-width' => 'thin',
'outline-color' => astra_get_option( 'site-accessibility-highlight-input-color' ),
);
} else {
$css_output[ $html_selectors_focus_only_inputs ] = array(
'border-style' => $outline_style ? $outline_style : 'inherit',
'border-color' => $outline_color ? $outline_color : 'inherit',
'border-width' => 'thin',
'outline-color' => astra_get_option( 'site-accessibility-highlight-input-color' ),
);
}
$css_output['input'] = array(
'outline' => 'none',
);
if ( class_exists( 'WooCommerce' ) ) {
$css_output['.woocommerce-js input[type=text]:focus, .woocommerce-js input[type=email]:focus, .woocommerce-js textarea:focus, input[type=number]:focus, .comments-area textarea#comment:focus, .comments-area textarea#comment:active, .comments-area .ast-comment-formwrap input[type="text"]:focus, .comments-area .ast-comment-formwrap input[type="text"]:active'] = array(
'outline-style' => $outline_input_style ? $outline_input_style : 'inherit',
'outline-color' => $outline_input_color ? $outline_input_color : 'inherit',
'outline-width' => 'thin',
'border-color' => astra_get_option( 'site-accessibility-highlight-input-color' ),
);
}
}
if ( false === $enable_site_accessibility ) {
$css_output[ $html_selectors_focus_only_inputs . ', ' . $html_selectors_focus_visible ] = array(
'outline-style' => 'none',
);
$css_output['.ast-header-search .ast-search-menu-icon.ast-dropdown-active .search-form, .ast-header-search .ast-search-menu-icon.ast-dropdown-active .search-field:focus'] = array(
'border-color' => 'var(--ast-global-color-0)',
);
}
if ( self::astra_4_4_0_compatibility() ) {
$css_output['.ast-search-menu-icon .search-form button.search-submit:focus, .ast-theme-transparent-header .ast-header-search .ast-dropdown-active .ast-icon, .ast-theme-transparent-header .ast-inline-search .search-field:focus .ast-icon'] = array(
'color' => 'var(--ast-global-color-1)',
);
if ( false === $enable_site_accessibility ) {
$css_output['.ast-header-search .slide-search .search-form'] = array(
'border' => '2px solid var(--ast-global-color-0)',
);
}
// Reduced specificity so that it does not override customizer background color option.
$css_output['.ast-header-search .slide-search .search-field'] = array(
'background-color' => '#fff', // Referred by main.css.
);
}
/**
* Loaded the following CSS conditionally because of following scenarios -
*
* 1. $text_color is applying to menu-link anchors as well though $link_color should apply over there.
* 2. $link_color applying in old header as hover color for menu-anchors.
*
* @since 3.0.0
*/
if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) {
// Header - Main Header CSS.
$css_output['.main-header-menu .menu-link, .ast-header-custom-item a'] = array(
'color' => esc_attr( $text_color ),
);
// Main - Menu Items.
$css_output['.main-header-menu .menu-item:hover > .menu-link, .main-header-menu .menu-item:hover > .ast-menu-toggle, .main-header-menu .ast-masthead-custom-menu-items a:hover, .main-header-menu .menu-item.focus > .menu-link, .main-header-menu .menu-item.focus > .ast-menu-toggle, .main-header-menu .current-menu-item > .menu-link, .main-header-menu .current-menu-ancestor > .menu-link, .main-header-menu .current-menu-item > .ast-menu-toggle, .main-header-menu .current-menu-ancestor > .ast-menu-toggle'] = array(
'color' => esc_attr( $link_color ),
);
$css_output['.header-main-layout-3 .ast-main-header-bar-alignment'] = array(
'margin-right' => 'auto',
);
if ( $is_site_rtl ) {
$css_output['.header-main-layout-2 .site-header-section-left .ast-site-identity'] = array(
'text-align' => 'right',
);
} else {
$css_output['.header-main-layout-2 .site-header-section-left .ast-site-identity'] = array(
'text-align' => 'left',
);
}
}
$page_header_logo = ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'advanced-headers' ) && Astra_Ext_Advanced_Headers_Loader::astra_advanced_headers_design_option( 'logo-url' ) ) ? true : false;
if ( astra_get_option( 'logo-title-inline' ) || is_customize_preview() ) {
$css_output['.ast-logo-title-inline .site-logo-img'] = array(
'padding-right' => '1em',
);
}
if ( get_theme_mod( 'custom_logo' )
|| astra_get_option( 'transparent-header-logo' )
|| astra_get_option( 'sticky-header-logo' )
|| $page_header_logo
|| is_customize_preview() ) {
$css_output['.site-logo-img img'] = array(
' transition' => 'all 0.2s linear',
);
if ( astra_get_option( 'header-logo-color' ) ) {
$css_output['.site-logo-img img'] = array(
'filter' => 'url(#ast-img-color-filter)',
' transition' => 'all 0.2s linear',
);
}
if ( astra_get_option( 'transparent-header-logo-color' ) ) {
$css_output['.site-logo-img .transparent-custom-logo img, .ast-theme-transparent-header .site-logo-img img'] = array(
'filter' => 'url(#ast-img-color-filter-2)',
);
}
}
$parse_css = '';
if ( $block_editor_legacy_setup ) {
$parse_css .= '
.ast-no-sidebar .entry-content .alignfull {
margin-left: calc( -50vw + 50%);
margin-right: calc( -50vw + 50%);
max-width: 100vw;
width: 100vw;
}
.ast-no-sidebar .entry-content .alignwide {
margin-left: calc(-41vw + 50%);
margin-right: calc(-41vw + 50%);
max-width: unset;
width: unset;
}
.ast-no-sidebar .entry-content .alignfull .alignfull, .ast-no-sidebar .entry-content .alignfull .alignwide, .ast-no-sidebar .entry-content .alignwide .alignfull, .ast-no-sidebar .entry-content .alignwide .alignwide,
.ast-no-sidebar .entry-content .wp-block-column .alignfull, .ast-no-sidebar .entry-content .wp-block-column .alignwide{
width: 100%;
margin-left: auto;
margin-right: auto;
}
.wp-block-gallery,
.blocks-gallery-grid {
margin: 0;
}
.wp-block-separator {
max-width: 100px;
}
.wp-block-separator.is-style-wide, .wp-block-separator.is-style-dots {
max-width: none;
}
.entry-content .has-2-columns .wp-block-column:first-child {
padding-right: 10px;
}
.entry-content .has-2-columns .wp-block-column:last-child {
padding-left: 10px;
}
@media (max-width: 782px) {
.entry-content .wp-block-columns .wp-block-column {
flex-basis: 100%;
}
.entry-content .has-2-columns .wp-block-column:first-child {
padding-right: 0;
}
.entry-content .has-2-columns .wp-block-column:last-child {
padding-left: 0;
}
}
body .entry-content .wp-block-latest-posts {
margin-left: 0;
}
body .entry-content .wp-block-latest-posts li {
list-style: none;
}
.ast-no-sidebar .ast-container .entry-content .wp-block-latest-posts {
margin-left: 0;
}
.ast-header-break-point .entry-content .alignwide {
margin-left: auto;
margin-right: auto;
}
.entry-content .blocks-gallery-item img {
margin-bottom: auto;
}
.wp-block-pullquote {
border-top: 4px solid #555d66;
border-bottom: 4px solid #555d66;
color: #40464d;
}
';
}
/* Parse CSS from array() */
$parse_css .= astra_parse_css( $css_output );
if ( defined( 'BORLABS_COOKIE_VERSION' ) ) {
$oembed_wrapper = array(
'body .ast-oembed-container > *' => array(
'position' => 'absolute',
'top' => '0',
'width' => '100%',
'height' => '100%',
( $is_site_rtl ? 'right' : 'left' ) => '0',
),
);
} else {
$oembed_wrapper = array(
'body .ast-oembed-container *' => array(
'position' => 'absolute',
'top' => '0',
'width' => '100%',
'height' => '100%',
( $is_site_rtl ? 'right' : 'left' ) => '0',
),
);
}
/**
* Special case handling for pocket casts embed url.
*
* @since 4.6.4
*/
$oembed_wrapper['body .wp-block-embed-pocket-casts .ast-oembed-container *'] = array(
'position' => 'unset',
);
$parse_css .= astra_parse_css( $oembed_wrapper );
if ( ! Astra_Builder_Helper::$is_header_footer_builder_active ) {
$old_header_mobile_toggle = array(
// toggle style
// Menu Toggle Minimal.
'.ast-header-break-point .ast-mobile-menu-buttons-minimal.menu-toggle' => array(
'background' => 'transparent',
'color' => esc_attr( $mobile_header_toggle_btn_style_color ),
),
// Menu Toggle Outline.
'.ast-header-break-point .ast-mobile-menu-buttons-outline.menu-toggle' => array(
'background' => 'transparent',
'border' => '1px solid ' . $mobile_header_toggle_btn_style_color,
'color' => esc_attr( $mobile_header_toggle_btn_style_color ),
),
// Menu Toggle Fill.
'.ast-header-break-point .ast-mobile-menu-buttons-fill.menu-toggle' => array(
'background' => esc_attr( $mobile_header_toggle_btn_style_color ),
'color' => $menu_btn_color,
),
);
$parse_css .= astra_parse_css( $old_header_mobile_toggle );
}
$parse_css .= astra_container_layout_css();
if ( 'no-sidebar' !== astra_page_layout() ) {
$parse_css .= Astra_Enqueue_Scripts::trim_css( self::load_sidebar_static_css() );
$parse_css .= self::astra_sticky_sidebar_css();
}
if ( self::astra_4_6_0_compatibility() ) {
// Forms default styling improvements.
$parse_css .= self::astra_default_forms_styling_dynamic_css();
}
if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
$parse_css .= astra_parse_css(
array(
'#ast-desktop-header' => array(
'display' => 'none',
),
),
'',
number_format( absint( astra_get_tablet_breakpoint() ) + 0.9, 1, '.', '' )
);
$parse_css .= astra_parse_css(
array(
'#ast-mobile-header' => array(
'display' => 'none',
),
),
astra_get_tablet_breakpoint( '', 1 )
);
}
// Comments CSS.
if ( ! Astra_Builder_Helper::apply_flex_based_css() ) {
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/comments.php'; // PHPCS:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
} else {
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/comments-flex.php'; // PHPCS:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
}
// Single post improvement.
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/single-post.php'; // PHPCS:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
$live_search_enabled = astra_get_option( 'live-search', false );
if ( ( true === Astra_Builder_Helper::$is_header_footer_builder_active && Astra_Builder_Helper::is_component_loaded( 'search', 'header' ) && $live_search_enabled ) || ( is_search() && true === astra_get_option( 'ast-search-live-search' ) ) ) {
// Live search CSS.
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/live-search.php'; // PHPCS:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
}
if ( Astra_Builder_Helper::is_component_loaded( 'woo-cart', 'header' ) || Astra_Builder_Helper::is_component_loaded( 'edd-cart', 'header' ) ) {
$parse_css .= Astra_Enqueue_Scripts::trim_css( self::load_cart_static_css() );
$parse_css .= astra_parse_css(
array(
'.astra-cart-drawer.active' => array(
'width' => '80%',
),
),
'',
astra_get_tablet_breakpoint()
);
$parse_css .= astra_parse_css(
array(
'.astra-cart-drawer.active' => array(
'width' => '100%',
),
),
'',
astra_get_mobile_breakpoint()
);
}
if ( ! Astra_Builder_Helper::$is_header_footer_builder_active ) {
$footer_css_output = array(
'.ast-small-footer' => array(
'color' => esc_attr( $footer_color ),
),
'.ast-small-footer > .ast-footer-overlay' => astra_get_background_obj( $footer_bg_obj ),
'.ast-small-footer a' => array(
'color' => esc_attr( $footer_link_color ),
),
'.ast-small-footer a:hover' => array(
'color' => esc_attr( $footer_link_h_color ),
),
// Advanced Footer colors/fonts.
'.footer-adv .footer-adv-overlay' => array(
'border-top-style' => 'solid',
'border-top-width' => astra_get_css_value( $footer_adv_border_width, 'px' ),
'border-top-color' => esc_attr( $footer_adv_border_color ),
),
'.footer-adv .widget-title,.footer-adv .widget-title a' => array(
'color' => esc_attr( $footer_adv_widget_title_color ),
),
'.footer-adv' => array(
'color' => esc_attr( $footer_adv_text_color ),
),
'.footer-adv a' => array(
'color' => esc_attr( $footer_adv_link_color ),
),
'.footer-adv .tagcloud a:hover, .footer-adv .tagcloud a.current-item' => array(
'border-color' => esc_attr( $footer_adv_link_color ),
'background-color' => esc_attr( $footer_adv_link_color ),
),
'.footer-adv a:hover, .footer-adv .no-widget-text a:hover, .footer-adv a:focus, .footer-adv .no-widget-text a:focus' => array(
'color' => esc_attr( $footer_adv_link_h_color ),
),
'.footer-adv .calendar_wrap #today, .footer-adv a:hover + .post-count' => array(
'background-color' => esc_attr( $footer_adv_link_color ),
),
'.footer-adv-overlay' => astra_get_background_obj( $footer_adv_bg_obj ),
);
$parse_css .= astra_parse_css( $footer_css_output );
}
// Paginaiton CSS.
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/pagination.php'; // PHPCS:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
// Related Posts Dynamic CSS.
// Navigation CSS.
if ( ! self::astra_4_6_0_compatibility() && is_single() ) {
/**
* CSS for post navigation design break for the old users.
*/
$parse_css .= Astra_Enqueue_Scripts::trim_css(
'
@media( max-width: 420px ) {
.single .nav-links .nav-previous,
.single .nav-links .nav-next {
width: 100%;
text-align: center;
}
}
'
);
}
// Navigation CSS.
if ( is_single() && self::astra_4_6_0_compatibility() ) {
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/navigation.php'; // PHPCS:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
}
/**
* Load dynamic css related to logo svg icons.
*
* @since 4.7.0
*/
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/logo-svg-icons.php'; // PHPCS:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
/**
*
* Fix button aligment issue comming from the gutenberg plugin (v9.3.0).
*/
$gtn_plugin_button_center_alignment = array(
'.wp-block-buttons.aligncenter' => array(
'justify-content' => 'center',
),
);
$parse_css .= astra_parse_css( $gtn_plugin_button_center_alignment );
$ast_container_layout = astra_get_content_layout();
$is_boxed = astra_is_content_style_boxed();
$is_sidebar_boxed = astra_is_sidebar_style_boxed();
$ast_container_layout = astra_apply_boxed_layouts( $ast_container_layout, $is_boxed, $is_sidebar_boxed );
/**
* If transparent header is activated then it adds top 1.5em padding space, so this CSS will fix this issue.
* This issue is only visible on responsive devices.
*
* @since 2.6.0
*/
if ( self::gutenberg_core_blocks_css_comp() && is_singular() ) {
$trans_header_responsive_top_space_css_fix = array(
'.ast-theme-transparent-header #primary, .ast-theme-transparent-header #secondary' => array(
'padding' => 0,
),
);
/* Parse CSS from array() -> max-width: (tablet-breakpoint)px CSS */
$parse_css .= astra_parse_css( $trans_header_responsive_top_space_css_fix, '', astra_get_tablet_breakpoint() );
}
/**
* Remove #primary padding on mobile devices which compromises deigned layout.
*
* @since 2.6.1
*/
if ( self::gutenberg_media_text_block_css_compat() && is_singular() ) {
$remove_primary_padding_on_mobile_css = array(
'.ast-plain-container.ast-no-sidebar #primary' => array(
'padding' => 0,
),
);
/* Parse CSS from array() -> max-width: (tablet-breakpoint)px CSS */
$parse_css .= astra_parse_css( $remove_primary_padding_on_mobile_css, '', astra_get_tablet_breakpoint() );
}
/**
* Remove margin top when Primary Header is not set and No Sidebar is added in Full-Width / Contained Layout.
*
* @since 2.5.0
*/
if ( self::gtn_group_cover_css_comp() && is_singular() ) {
$display_header = get_post_meta( get_the_ID(), 'ast-main-header-display', true );
if ( 'disabled' === $display_header && apply_filters( 'astra_content_margin_full_width_contained', true ) || ( Astra_Ext_Transparent_Header_Markup::is_transparent_header() ) || ( self::gutenberg_core_blocks_css_comp() ) ) {
$gtn_margin_top = array(
'.ast-plain-container.ast-no-sidebar #primary' => array(
'margin-top' => '0',
'margin-bottom' => '0',
),
);
$parse_css .= astra_parse_css( $gtn_margin_top );
}
/**
* Re-add margin top when FullWidth Contained layout is set.
*
* @since 3.8.3
*/
if ( true === $update_customizer_strctural_defaults ) {
$display_title = get_post_meta( get_the_ID(), 'site-post-title', true );
if ( 'disabled' !== $display_title && ! Astra_Ext_Transparent_Header_Markup::is_transparent_header() && apply_filters( 'astra_contained_layout_primary_spacing', true ) ) {
$gtn_margin_top = array(
'.ast-plain-container.ast-no-sidebar #primary' => array(
'margin-top' => '60px',
'margin-bottom' => '60px',
),
);
/* Parse CSS from array() -> min-width: (1200)px CSS */
$parse_css .= astra_parse_css( $gtn_margin_top, '1200' );
}
}
}
$single_post_outside_spacing = astra_get_option( 'single-post-outside-spacing' );
if ( ! self::astra_4_6_0_compatibility() ) {
$single_post_outside_spacing_css_desktop = array(
'.ast-separate-container.ast-single-post.ast-right-sidebar #primary, .ast-separate-container.ast-single-post.ast-left-sidebar #primary, .ast-separate-container.ast-single-post #primary, .ast-plain-container.ast-single-post #primary, .ast-narrow-container.ast-single-post #primary' => array(
'margin-top' => astra_responsive_spacing( $single_post_outside_spacing, 'top', 'desktop' ),
'margin-bottom' => astra_responsive_spacing( $single_post_outside_spacing, 'bottom', 'desktop' ),
),
'.ast-left-sidebar.ast-single-post #primary, .ast-right-sidebar.ast-single-post #primary, .ast-separate-container.ast-single-post.ast-right-sidebar #primary, .ast-separate-container.ast-single-post.ast-left-sidebar #primary, .ast-separate-container.ast-single-post #primary, .ast-narrow-container.ast-single-post #primary' => array(
'padding-left' => astra_responsive_spacing( $single_post_outside_spacing, 'left', 'desktop' ),
'padding-right' => astra_responsive_spacing( $single_post_outside_spacing, 'right', 'desktop' ),
),
);
$parse_css .= astra_parse_css( $single_post_outside_spacing_css_desktop );
$single_post_outside_spacing_css_tablet = array(
'.ast-separate-container.ast-single-post.ast-right-sidebar #primary, .ast-separate-container.ast-single-post.ast-left-sidebar #primary, .ast-separate-container.ast-single-post #primary, .ast-plain-container #primary, .ast-narrow-container #primary' => array(
'margin-top' => astra_responsive_spacing( $single_post_outside_spacing, 'top', 'tablet' ),
'margin-bottom' => astra_responsive_spacing( $single_post_outside_spacing, 'bottom', 'tablet' ),
),
'.ast-left-sidebar #primary, .ast-right-sidebar #primary, .ast-separate-container.ast-single-post.ast-right-sidebar #primary, .ast-separate-container.ast-single-post.ast-left-sidebar #primary, .ast-separate-container #primary, .ast-narrow-container #primary' => array(
'padding-left' => astra_responsive_spacing( $single_post_outside_spacing, 'left', 'tablet' ),
'padding-right' => astra_responsive_spacing( $single_post_outside_spacing, 'right', 'tablet' ),
),
'.ast-separate-container.ast-single-post.ast-right-sidebar #primary, .ast-separate-container.ast-single-post.ast-left-sidebar #primary, .ast-separate-container.ast-single-post #primary, .ast-plain-container.ast-single-post #primary, .ast-narrow-container.ast-single-post #primary' => array(
'margin-top' => astra_responsive_spacing( $single_post_outside_spacing, 'top', 'tablet' ),
'margin-bottom' => astra_responsive_spacing( $single_post_outside_spacing, 'bottom', 'tablet' ),
),
'.ast-left-sidebar.ast-single-post #primary, .ast-right-sidebar.ast-single-post #primary, .ast-separate-container.ast-single-post.ast-right-sidebar #primary, .ast-separate-container.ast-single-post.ast-left-sidebar #primary, .ast-separate-container.ast-single-post #primary, .ast-narrow-container.ast-single-post #primary' => array(
'padding-left' => astra_responsive_spacing( $single_post_outside_spacing, 'left', 'tablet' ),
'padding-right' => astra_responsive_spacing( $single_post_outside_spacing, 'right', 'tablet' ),
),
);
$parse_css .= astra_parse_css( $single_post_outside_spacing_css_tablet, '', astra_get_tablet_breakpoint() );
$single_post_outside_spacing_css_mobile = array(
'.ast-separate-container.ast-single-post.ast-right-sidebar #primary, .ast-separate-container.ast-single-post.ast-left-sidebar #primary, .ast-separate-container.ast-single-post #primary, .ast-plain-container.ast-single-post #primary, .ast-narrow-container.ast-single-post #primary' => array(
'margin-top' => astra_responsive_spacing( $single_post_outside_spacing, 'top', 'mobile' ),
'margin-bottom' => astra_responsive_spacing( $single_post_outside_spacing, 'bottom', 'mobile' ),
),
'.ast-left-sidebar.ast-single-post #primary, .ast-right-sidebar.ast-single-post #primary, .ast-separate-container.ast-single-post.ast-right-sidebar #primary, .ast-separate-container.ast-single-post.ast-left-sidebar #primary, .ast-separate-container.ast-single-post #primary, .ast-narrow-container.ast-single-post #primary' => array(
'padding-left' => astra_responsive_spacing( $single_post_outside_spacing, 'left', 'mobile' ),
'padding-right' => astra_responsive_spacing( $single_post_outside_spacing, 'right', 'mobile' ),
),
);
$parse_css .= astra_parse_css( $single_post_outside_spacing_css_mobile, '', astra_get_mobile_breakpoint() );
}
if ( self::astra_4_8_2_compatibility() ) {
$single_post_outside_padding_css_tablet = array(
'.ast-separate-container.ast-single-post #primary, .ast-narrow-container.ast-single-post #primary' => array(
'padding-left' => astra_responsive_spacing( $single_post_outside_spacing, 'left', 'tablet' ),
'padding-right' => astra_responsive_spacing( $single_post_outside_spacing, 'right', 'tablet' ),
),
);
$parse_css .= astra_parse_css( $single_post_outside_padding_css_tablet, '', astra_get_tablet_breakpoint() );
$single_post_outside_padding_css_mobile = array(
'.ast-separate-container.ast-single-post #primary, .ast-narrow-container.ast-single-post #primary' => array(
'padding-left' => astra_responsive_spacing( $single_post_outside_spacing, 'left', 'mobile' ),
'padding-right' => astra_responsive_spacing( $single_post_outside_spacing, 'right', 'mobile' ),
),
);
$parse_css .= astra_parse_css( $single_post_outside_padding_css_mobile, '', astra_get_mobile_breakpoint() );
}
/**
* Single Post Outer spacing
*/
// To apply Container Outside Spacing we need to remove default top padding given from the theme.
$remove_single_post_top_padding_container = array(
'.ast-separate-container #primary, .ast-narrow-container #primary' => array(
'padding-top' => astra_get_css_value( 0, 'px' ),
),
);
// To apply Container Outside Spacing we need to remove default bottom padding given from the theme.
$remove_single_post_bottom_padding_container = array(
'.ast-separate-container #primary, .ast-narrow-container #primary' => array(
'padding-bottom' => astra_get_css_value( 0, 'px' ),
),
);
if ( isset( $single_post_outside_spacing['desktop']['top'] ) && '' != $single_post_outside_spacing['desktop']['top'] ) {
$parse_css .= astra_parse_css( $remove_single_post_top_padding_container );
}
if ( isset( $single_post_outside_spacing['tablet']['top'] ) && '' != $single_post_outside_spacing['tablet']['top'] ) {
$parse_css .= astra_parse_css( $remove_single_post_top_padding_container, '', astra_get_tablet_breakpoint() );
}
if ( isset( $single_post_outside_spacing['mobile']['top'] ) && '' != $single_post_outside_spacing['mobile']['top'] ) {
$parse_css .= astra_parse_css( $remove_single_post_top_padding_container, '', astra_get_mobile_breakpoint() );
}
if ( isset( $single_post_outside_spacing['desktop']['top'] ) && '' != $single_post_outside_spacing['desktop']['top'] ) {
$parse_css .= astra_parse_css( $remove_single_post_bottom_padding_container );
}
if ( isset( $single_post_outside_spacing['tablet']['top'] ) && '' != $single_post_outside_spacing['tablet']['top'] ) {
$parse_css .= astra_parse_css( $remove_single_post_bottom_padding_container, '', astra_get_tablet_breakpoint() );
}
if ( isset( $single_post_outside_spacing['mobile']['top'] ) && '' != $single_post_outside_spacing['mobile']['top'] ) {
$parse_css .= astra_parse_css( $remove_single_post_bottom_padding_container, '', astra_get_mobile_breakpoint() );
}
if ( $block_editor_legacy_setup ) {
/*
* Fix the wide width issue in gutenberg
* check if the current user is existing user or new user.
* if new user load the CSS bty default if existing provide a filter
*/
if ( self::gtn_image_group_css_comp() ) {
if ( false === $improve_gb_ui && ( 'content-boxed-container' == $ast_container_layout || 'boxed-container' == $ast_container_layout ) ) {
$parse_css .= astra_parse_css(
array(
'.ast-separate-container.ast-right-sidebar .entry-content .wp-block-image.alignfull,.ast-separate-container.ast-left-sidebar .entry-content .wp-block-image.alignfull,.ast-separate-container.ast-right-sidebar .entry-content .wp-block-cover.alignfull,.ast-separate-container.ast-left-sidebar .entry-content .wp-block-cover.alignfull' => array(
'margin-left' => '-6.67em',
'margin-right' => '-6.67em',
'max-width' => 'unset',
'width' => 'unset',
),
'.ast-separate-container.ast-right-sidebar .entry-content .wp-block-image.alignwide,.ast-separate-container.ast-left-sidebar .entry-content .wp-block-image.alignwide,.ast-separate-container.ast-right-sidebar .entry-content .wp-block-cover.alignwide,.ast-separate-container.ast-left-sidebar .entry-content .wp-block-cover.alignwide' => array(
'margin-left' => '-20px',
'margin-right' => '-20px',
'max-width' => 'unset',
'width' => 'unset',
),
),
'1200'
);
}
$gtn_full_wide_image_css = array(
'.wp-block-group .has-background' => array(
'padding' => '20px',
),
);
$parse_css .= astra_parse_css( $gtn_full_wide_image_css, '1200' );
} else {
$gtn_tablet_column_css = array(
'.entry-content .wp-block-columns .wp-block-column' => array(
'margin-left' => '0px',
),
);
$parse_css .= astra_parse_css( $gtn_tablet_column_css, '', '782' );
}
if ( self::gtn_group_cover_css_comp() ) {
if ( 'no-sidebar' !== astra_page_layout() ) {
switch ( $ast_container_layout ) {
case 'content-boxed-container':
case 'boxed-container':
if ( true === $improve_gb_ui ) {
break;
}
$parse_css .= astra_parse_css(
array(
// With container - Sidebar.
'.ast-separate-container.ast-right-sidebar .entry-content .wp-block-group.alignwide, .ast-separate-container.ast-left-sidebar .entry-content .wp-block-group.alignwide, .ast-separate-container.ast-right-sidebar .entry-content .wp-block-cover.alignwide, .ast-separate-container.ast-left-sidebar .entry-content .wp-block-cover.alignwide' => array(
'margin-left' => '-20px',
'margin-right' => '-20px',
'padding-left' => '20px',
'padding-right' => '20px',
),
'.ast-separate-container.ast-right-sidebar .entry-content .wp-block-group.alignfull, .ast-separate-container.ast-left-sidebar .entry-content .wp-block-group.alignfull, .ast-separate-container.ast-right-sidebar .entry-content .wp-block-cover.alignfull, .ast-separate-container.ast-left-sidebar .entry-content .wp-block-cover.alignfull' => array(
'margin-left' => '-6.67em',
'margin-right' => '-6.67em',
'padding-left' => '6.67em',
'padding-right' => '6.67em',
),
),
'1200'
);
break;
case 'plain-container':
$parse_css .= astra_parse_css(
array(
// Without container - Sidebar.
'.ast-plain-container.ast-right-sidebar .entry-content .wp-block-group.alignwide, .ast-plain-container.ast-left-sidebar .entry-content .wp-block-group.alignwide, .ast-plain-container.ast-right-sidebar .entry-content .wp-block-group.alignfull, .ast-plain-container.ast-left-sidebar .entry-content .wp-block-group.alignfull' => array(
'padding-left' => '20px',
'padding-right' => '20px',
),
),
'1200'
);
break;
case 'page-builder':
$parse_css .= astra_parse_css(
array(
'.ast-page-builder-template.ast-left-sidebar .entry-content .wp-block-cover.alignwide, .ast-page-builder-template.ast-right-sidebar .entry-content .wp-block-cover.alignwide, .ast-page-builder-template.ast-left-sidebar .entry-content .wp-block-cover.alignfull, .ast-page-builder-template.ast-right-sidebar .entry-content .wp-block-cover.alignful' => array(
'padding-right' => '0',
'padding-left' => '0',
),
),
'1200'
);
break;
}
} else {
switch ( $container_layout ) {
case 'content-boxed-container':
case 'boxed-container':
if ( true === $improve_gb_ui ) {
break;
}
$parse_css .= astra_parse_css(
array(
// With container - No Sidebar.
'.ast-no-sidebar.ast-separate-container .entry-content .wp-block-group.alignwide, .ast-no-sidebar.ast-separate-container .entry-content .wp-block-cover.alignwide' => array(
'margin-left' => '-20px',
'margin-right' => '-20px',
'padding-left' => '20px',
'padding-right' => '20px',
),
'.ast-no-sidebar.ast-separate-container .entry-content .wp-block-cover.alignfull, .ast-no-sidebar.ast-separate-container .entry-content .wp-block-group.alignfull' => array(
'margin-left' => '-6.67em',
'margin-right' => '-6.67em',
'padding-left' => '6.67em',
'padding-right' => '6.67em',
),
),
'1200'
);
break;
case 'plain-container':
$parse_css .= astra_parse_css(
array(
// Without container - No Sidebar.
'.ast-plain-container.ast-no-sidebar .entry-content .alignwide .wp-block-cover__inner-container, .ast-plain-container.ast-no-sidebar .entry-content .alignfull .wp-block-cover__inner-container' => array(
'width' => astra_get_css_value( $site_content_width + 40, 'px' ),
),
),
'1200'
);
break;
case 'page-builder':
$parse_css .= astra_parse_css(
array(
'.ast-page-builder-template.ast-no-sidebar .entry-content .wp-block-cover.alignwide, .ast-page-builder-template.ast-no-sidebar .entry-content .wp-block-cover.alignfull' => array(
'padding-right' => '0',
'padding-left' => '0',
),
),
'1200'
);
break;
}
}
$parse_css .= astra_parse_css(
array(
'.wp-block-cover-image.alignwide .wp-block-cover__inner-container, .wp-block-cover.alignwide .wp-block-cover__inner-container, .wp-block-cover-image.alignfull .wp-block-cover__inner-container, .wp-block-cover.alignfull .wp-block-cover__inner-container' => array(
'width' => '100%',
),
),
'1200'
);
}
if ( self::gutenberg_core_blocks_css_comp() ) {
$desktop_screen_gb_css = array(
// Group block, Columns block, Gallery block, Table block & has-text-align-center selector compatibility Desktop CSS.
'.wp-block-columns' => array(
'margin-bottom' => 'unset',
),
'.wp-block-image.size-full' => array(
'margin' => '2rem 0',
),
'.wp-block-separator.has-background' => array(
'padding' => '0',
),
'.wp-block-gallery' => array(
'margin-bottom' => '1.6em',
),
'.wp-block-group' => array(
'padding-top' => '4em',
'padding-bottom' => '4em',
),
'.wp-block-group__inner-container .wp-block-columns:last-child, .wp-block-group__inner-container :last-child, .wp-block-table table' => array(
'margin-bottom' => '0',
),
'.blocks-gallery-grid' => array(
'width' => '100%',
),
'.wp-block-navigation-link__content' => array(
'padding' => '5px 0',
),
'.wp-block-group .wp-block-group .has-text-align-center, .wp-block-group .wp-block-column .has-text-align-center' => array(
'max-width' => '100%',
),
'.has-text-align-center' => array(
'margin' => '0 auto',
),
);
/* Parse CSS from array() -> Desktop CSS */
$parse_css .= astra_parse_css( $desktop_screen_gb_css );
if ( false === $improve_gb_ui ) {
$middle_screen_min_gb_css = array(
// Group & Column block > align compatibility (min-width:1200px) CSS.
'.wp-block-cover__inner-container, .alignwide .wp-block-group__inner-container, .alignfull .wp-block-group__inner-container' => array(
'max-width' => '1200px',
'margin' => '0 auto',
),
'.wp-block-group.alignnone, .wp-block-group.aligncenter, .wp-block-group.alignleft, .wp-block-group.alignright, .wp-block-group.alignwide, .wp-block-columns.alignwide' => array(
'margin' => '2rem 0 1rem 0',
),
);
/* Parse CSS from array() -> min-width: (1200)px CSS */
$parse_css .= astra_parse_css( $middle_screen_min_gb_css, '1200' );
}
$middle_screen_max_gb_css = array(
// Group & Column block (max-width:1200px) CSS.
'.wp-block-group' => array(
'padding' => '3em',
),
'.wp-block-group .wp-block-group' => array(
'padding' => '1.5em',
),
'.wp-block-columns, .wp-block-column' => array(
'margin' => '1rem 0',
),
);
/* Parse CSS from array() -> max-width: (1200)px CSS */
$parse_css .= astra_parse_css( $middle_screen_max_gb_css, '', '1200' );
$tablet_screen_min_gb_css = array(
// Columns inside Group block compatibility (min-width: tablet-breakpoint) CSS.
'.wp-block-columns .wp-block-group' => array(
'padding' => '2em',
),
);
/* Parse CSS from array() -> min-width: (tablet-breakpoint)px CSS */
$parse_css .= astra_parse_css( $tablet_screen_min_gb_css, astra_get_tablet_breakpoint() );
$mobile_screen_max_gb_css = array(
// Content | image | video inside Media & Text block, Cover block, Image inside cover block compatibility (max-width: mobile-breakpoint) CSS.
'.wp-block-cover-image .wp-block-cover__inner-container, .wp-block-cover .wp-block-cover__inner-container' => array(
'width' => 'unset',
),
'.wp-block-cover, .wp-block-cover-image' => array(
'padding' => '2em 0',
),
'.wp-block-group, .wp-block-cover' => array(
'padding' => '2em',
),
'.wp-block-media-text__media img, .wp-block-media-text__media video' => array(
'width' => 'unset',
'max-width' => '100%',
),
'.wp-block-media-text.has-background .wp-block-media-text__content' => array(
'padding' => '1em',
),
);
if ( ! self::gutenberg_media_text_block_css_compat() ) {
// Added this [! self::gutenberg_media_text_block_css_compat()] condition as we update the same selector CSS in gutenberg_media_text_block_css_compat() function with new padding: 8% 0; CSS for max-width: (mobile-breakpoint).
$mobile_screen_max_gb_css['.wp-block-media-text .wp-block-media-text__content'] = array(
'padding' => '3em 2em',
);
}
/* Parse CSS from array() -> max-width: (mobile-breakpoint)px CSS */
$parse_css .= astra_parse_css( $mobile_screen_max_gb_css, '', astra_get_mobile_breakpoint() );
}
$is_legacy_setup = ( 'legacy' === astra_get_option( 'wp-blocks-ui' ) ) ? true : false;
if ( $is_legacy_setup && astra_wp_version_compare( '6.0', '>=' ) ) {
// Image block align center CSS.
$image_block_center_align = array(
'.wp-block-image.aligncenter' => array(
'margin-left' => 'auto',
'margin-right' => 'auto',
),
);
$parse_css .= astra_parse_css( $image_block_center_align );
}
if ( $is_legacy_setup ) {
// Table block align center CSS.
$table_block_center_align = array(
'.wp-block-table.aligncenter' => array(
'margin-left' => 'auto',
'margin-right' => 'auto',
),
);
$parse_css .= astra_parse_css( $table_block_center_align );
}
if ( self::gutenberg_media_text_block_css_compat() ) {
$media_text_block_padding_css = array(
// Media & Text block CSS compatibility (min-width: mobile-breakpoint) CSS.
'.entry-content .wp-block-media-text.has-media-on-the-right .wp-block-media-text__content' => array(
'padding' => '0 8% 0 0',
),
'.entry-content .wp-block-media-text .wp-block-media-text__content' => array(
'padding' => '0 0 0 8%',
),
'.ast-plain-container .site-content .entry-content .has-custom-content-position.is-position-bottom-left > *, .ast-plain-container .site-content .entry-content .has-custom-content-position.is-position-bottom-right > *, .ast-plain-container .site-content .entry-content .has-custom-content-position.is-position-top-left > *, .ast-plain-container .site-content .entry-content .has-custom-content-position.is-position-top-right > *, .ast-plain-container .site-content .entry-content .has-custom-content-position.is-position-center-right > *, .ast-plain-container .site-content .entry-content .has-custom-content-position.is-position-center-left > *' => array(
'margin' => 0,
),
);
/* Parse CSS from array() -> min-width: (mobile-breakpoint)px CSS */
$parse_css .= astra_parse_css( $media_text_block_padding_css, astra_get_mobile_breakpoint() );
$mobile_screen_media_text_block_css = array(
// Media & Text block padding CSS for (max-width: mobile-breakpoint) CSS.
'.entry-content .wp-block-media-text .wp-block-media-text__content' => array(
'padding' => '8% 0',
),
'.wp-block-media-text .wp-block-media-text__media img' => array(
'width' => 'auto',
'max-width' => '100%',
),
);
/* Parse CSS from array() -> max-width: (mobile-breakpoint)px CSS */
$parse_css .= astra_parse_css( $mobile_screen_media_text_block_css, '', astra_get_mobile_breakpoint() );
}
}
/**
* When supporting GB button outline patterns in v3.3.0 we have given 2px as default border for GB outline button, where we restrict button border for flat type buttons.
* But now while reverting this change there is no need of default border because whatever customizer border will set it should behave accordingly. Although it is empty ('') WP applying 2px as default border for outline buttons.
*
* @since 3.6.3
*/
$default_border_size = '2px';
if ( astra_button_default_padding_updated() ) {
$default_border_size = '';
}
// Outline Gutenberg button compatibility CSS.
$theme_btn_top_border = ( isset( $global_custom_button_border_size['top'] ) && ( '' !== $global_custom_button_border_size['top'] && '0' !== $global_custom_button_border_size['top'] ) ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : $default_border_size;
$theme_btn_right_border = ( isset( $global_custom_button_border_size['right'] ) && ( '' !== $global_custom_button_border_size['right'] && '0' !== $global_custom_button_border_size['right'] ) ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : $default_border_size;
$theme_btn_left_border = ( isset( $global_custom_button_border_size['left'] ) && ( '' !== $global_custom_button_border_size['left'] && '0' !== $global_custom_button_border_size['left'] ) ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : $default_border_size;
$theme_btn_bottom_border = ( isset( $global_custom_button_border_size['bottom'] ) && ( '' !== $global_custom_button_border_size['bottom'] && '0' !== $global_custom_button_border_size['bottom'] ) ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : $default_border_size;
if ( self::gutenberg_core_patterns_compat() ) {
$outline_button_css = array(
'.wp-block-button.is-style-outline .wp-block-button__link' => array(
'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
'border-top-width' => esc_attr( $theme_btn_top_border ),
'border-right-width' => esc_attr( $theme_btn_right_border ),
'border-bottom-width' => esc_attr( $theme_btn_bottom_border ),
'border-left-width' => esc_attr( $theme_btn_left_border ),
),
'div.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color), div.wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color)' => array(
'color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
),
'.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' => 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 ),
),
// Adding CSS to highlight current paginated number.
'.post-page-numbers.current .page-link, .ast-pagination .page-numbers.current' => array(
'color' => astra_get_foreground_color( $theme_color ),
'border-color' => esc_attr( $theme_color ),
'background-color' => esc_attr( $theme_color ),
),
);
/* Parse CSS from array() -> All media CSS */
$parse_css .= astra_parse_css( $outline_button_css );
if ( $block_editor_legacy_setup ) {
if ( ! astra_button_default_padding_updated() ) {
// Tablet CSS.
$outline_button_tablet_css = array(
'.wp-block-button.is-style-outline .wp-block-button__link' => array(
'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
),
);
$parse_css .= astra_parse_css( $outline_button_tablet_css, '', astra_get_tablet_breakpoint() );
// Mobile CSS.
$outline_button_mobile_css = array(
'.wp-block-button.is-style-outline .wp-block-button__link' => array(
'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
),
);
$parse_css .= astra_parse_css( $outline_button_mobile_css, '', astra_get_mobile_breakpoint() );
}
if ( $is_site_rtl ) {
$gb_patterns_min_mobile_css = array(
'.entry-content > .alignleft' => array(
'margin-left' => '20px',
),
'.entry-content > .alignright' => array(
'margin-right' => '20px',
),
);
} else {
$gb_patterns_min_mobile_css = array(
'.entry-content > .alignleft' => array(
'margin-right' => '20px',
),
'.entry-content > .alignright' => array(
'margin-left' => '20px',
),
);
}
if ( ! astra_button_default_padding_updated() ) {
$gb_patterns_min_mobile_css['.wp-block-group.has-background'] = array(
'padding' => '20px',
);
}
/* Parse CSS from array() -> min-width: (mobile-breakpoint) px CSS */
$parse_css .= astra_parse_css( $gb_patterns_min_mobile_css, astra_get_mobile_breakpoint() );
}
}
if ( astra_button_default_padding_updated() ) {
$outline_button_css = array(
'.wp-block-button.is-style-outline .wp-block-button__link' => array(
'border-top-width' => esc_attr( $theme_btn_top_border ),
'border-right-width' => esc_attr( $theme_btn_right_border ),
'border-bottom-width' => esc_attr( $theme_btn_bottom_border ),
'border-left-width' => esc_attr( $theme_btn_left_border ),
),
);
/* Parse CSS from array() -> All media CSS */
$parse_css .= astra_parse_css( $outline_button_css );
}
/**
* Secondary button styles.
*/
$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' );
$outline_button_selector = '.wp-block-button.is-style-outline .wp-block-button__link.wp-element-button, .ast-outline-button';
$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_val = '';
$border_right_val = '';
$border_bottom_val = '';
$border_left_val = '';
$gutenberg_core_patterns_compat = self::gutenberg_core_patterns_compat();
// Secondary color.
if ( empty( $scndry_btn_text_color ) && $gutenberg_core_patterns_compat ) {
$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 ) && $gutenberg_core_patterns_compat ) {
$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 ) && $gutenberg_core_patterns_compat ) {
$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;
}
// Secondary button border size.
if ( $scndry_theme_btn_top_border || $scndry_theme_btn_right_border || $scndry_theme_btn_left_border || $scndry_theme_btn_bottom_border ) {
$border_top_val = $scndry_theme_btn_top_border;
$border_right_val = $scndry_theme_btn_right_border;
$border_bottom_val = $scndry_theme_btn_bottom_border;
$border_left_val = $scndry_theme_btn_left_border;
$outline_button_selector = '.wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link.wp-element-button, .ast-outline-button, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button';
}
// Secondary button padding.
if ( $padding_top || $padding_right || $padding_bottom || $padding_left ) {
$outline_button_selector = '.wp-block-buttons .wp-block-button.is-style-outline .wp-block-button__link.wp-element-button, .ast-outline-button, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button';
}
// 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';
}
$outline_button_css_desktop = array(
$outline_button_selector => array(
'border-color' => esc_attr( $btn_border_color_val ),
'border-top-width' => esc_attr( $border_top_val ),
'border-right-width' => esc_attr( $border_right_val ),
'border-bottom-width' => esc_attr( $border_bottom_val ),
'border-left-width' => esc_attr( $border_left_val ),
'font-family' => astra_get_font_family( $scndry_theme_btn_font_family ),
'font-weight' => esc_attr( $scndry_theme_btn_font_weight ),
'font-size' => isset( $scndry_theme_btn_font_size['desktop'] ) && isset( $scndry_theme_btn_font_size['desktop-unit'] ) && is_array( $scndry_theme_btn_font_size ) ? astra_get_font_css_value( $scndry_theme_btn_font_size['desktop'], $scndry_theme_btn_font_size['desktop-unit'] ) : '',
'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' => $padding_top,
'padding-right' => $padding_right,
'padding-bottom' => $padding_bottom,
'padding-left' => $padding_left,
'border-top-left-radius' => astra_responsive_spacing( $scndry_btn_border_radius_fields, 'top', 'desktop' ),
'border-top-right-radius' => astra_responsive_spacing( $scndry_btn_border_radius_fields, 'right', 'desktop' ),
'border-bottom-right-radius' => astra_responsive_spacing( $scndry_btn_border_radius_fields, 'bottom', 'desktop' ),
'border-bottom-left-radius' => astra_responsive_spacing( $scndry_btn_border_radius_fields, 'left', 'desktop' ),
),
'.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 ),
),
'.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, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button:hover, .wp-block-uagb-buttons-child .uagb-buttons-repeater.ast-outline-button:focus' => array(
'color' => empty( $scndry_btn_text_hover_color ) && $gutenberg_core_patterns_compat ? esc_attr( $btn_text_hover_color ) : esc_attr( $scndry_btn_text_hover_color ),
'background-color' => empty( $scndry_btn_bg_hover_color ) && $gutenberg_core_patterns_compat ? esc_attr( $btn_bg_hover_color ) : esc_attr( $scndry_btn_bg_hover_color ),
'border-color' => esc_attr( $btn_border_h_color_val ),
),
);
if ( $content_links_underline && $button_styling_improved ) {
$outline_button_css_desktop['.ast-single-post .entry-content a.ast-outline-button, .ast-single-post .entry-content .is-style-outline>.wp-block-button__link'] = array(
'text-decoration' => '' === $scndry_theme_btn_text_decoration || 'initial' === $scndry_theme_btn_text_decoration ? 'none' : esc_attr( $scndry_theme_btn_text_decoration ),
);
}
$outline_button_css_tablet = array(
$outline_button_selector => array(
'font-size' => astra_responsive_font( $scndry_theme_btn_font_size, 'tablet' ),
'padding-top' => astra_responsive_spacing( $scndry_theme_btn_padding, 'top', 'tablet' ),
'padding-right' => astra_responsive_spacing( $scndry_theme_btn_padding, 'right', 'tablet' ),
'padding-bottom' => astra_responsive_spacing( $scndry_theme_btn_padding, 'bottom', 'tablet' ),
'padding-left' => astra_responsive_spacing( $scndry_theme_btn_padding, 'left', 'tablet' ),
'border-top-left-radius' => astra_responsive_spacing( $scndry_btn_border_radius_fields, 'top', 'tablet' ),
'border-top-right-radius' => astra_responsive_spacing( $scndry_btn_border_radius_fields, 'right', 'tablet' ),
'border-bottom-right-radius' => astra_responsive_spacing( $scndry_btn_border_radius_fields, 'bottom', 'tablet' ),
'border-bottom-left-radius' => astra_responsive_spacing( $scndry_btn_border_radius_fields, 'left', 'tablet' ),
),
);
$outline_button_css_mobile = array(
$outline_button_selector => array(
'font-size' => astra_responsive_font( $scndry_theme_btn_font_size, 'mobile' ),
'padding-top' => astra_responsive_spacing( $scndry_theme_btn_padding, 'top', 'mobile' ),
'padding-right' => astra_responsive_spacing( $scndry_theme_btn_padding, 'right', 'mobile' ),
'padding-bottom' => astra_responsive_spacing( $scndry_theme_btn_padding, 'bottom', 'mobile' ),
'padding-left' => astra_responsive_spacing( $scndry_theme_btn_padding, 'left', 'mobile' ),
'border-top-left-radius' => astra_responsive_spacing( $scndry_btn_border_radius_fields, 'top', 'mobile' ),
'border-top-right-radius' => astra_responsive_spacing( $scndry_btn_border_radius_fields, 'right', 'mobile' ),
'border-bottom-right-radius' => astra_responsive_spacing( $scndry_btn_border_radius_fields, 'bottom', 'mobile' ),
'border-bottom-left-radius' => astra_responsive_spacing( $scndry_btn_border_radius_fields, 'left', 'mobile' ),
),
);
// Secondary button background color.
$outline_button_css_desktop['.wp-block-button .wp-block-button__link.wp-element-button.is-style-outline:not(.has-background), .wp-block-button.is-style-outline>.wp-block-button__link.wp-element-button:not(.has-background), .ast-outline-button'] = array(
'background-color' => empty( $scndry_btn_bg_color ) ? 'transparent' : esc_attr( $scndry_btn_bg_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), .ast-outline-button'] = 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 ),
);
}
if ( $button_styling_improved ) {
$outline_button_css_desktop['.uagb-buttons-repeater.ast-outline-button'] = array(
'border-radius' => '9999px',
);
}
/* Parse CSS from array() -> Desktop */
$parse_css .= astra_parse_css( $outline_button_css_desktop );
/* Parse CSS from array() -> Tablet */
$parse_css .= astra_parse_css( $outline_button_css_tablet, '', astra_get_tablet_breakpoint() );
/* Parse CSS from array() -> Mobile */
$parse_css .= astra_parse_css( $outline_button_css_mobile, '', astra_get_mobile_breakpoint() );
/**
* Add margin-bottom to the figure element conditionally for WordPress 6.3 or above.
*
* @since 4.4.0
*/
if ( astra_wp_version_compare( '6.3', '>=' ) ) {
$figure_margin_bottom = array(
'.entry-content[data-ast-blocks-layout] > figure' => array(
'margin-bottom' => '1em',
),
);
/* Parse CSS from array() -> All media CSS */
$parse_css .= astra_parse_css( $figure_margin_bottom );
}
if ( $is_widget_title_support_font_weight ) {
$widget_title_font_weight_support = array(
'h1.widget-title' => array(
'font-weight' => esc_attr( $h1_font_weight ),
),
'h2.widget-title' => array(
'font-weight' => esc_attr( $h2_font_weight ),
),
'h3.widget-title' => array(
'font-weight' => esc_attr( $h3_font_weight ),
),
);
/* Parse CSS from array() -> All media CSS */
$parse_css .= astra_parse_css( $widget_title_font_weight_support );
}
$static_layout_css = array(
'.ast-separate-container #primary, .ast-separate-container #secondary' => array(
'padding' => '1.5em 0',
),
'#primary, #secondary' => array(
'padding' => '1.5em 0',
'margin' => 0,
),
'.ast-left-sidebar #content > .ast-container' => array(
'display' => 'flex',
'flex-direction' => 'column-reverse',
'width' => '100%',
),
);
// Handle backward compatibility for Elementor Pro heading's margin.
if ( defined( 'ELEMENTOR_PRO_VERSION' ) && $elementor_heading_margin_style_comp ) {
$elementor_base_css[' .content-area .elementor-widget-theme-post-content h1, .content-area .elementor-widget-theme-post-content h2, .content-area .elementor-widget-theme-post-content h3, .content-area .elementor-widget-theme-post-content h4, .content-area .elementor-widget-theme-post-content h5, .content-area .elementor-widget-theme-post-content h6'] = array(
'margin-top' => '1.5em',
'margin-bottom' => 'calc(0.3em + 10px)',
);
$parse_css .= astra_parse_css( $elementor_base_css );
}
// Getting the responsive alignment option.
$shop_product_alignment = astra_get_option( 'shop-product-align-responsive' );
// Added Check if the tablet alignment is 'align-center'
if ( ( isset( $shop_product_alignment['desktop'] ) && 'align-center' === $shop_product_alignment['desktop'] ) && 'shop-page-list-style' !== astra_get_option( 'shop-style' ) ) {
$desktop_review_wrapper[' .ast-desktop .review-count'] = array(
'margin-left' => '-40px',
'margin-right' => 'auto',
);
/* Parse CSS from array() -> Desktop CSS */
$parse_css .= astra_parse_css( $desktop_review_wrapper );
}
if ( class_exists( 'WooCommerce' ) && ! is_product() ) {
$review_rating_style['.review-rating'] = array(
'display' => 'flex',
'align-items' => 'center',
'order' => '2',
);
/* Parse CSS from array() -> Desktop CSS */
$parse_css .= astra_parse_css( $review_rating_style );
}
// Added cover block paragraph tag text color compatibility.
if ( has_block( 'core/cover' ) ) {
$cover_block_style['body .wp-block-cover:not(.has-text-color.has-link-color) p'] = array(
'color' => esc_attr( $text_color ),
);
$parse_css .= astra_parse_css( $cover_block_style );
}
if ( true === $update_customizer_strctural_defaults ) {
$is_site_rtl = is_rtl() ? true : false;
$ltr_left = $is_site_rtl ? esc_attr( 'right' ) : esc_attr( 'left' );
$ltr_right = $is_site_rtl ? esc_attr( 'left' ) : esc_attr( 'right' );
$default_layout_update_css = array(
'#page' => array(
'display' => 'flex',
'flex-direction' => 'column',
'min-height' => '100vh',
),
'.ast-404-layout-1 h1.page-title' => array(
'color' => 'var(--ast-global-color-2)',
),
'.single .post-navigation a' => array(
'line-height' => '1em',
'height' => 'inherit',
),
'.error-404 .page-sub-title' => array(
'font-size' => '1.5rem',
'font-weight' => 'inherit',
),
'.search .site-content .content-area .search-form' => array(
'margin-bottom' => '0',
),
'#page .site-content' => array(
'flex-grow' => '1',
),
'.widget' => array(
'margin-bottom' => '1.25em',
),
'#secondary li' => array(
'line-height' => '1.5em',
),
'#secondary .wp-block-group h2' => array(
'margin-bottom' => '0.7em',
),
'#secondary h2' => array(
'font-size' => '1.7rem',
),
'.ast-separate-container .ast-article-post, .ast-separate-container .ast-article-single, .ast-separate-container .comment-respond' => array(
'padding' => self::astra_4_6_0_compatibility() && is_single() ? '2.5em' : '3em',
),
'.ast-separate-container .ast-article-single .ast-article-single' => array(
'padding' => '0',
),
'.ast-article-single .wp-block-post-template-is-layout-grid' => array(
'padding-' . $ltr_left => '0',
),
'.ast-separate-container .comments-title, .ast-narrow-container .comments-title' => array(
'padding' => '1.5em 2em',
),
'.ast-page-builder-template .comment-form-textarea, .ast-comment-formwrap .ast-grid-common-col' => array(
'padding' => '0',
),
'.ast-comment-formwrap' => array(
'padding' => '0',
'display' => 'inline-flex',
'column-gap' => '20px',
'width' => '100%',
'margin-left' => '0',
'margin-right' => '0',
),
'.comments-area textarea#comment:focus, .comments-area textarea#comment:active, .comments-area .ast-comment-formwrap input[type="text"]:focus, .comments-area .ast-comment-formwrap input[type="text"]:active ' => array(
'box-shadow' => 'none',
'outline' => 'none',
),
'.archive.ast-page-builder-template .entry-header' => array(
'margin-top' => '2em',
),
'.ast-page-builder-template .ast-comment-formwrap' => array(
'width' => '100%',
),
'.entry-title' => array(
'margin-bottom' => self::astra_4_6_0_compatibility() ? '0.6em' : '0.5em',
),
'.ast-archive-description p' => array(
'font-size' => 'inherit',
'font-weight' => 'inherit',
'line-height' => 'inherit',
),
);
if ( ! self::astra_4_6_0_compatibility() ) {
$default_layout_update_css['.ast-separate-container .ast-comment-list li.depth-1, .hentry'] = array(
'margin-bottom' => '2em',
);
} else {
if ( is_single() && astra_get_option( 'single-content-images-shadow', false ) ) {
$default_layout_update_css['.ast-article-single 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)',
);
}
$default_layout_update_css['.ast-separate-container .ast-comment-list li.depth-1, .hentry'] = array(
'margin-bottom' => '1.5em',
);
$default_layout_update_css['.site-content section.ast-archive-description'] = array(
'margin-bottom' => '2em',
);
// Search page.
if ( is_search() ) {
$default_layout_update_css['.no-results'] = array(
'text-align' => 'center',
);
$default_layout_update_css['.no-results .search-form'] = array(
'max-width' => '370px',
'margin' => '0 auto',
);
$default_layout_update_css['.no-results .search-field'] = array(
'width' => '100%',
);
$default_layout_update_css['.search .site-main .no-results .ast-search-submit'] = array(
'display' => 'block',
);
$default_layout_update_css['.search .site-main .no-results .ast-live-search-results'] = array(
'max-height' => '200px',
);
}
}
/* Parse CSS from array() -> Desktop CSS */
$parse_css .= astra_parse_css( $default_layout_update_css );
$default_tablet_layout_css = array(
'.ast-left-sidebar.ast-page-builder-template #secondary, .archive.ast-right-sidebar.ast-page-builder-template .site-main' => array(
'padding-' . $ltr_left => '20px',
'padding-' . $ltr_right => '20px',
),
);
/* Parse CSS from array() -> min-width: tablet-breakpoint CSS */
$parse_css .= astra_parse_css( $default_tablet_layout_css, astra_get_tablet_breakpoint() );
$default_mobile_layout_css = array(
'.ast-comment-formwrap.ast-row' => array(
'column-gap' => '10px',
'display' => 'inline-block',
),
'#ast-commentform .ast-grid-common-col' => array(
'position' => 'relative',
'width' => '100%',
),
);
/* Parse CSS from array() -> max-width: mobile-breakpoint CSS */
$parse_css .= astra_parse_css( $default_mobile_layout_css, '', astra_get_mobile_breakpoint() );
if ( is_user_logged_in() ) {
$admin_bar_specific_page_css = array(
'.admin-bar #page' => array(
'min-height' => 'calc(100vh - 32px)',
),
);
$parse_css .= astra_parse_css( $admin_bar_specific_page_css );
$admin_bar_responsive_page_css = array(
'.admin-bar #page' => array(
'min-height' => 'calc(100vh - 46px)',
),
);
$parse_css .= astra_parse_css( $admin_bar_responsive_page_css, '', '782' );
}
$default_medium_layout_css = array(
'.ast-separate-container .ast-article-post, .ast-separate-container .ast-article-single, .ast-separate-container .ast-author-box, .ast-separate-container .ast-404-layout-1, .ast-separate-container .no-results' => array(
'padding' => self::astra_4_6_0_compatibility() && is_single() ? '2.5em' : '3em',
),
);
/* Parse CSS from array() -> min-width: 1201px CSS */
$parse_css .= astra_parse_css( $default_medium_layout_css, '1201' );
if ( is_author() ) {
$default_author_css = array(
'.ast-author-box img.avatar' => array(
'margin' => '0',
),
);
/* Parse CSS from array() -> Desktop CSS */
$parse_css .= astra_parse_css( $default_author_css );
$default_tablet_min_author_css = array(
'.ast-author-box img.avatar' => array(
'width' => '100px',
'height' => '100px',
),
'.ast-author-box' => array(
'column-gap' => '50px',
),
);
/* Parse CSS from array() -> min-width: (tablet-breakpoint) CSS */
$parse_css .= astra_parse_css( $default_tablet_min_author_css, astra_get_tablet_breakpoint() );
$default_max_tablet_author_css = array(
'.ast-author-avatar' => array(
'margin-top' => '20px',
),
);
/* Parse CSS from array() -> max-width: (tablet-breakpoint) CSS */
$parse_css .= astra_parse_css( $default_max_tablet_author_css, '', astra_get_tablet_breakpoint() );
$default_tablet_min_extra_px_author_css = array(
'.ast-author-box' => array(
'align-items' => 'center',
),
);
/* Parse CSS from array() -> min-width: (tablet-breakpoint + 1) CSS */
$parse_css .= astra_parse_css( $default_tablet_min_extra_px_author_css, astra_get_tablet_breakpoint( '', 1 ) );
}
} else {
$static_layout_css['.ast-separate-container .ast-article-post, .ast-separate-container .ast-article-single'] = array(
'padding' => '1.5em 2.14em',
);
$static_layout_css['.ast-author-box img.avatar'] = array(
'margin' => '20px 0 0 0',
);
}
// Handle backward compatibility for Elementor Loop block post div container padding.
if ( defined( 'ELEMENTOR_PRO_VERSION' ) && $elementor_container_padding_style_comp ) {
$elementor_base_css['.elementor-loop-container .e-loop-item, .elementor-loop-container .ast-separate-container .ast-article-post, .elementor-loop-container .ast-separate-container .ast-article-single, .elementor-loop-container .ast-separate-container .comment-respond'] = array(
'padding' => '0px',
);
$parse_css .= astra_parse_css( $elementor_base_css );
}
/* Parse CSS from array() -> max-width: (tablet-breakpoint)px CSS */
$parse_css .= astra_parse_css( $static_layout_css, '', astra_get_tablet_breakpoint() );
if ( is_author() && false === $update_customizer_strctural_defaults ) {
$parse_css .= astra_parse_css(
array(
'.ast-author-box img.avatar' => array(
'margin' => '20px 0 0 0',
),
),
astra_get_tablet_breakpoint()
);
}
if ( 'no-sidebar' !== astra_page_layout() ) {
$static_secondary_layout_css = array(
'#secondary.secondary' => array(
'padding-top' => 0,
),
'.ast-separate-container.ast-right-sidebar #secondary' => array(
'padding-left' => '1em',
'padding-right' => '1em',
),
'.ast-separate-container.ast-two-container #secondary' => array(
'padding-left' => 0,
'padding-right' => 0,
),
'.ast-page-builder-template .entry-header #secondary, .ast-page-builder-template #secondary' => array(
'margin-top' => '1.5em',
),
);
$parse_css .= astra_parse_css( $static_secondary_layout_css, '', astra_get_tablet_breakpoint() );
}
if ( 'no-sidebar' !== astra_page_layout() ) {
if ( $is_site_rtl ) {
$static_layout_lang_direction_css = array(
'.ast-right-sidebar #primary' => array(
'padding-left' => 0,
),
'.ast-page-builder-template.ast-left-sidebar #secondary, ast-page-builder-template.ast-right-sidebar #secondary' => array(
'padding-left' => '20px',
'padding-right' => '20px',
),
'.ast-right-sidebar #secondary, .ast-left-sidebar #primary' => array(
'padding-right' => 0,
),
'.ast-left-sidebar #secondary' => array(
'padding-left' => 0,
),
);
} else {
$static_layout_lang_direction_css = array(
'.ast-right-sidebar #primary' => array(
'padding-right' => 0,
),
'.ast-page-builder-template.ast-left-sidebar #secondary, .ast-page-builder-template.ast-right-sidebar #secondary' => array(
'padding-right' => '20px',
'padding-left' => '20px',
),
'.ast-right-sidebar #secondary, .ast-left-sidebar #primary' => array(
'padding-left' => 0,
),
'.ast-left-sidebar #secondary' => array(
'padding-right' => 0,
),
);
}
/* Parse CSS from array() -> max-width: (tablet-breakpoint)px CSS */
$parse_css .= astra_parse_css( $static_layout_lang_direction_css, '', astra_get_tablet_breakpoint() );
}
$static_layout_css_min = array(
'.ast-separate-container.ast-right-sidebar #primary, .ast-separate-container.ast-left-sidebar #primary' => array(
'border' => 0,
),
'.search-no-results.ast-separate-container #primary' => array(
'margin-bottom' => '4em',
),
);
if ( is_author() ) {
$author_table_css = array(
'.ast-author-box' => array(
'-js-display' => 'flex',
'display' => 'flex',
),
'.ast-author-bio' => array(
'flex' => '1',
),
);
$static_layout_css_min = array_merge( $static_layout_css_min, $author_table_css );
}
/* Parse CSS from array() -> min-width: (tablet-breakpoint + 1)px CSS */
$parse_css .= astra_parse_css( $static_layout_css_min, astra_get_tablet_breakpoint( '', '1' ) );
// 404 Page.
if ( is_404() ) {
$page_404 = array(
'.ast-404-layout-1 .ast-404-text' => array(
'font-size' => astra_get_font_css_value( '200' ),
),
);
$parse_css .= astra_parse_css( $page_404 );
$parse_css .= astra_parse_css(
array(
'.error404.ast-separate-container #primary' => array(
'margin-bottom' => '4em',
),
),
astra_get_tablet_breakpoint( '', '1' )
);
$parse_css .= astra_parse_css(
array(
'.ast-404-layout-1 .ast-404-text' => array(
'font-size' => astra_get_font_css_value( 100 ),
),
),
'',
'920'
);
}
if ( 'no-sidebar' !== astra_page_layout() ) {
if ( $is_site_rtl ) {
$static_layout_min_lang_direction_css = array(
'.ast-right-sidebar #primary' => array(
'border-left' => '1px solid var(--ast-border-color)',
),
'.ast-right-sidebar #secondary' => array(
'border-right' => '1px solid var(--ast-border-color)',
'margin-right' => '-1px',
),
'.ast-left-sidebar #primary' => array(
'border-right' => '1px solid var(--ast-border-color)',
),
'.ast-left-sidebar #secondary' => array(
'border-left' => '1px solid var(--ast-border-color)',
'margin-left' => '-1px',
),
'.ast-separate-container.ast-two-container.ast-right-sidebar #secondary' => array(
'padding-right' => '30px',
'padding-left' => 0,
),
'.ast-separate-container.ast-two-container.ast-left-sidebar #secondary' => array(
'padding-left' => '30px',
'padding-right' => 0,
),
'.ast-separate-container.ast-right-sidebar #secondary, .ast-separate-container.ast-left-sidebar #secondary' => array(
'border' => 0,
'margin-left' => 'auto',
'margin-right' => 'auto',
),
'.ast-separate-container.ast-two-container #secondary .widget:last-child' => array(
'margin-bottom' => 0,
),
);
} else {
$static_layout_min_lang_direction_css = array(
'.ast-right-sidebar #primary' => array(
'border-right' => '1px solid var(--ast-border-color)',
),
'.ast-left-sidebar #primary' => array(
'border-left' => '1px solid var(--ast-border-color)',
),
'.ast-right-sidebar #secondary' => array(
'border-left' => '1px solid var(--ast-border-color)',
'margin-left' => '-1px',
),
'.ast-left-sidebar #secondary' => array(
'border-right' => '1px solid var(--ast-border-color)',
'margin-right' => '-1px',
),
'.ast-separate-container.ast-two-container.ast-right-sidebar #secondary' => array(
'padding-left' => '30px',
'padding-right' => 0,
),
'.ast-separate-container.ast-two-container.ast-left-sidebar #secondary' => array(
'padding-right' => '30px',
'padding-left' => 0,
),
'.ast-separate-container.ast-right-sidebar #secondary, .ast-separate-container.ast-left-sidebar #secondary' => array(
'border' => 0,
'margin-left' => 'auto',
'margin-right' => 'auto',
),
'.ast-separate-container.ast-two-container #secondary .widget:last-child' => array(
'margin-bottom' => 0,
),
);
}
/* Parse CSS from array() -> min-width: (tablet-breakpoint + 1)px CSS */
$parse_css .= astra_parse_css( $static_layout_min_lang_direction_css, astra_get_tablet_breakpoint( '', '1' ) );
}
/**
* Elementor & Gutenberg button backward compatibility for default styling.
*/
if ( self::page_builder_button_style_css() ) {
$search_button_selector = ( ! $block_editor_legacy_setup || $is_wp_5_8_support_enabled ) ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button' : '';
$search_button_hover_selector = ( ! $block_editor_legacy_setup || $is_wp_5_8_support_enabled ) ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:hover, form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:focus' : '';
$file_block_button_selector = ( ! $block_editor_legacy_setup || $improve_gb_ui ) ? ', body .wp-block-file .wp-block-file__button' : '';
$file_block_button_hover_selector = ( ! $block_editor_legacy_setup || $improve_gb_ui ) ? ', body .wp-block-file .wp-block-file__button:hover, body .wp-block-file .wp-block-file__button:focus' : '';
$search_page_btn_selector = ( true === $update_customizer_strctural_defaults ) ? ', .search .search-submit' : '';
$woo_btns_selector = ( true === self::astra_woo_support_global_settings() ) ? ', .woocommerce-js a.button, .woocommerce button.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce input.button:disabled, .woocommerce input.button:disabled[disabled], .woocommerce input.button:disabled:hover, .woocommerce input.button:disabled[disabled]:hover, .woocommerce #respond input#submit, .woocommerce button.button.alt.disabled, .wc-block-grid__products .wc-block-grid__product .wp-block-button__link, .wc-block-grid__product-onsale, [CLASS*="wc-block"] button, .woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons .button:not(.checkout):not(.ast-continue-shopping), .woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons a.checkout, .woocommerce button.button.alt.disabled.wc-variation-selection-needed, [CLASS*="wc-block"] .wc-block-components-button' : '';
$woo_btns_hover_selector = ( true === self::astra_woo_support_global_settings() ) ? ', .woocommerce-js a.button:hover, .woocommerce button.button:hover, .woocommerce .woocommerce-message a.button:hover,.woocommerce #respond input#submit:hover,.woocommerce #respond input#submit.alt:hover, .woocommerce input.button.alt:hover, .woocommerce input.button:hover, .woocommerce button.button.alt.disabled:hover, .wc-block-grid__products .wc-block-grid__product .wp-block-button__link:hover, [CLASS*="wc-block"] button:hover, .woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons .button:not(.checkout):not(.ast-continue-shopping):hover, .woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons a.checkout:hover, .woocommerce button.button.alt.disabled.wc-variation-selection-needed:hover, [CLASS*="wc-block"] .wc-block-components-button:hover, [CLASS*="wc-block"] .wc-block-components-button:focus' : '';
$v4_2_2_core_form_btns_styling_selector = ( true === self::astra_core_form_btns_styling() ) ? ', #comments .submit, .search .search-submit' : '';
/**
* Global button CSS - Desktop.
*/
$global_button_desktop = array(
'.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"]' . $v4_2_2_core_form_btns_styling_selector . $search_button_selector . $file_block_button_selector . $search_page_btn_selector . $woo_btns_selector => array(
'border-style' => 'solid',
'border-top-width' => ( isset( $global_custom_button_border_size['top'] ) && '' !== $global_custom_button_border_size['top'] ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : '0',
'border-right-width' => ( isset( $global_custom_button_border_size['right'] ) && '' !== $global_custom_button_border_size['right'] ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : '0',
'border-left-width' => ( isset( $global_custom_button_border_size['left'] ) && '' !== $global_custom_button_border_size['left'] ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : '0',
'border-bottom-width' => ( isset( $global_custom_button_border_size['bottom'] ) && '' !== $global_custom_button_border_size['bottom'] ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : '0',
'color' => esc_attr( $btn_text_color ),
'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
'background-color' => esc_attr( $btn_bg_color ),
'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' ),
'font-family' => astra_get_font_family( $theme_btn_font_family ),
'font-weight' => esc_attr( $theme_btn_font_weight ),
'font-size' => astra_get_font_css_value( $theme_btn_font_size['desktop'], $theme_btn_font_size['desktop-unit'] ),
'line-height' => esc_attr( $theme_btn_line_height ),
'text-transform' => esc_attr( $theme_btn_text_transform ),
'text-decoration' => esc_attr( $theme_btn_text_decoration ),
'letter-spacing' => esc_attr( $theme_btn_letter_spacing ),
'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' ),
),
'button:focus, .menu-toggle:hover, button:hover, .ast-button:hover, .ast-custom-button:hover .button:hover, .ast-custom-button:hover , input[type=reset]:hover, input[type=reset]:focus, input#submit:hover, input#submit:focus, input[type="button"]:hover, input[type="button"]:focus, input[type="submit"]:hover, input[type="submit"]:focus' . $search_button_hover_selector . $file_block_button_hover_selector . $woo_btns_hover_selector => 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 ),
),
);
/**
* Global button CSS - Tablet.
*/
$global_button_tablet = array(
'.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"]' . $v4_2_2_core_form_btns_styling_selector . $search_button_selector . $file_block_button_selector . $search_page_btn_selector . $woo_btns_selector => array(
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'tablet' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'tablet' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'tablet' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'tablet' ),
'font-size' => astra_responsive_font( $theme_btn_font_size, 'tablet' ),
'border-top-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'top', 'tablet' ),
'border-top-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'right', 'tablet' ),
'border-bottom-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'tablet' ),
'border-bottom-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'left', 'tablet' ),
),
);
/**
* Global button CSS - Mobile.
*/
$global_button_mobile = array(
'.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"]' . $v4_2_2_core_form_btns_styling_selector . $search_button_selector . $file_block_button_selector . $search_page_btn_selector . $woo_btns_selector => array(
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'mobile' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'mobile' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'mobile' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'mobile' ),
'font-size' => astra_responsive_font( $theme_btn_font_size, 'mobile' ),
'border-top-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'top', 'mobile' ),
'border-top-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'right', 'mobile' ),
'border-bottom-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'mobile' ),
'border-bottom-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'left', 'mobile' ),
),
);
$btn_text_color_selectors = '.wp-block-button .wp-block-button__link';
$extra_body_class = $add_body_class ? 'body ' : '';
if ( 'color-typo' === self::elementor_default_color_font_setting() || 'color' === self::elementor_default_color_font_setting() || 'typo' === self::elementor_default_color_font_setting() ) {
$ele_btn_default_desktop = array(
'.elementor-button-wrapper .elementor-button' => array(
'border-style' => 'solid',
'text-decoration' => 'none',
'border-top-width' => ( isset( $global_custom_button_border_size['top'] ) && '' !== $global_custom_button_border_size['top'] ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : '0',
'border-right-width' => ( isset( $global_custom_button_border_size['right'] ) && '' !== $global_custom_button_border_size['right'] ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : '0',
'border-left-width' => ( isset( $global_custom_button_border_size['left'] ) && '' !== $global_custom_button_border_size['left'] ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : '0',
'border-bottom-width' => ( isset( $global_custom_button_border_size['bottom'] ) && '' !== $global_custom_button_border_size['bottom'] ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : '0',
),
$extra_body_class . '.elementor-button.elementor-size-sm, ' . $extra_body_class . '.elementor-button.elementor-size-xs, ' . $extra_body_class . '.elementor-button.elementor-size-md, ' . $extra_body_class . '.elementor-button.elementor-size-lg, ' . $extra_body_class . '.elementor-button.elementor-size-xl, ' . $extra_body_class . '.elementor-button' => array(
'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' ),
),
);
/* Parse CSS from array() */
$parse_css .= astra_parse_css( $ele_btn_default_desktop );
$ele_btn_default_tablet = array(
'.elementor-button-wrapper .elementor-button.elementor-size-sm, .elementor-button-wrapper .elementor-button.elementor-size-xs, .elementor-button-wrapper .elementor-button.elementor-size-md, .elementor-button-wrapper .elementor-button.elementor-size-lg, .elementor-button-wrapper .elementor-button.elementor-size-xl, .elementor-button-wrapper .elementor-button' => array(
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'tablet' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'tablet' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'tablet' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'tablet' ),
'border-top-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'top', 'tablet' ),
'border-top-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'right', 'tablet' ),
'border-bottom-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'tablet' ),
'border-bottom-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'left', 'tablet' ),
),
);
/* Parse CSS from array() */
$parse_css .= astra_parse_css( $ele_btn_default_tablet, '', astra_get_tablet_breakpoint() );
$ele_btn_default_mobile = array(
'.elementor-button-wrapper .elementor-button.elementor-size-sm, .elementor-button-wrapper .elementor-button.elementor-size-xs, .elementor-button-wrapper .elementor-button.elementor-size-md, .elementor-button-wrapper .elementor-button.elementor-size-lg, .elementor-button-wrapper .elementor-button.elementor-size-xl, .elementor-button-wrapper .elementor-button' => array(
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'mobile' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'mobile' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'mobile' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'mobile' ),
'border-top-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'top', 'mobile' ),
'border-top-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'right', 'mobile' ),
'border-bottom-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'mobile' ),
'border-bottom-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'left', 'mobile' ),
),
);
/* Parse CSS from array() */
$parse_css .= astra_parse_css( $ele_btn_default_mobile, '', astra_get_mobile_breakpoint() );
}
if ( 'color-typo' === self::elementor_default_color_font_setting() || 'color' === self::elementor_default_color_font_setting() ) {
// Check if Global Elementor - Theme Style - button color is set. If yes then remove ( :visited ) CSS for the compatibility.
if ( false === self::is_elementor_kit_button_color_set() ) {
$btn_text_color_selectors .= ' , .elementor-button-wrapper .elementor-button, .elementor-button-wrapper .elementor-button:visited';
} else {
$btn_text_color_selectors .= ' , .elementor-button-wrapper .elementor-button';
}
$ele_btn_color_builder_desktop = array(
'.elementor-button-wrapper .elementor-button' => array(
'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
'background-color' => esc_attr( $btn_bg_color ),
),
'.elementor-button-wrapper .elementor-button:hover, .elementor-button-wrapper .elementor-button:focus' => 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 ),
),
);
/* Parse CSS from array() */
$parse_css .= astra_parse_css( $ele_btn_color_builder_desktop );
}
$global_button_page_builder_text_color_desktop = array(
$btn_text_color_selectors => array(
'color' => esc_attr( $btn_text_color ),
),
);
/* Parse CSS from array() */
$parse_css .= astra_parse_css( $global_button_page_builder_text_color_desktop );
if ( 'color-typo' === self::elementor_default_color_font_setting() || 'typo' === self::elementor_default_color_font_setting() ) {
$ele_btn_typo_builder_desktop = array(
'.elementor-button-wrapper .elementor-button' => astra_get_font_array_css( astra_get_option( 'font-family-button' ), astra_get_option( 'font-weight-button' ), $theme_btn_font_size, 'font-extras-button' ),
'body .elementor-button.elementor-size-sm, body .elementor-button.elementor-size-xs, body .elementor-button.elementor-size-md, body .elementor-button.elementor-size-lg, body .elementor-button.elementor-size-xl, body .elementor-button' => array(
'font-size' => astra_responsive_font( $theme_btn_font_size, 'desktop' ),
),
);
/* Parse CSS from array() */
$parse_css .= astra_parse_css( $ele_btn_typo_builder_desktop );
}
$global_button_page_builder_desktop = array(
'.wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus' => 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 ),
),
);
if ( defined( 'ELEMENTOR_VERSION' ) ) {
$global_button_page_builder_desktop = array_merge(
$global_button_page_builder_desktop,
array(
'.elementor-widget-heading h1.elementor-heading-title' => array(
'line-height' => esc_attr( $h1_line_height ),
),
'.elementor-widget-heading h2.elementor-heading-title' => array(
'line-height' => esc_attr( $h2_line_height ),
),
'.elementor-widget-heading h3.elementor-heading-title' => array(
'line-height' => esc_attr( $h3_line_height ),
),
'.elementor-widget-heading h4.elementor-heading-title' => array(
'line-height' => esc_attr( $h4_line_height ),
),
'.elementor-widget-heading h5.elementor-heading-title' => array(
'line-height' => esc_attr( $h5_line_height ),
),
'.elementor-widget-heading h6.elementor-heading-title' => array(
'line-height' => esc_attr( $h6_line_height ),
),
)
);
}
if ( $block_editor_legacy_setup && self::gutenberg_core_patterns_compat() && ! astra_button_default_padding_updated() ) {
$theme_outline_gb_btn_top_border = ( isset( $global_custom_button_border_size['top'] ) && ( '' !== $global_custom_button_border_size['top'] && '0' !== $global_custom_button_border_size['top'] ) ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : '2px';
$theme_outline_gb_btn_right_border = ( isset( $global_custom_button_border_size['right'] ) && ( '' !== $global_custom_button_border_size['right'] && '0' !== $global_custom_button_border_size['right'] ) ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : '2px';
$theme_outline_gb_btn_bottom_border = ( isset( $global_custom_button_border_size['bottom'] ) && ( '' !== $global_custom_button_border_size['bottom'] && '0' !== $global_custom_button_border_size['bottom'] ) ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : '2px';
$theme_outline_gb_btn_left_border = ( isset( $global_custom_button_border_size['left'] ) && ( '' !== $global_custom_button_border_size['left'] && '0' !== $global_custom_button_border_size['left'] ) ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : '2px';
$global_button_page_builder_desktop['.wp-block-button .wp-block-button__link'] = array(
'border' => 'none',
'background-color' => esc_attr( $btn_bg_color ),
'color' => esc_attr( $btn_text_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 ),
'text-decoration' => esc_attr( $theme_btn_text_decoration ),
'letter-spacing' => esc_attr( $theme_btn_letter_spacing ),
'font-size' => astra_responsive_font( $theme_btn_font_size, 'desktop' ),
'padding' => '15px 30px',
'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' ),
);
$global_button_page_builder_desktop['.wp-block-button.is-style-outline .wp-block-button__link'] = array(
'border-style' => 'solid',
'border-top-width' => esc_attr( $theme_outline_gb_btn_top_border ),
'border-right-width' => esc_attr( $theme_outline_gb_btn_right_border ),
'border-left-width' => esc_attr( $theme_outline_gb_btn_left_border ),
'border-bottom-width' => esc_attr( $theme_outline_gb_btn_bottom_border ),
'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
'padding-top' => 'calc(15px - ' . (int) $theme_outline_gb_btn_top_border . 'px)',
'padding-right' => 'calc(30px - ' . (int) $theme_outline_gb_btn_right_border . 'px)',
'padding-bottom' => 'calc(15px - ' . (int) $theme_outline_gb_btn_bottom_border . 'px)',
'padding-left' => 'calc(30px - ' . (int) $theme_outline_gb_btn_left_border . 'px)',
);
$global_button_page_builder_tablet = array(
'.wp-block-button .wp-block-button__link' => array(
'font-size' => astra_responsive_font( $theme_btn_font_size, 'tablet' ),
'border' => 'none',
'padding' => '15px 30px',
),
'.wp-block-button.is-style-outline .wp-block-button__link' => array(
'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
),
);
$global_button_page_builder_mobile = array(
'.wp-block-button .wp-block-button__link' => array(
'font-size' => astra_responsive_font( $theme_btn_font_size, 'mobile' ),
'border' => 'none',
'padding' => '15px 30px',
),
'.wp-block-button.is-style-outline .wp-block-button__link' => array(
'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
),
);
} else {
$default_border_size = '0';
if ( astra_button_default_padding_updated() || ! $block_editor_legacy_setup ) {
$default_border_size = '';
}
$selector = '.wp-block-button .wp-block-button__link';
if ( ! $block_editor_legacy_setup ) {
$selector = $selector . ', .wp-block-search .wp-block-search__button, body .wp-block-file .wp-block-file__button';
}
$btn_top_border_size = ( isset( $global_custom_button_border_size['top'] ) && '' !== $global_custom_button_border_size['top'] ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : $default_border_size;
$btn_bottom_border_size = ( isset( $global_custom_button_border_size['bottom'] ) && '' !== $global_custom_button_border_size['bottom'] ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : $default_border_size;
$btn_right_border_size = ( isset( $global_custom_button_border_size['right'] ) && '' !== $global_custom_button_border_size['right'] ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : $default_border_size;
$btn_left_border_size = ( isset( $global_custom_button_border_size['left'] ) && '' !== $global_custom_button_border_size['left'] ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : $default_border_size;
$global_button_page_builder_desktop[ $selector ] = array(
'border-style' => ( $btn_top_border_size || $btn_right_border_size || $btn_left_border_size || $btn_bottom_border_size ) ? 'solid' : '',
'border-top-width' => $btn_top_border_size,
'border-right-width' => $btn_right_border_size,
'border-left-width' => $btn_left_border_size,
'border-bottom-width' => $btn_bottom_border_size,
'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
'background-color' => esc_attr( $btn_bg_color ),
'color' => esc_attr( $btn_text_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 ),
'text-decoration' => esc_attr( $theme_btn_text_decoration ),
'letter-spacing' => esc_attr( $theme_btn_letter_spacing ),
'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' ),
);
if ( $content_links_underline && $button_styling_improved ) {
$global_button_page_builder_desktop['.ast-single-post .entry-content .wp-block-button .wp-block-button__link, .ast-single-post .entry-content .wp-block-search .wp-block-search__button, body .entry-content .wp-block-file .wp-block-file__button'] = array(
'text-decoration' => '' === $theme_btn_text_decoration || 'initial' === $theme_btn_text_decoration ? 'none' : esc_attr( $theme_btn_text_decoration ),
);
}
$global_button_page_builder_tablet = array(
$selector => array(
'font-size' => astra_responsive_font( $theme_btn_font_size, 'tablet' ),
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'tablet' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'tablet' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'tablet' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'tablet' ),
'border-top-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'top', 'tablet' ),
'border-top-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'right', 'tablet' ),
'border-bottom-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'tablet' ),
'border-bottom-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'left', 'tablet' ),
),
);
$global_button_page_builder_mobile = array(
$selector => array(
'font-size' => astra_responsive_font( $theme_btn_font_size, 'mobile' ),
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'mobile' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'mobile' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'mobile' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'mobile' ),
'border-top-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'top', 'mobile' ),
'border-top-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'right', 'mobile' ),
'border-bottom-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'mobile' ),
'border-bottom-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'left', 'mobile' ),
),
);
}
/* Parse CSS from array() */
$parse_css .= astra_parse_css( $global_button_page_builder_desktop );
/* Parse CSS from array() */
$parse_css .= astra_parse_css( $global_button_page_builder_tablet, '', astra_get_tablet_breakpoint() );
/* Parse CSS from array() */
$parse_css .= astra_parse_css( $global_button_page_builder_mobile, '', astra_get_mobile_breakpoint() );
} else {
$search_button_selector = $is_wp_5_8_support_enabled ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button' : '';
$search_button_hover_selector = $is_wp_5_8_support_enabled ? ', form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:hover, form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:focus' : '';
/**
* Global button CSS - Desktop.
*/
$global_button_desktop = array(
'.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"]' . $search_button_selector => array(
'color' => esc_attr( $btn_text_color ),
'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
'background-color' => esc_attr( $btn_bg_color ),
'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' ),
'font-family' => astra_get_font_family( $theme_btn_font_family ),
'font-weight' => esc_attr( $theme_btn_font_weight ),
'font-size' => astra_get_font_css_value( $theme_btn_font_size['desktop'], $theme_btn_font_size['desktop-unit'] ),
'text-transform' => esc_attr( $theme_btn_text_transform ),
'text-decoration' => esc_attr( $theme_btn_text_decoration ),
'letter-spacing' => esc_attr( $theme_btn_letter_spacing ),
),
'button:focus, .menu-toggle:hover, button:hover, .ast-button:hover, .ast-custom-button:hover .button:hover, .ast-custom-button:hover, input[type=reset]:hover, input[type=reset]:focus, input#submit:hover, input#submit:focus, input[type="button"]:hover, input[type="button"]:focus, input[type="submit"]:hover, input[type="submit"]:focus' . $search_button_hover_selector => 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 ),
),
);
/**
* Global button CSS - Tablet.
*/
$global_button_tablet = array(
'.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"]' . $search_button_selector => array(
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'tablet' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'tablet' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'tablet' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'tablet' ),
'font-size' => astra_responsive_font( $theme_btn_font_size, 'tablet' ),
'border-top-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'top', 'tablet' ),
'border-top-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'right', 'tablet' ),
'border-bottom-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'tablet' ),
'border-bottom-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'left', 'tablet' ),
),
);
/**
* Global button CSS - Mobile.
*/
$global_button_mobile = array(
'.menu-toggle, button, .ast-button, .ast-custom-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"]' . $search_button_selector => array(
'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'mobile' ),
'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'mobile' ),
'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'mobile' ),
'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'mobile' ),
'font-size' => astra_responsive_font( $theme_btn_font_size, 'mobile' ),
'border-top-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'top', 'mobile' ),
'border-top-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'right', 'mobile' ),
'border-bottom-right-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'bottom', 'mobile' ),
'border-bottom-left-radius' => astra_responsive_spacing( $btn_border_radius_fields, 'left', 'mobile' ),
),
);
}
if ( true === $update_customizer_strctural_defaults ) {
$global_button_desktop['form[CLASS*="wp-block-search__"].wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button.has-icon'] = array(
'padding-top' => 'calc(' . astra_responsive_spacing( $theme_btn_padding, 'top', 'desktop' ) . ' - 3px)',
'padding-right' => 'calc(' . astra_responsive_spacing( $theme_btn_padding, 'right', 'desktop' ) . ' - 3px)',
'padding-bottom' => 'calc(' . astra_responsive_spacing( $theme_btn_padding, 'bottom', 'desktop' ) . ' - 3px)',
'padding-left' => 'calc(' . astra_responsive_spacing( $theme_btn_padding, 'left', 'desktop' ) . ' - 3px)',
);
}
/* Parse CSS from array() */
$parse_css .= astra_parse_css( $global_button_desktop );
$parse_css .= astra_parse_css( $global_button_tablet, '', astra_get_tablet_breakpoint() );
$parse_css .= astra_parse_css( $global_button_mobile, '', astra_get_mobile_breakpoint() );
/* Parse CSS from array() -> min-width: (tablet-breakpoint) px CSS */
if ( empty( $site_content_width ) ) {
$container_min_tablet_css = array(
'.ast-container' => array(
'max-width' => '100%',
),
);
$parse_css .= astra_parse_css( $container_min_tablet_css, astra_get_tablet_breakpoint() );
}
$container_min_mobile_css = array(
'.ast-container' => array(
'max-width' => '100%',
),
);
/**
* Global button CSS - -> max-width: (tablet-breakpoint) px.
*/
$global_button_tablet = array(
'.menu-toggle, button, .ast-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"]' => array(
'font-size' => astra_get_font_css_value( $theme_btn_font_size['tablet'], $theme_btn_font_size['tablet-unit'] ),
),
'.ast-mobile-header-stack .main-header-bar .ast-search-menu-icon' => array(
'display' => 'inline-block',
),
'.ast-header-break-point.ast-header-custom-item-outside .ast-mobile-header-stack .main-header-bar .ast-search-icon' => array(
'margin' => '0',
),
'.ast-comment-avatar-wrap img' => array(
'max-width' => '2.5em',
),
'.ast-comment-meta' => array(
'padding' => '0 1.8888em 1.3333em',
),
);
if ( ! self::astra_4_6_0_compatibility() ) {
$global_button_tablet['.ast-separate-container .ast-comment-list li.depth-1'] = array(
'padding' => '1.5em 2.14em',
);
$global_button_tablet['.ast-separate-container .comment-respond'] = array(
'padding' => '2em 2.14em',
);
}
/* Parse CSS from array() -> max-width: (tablet-breakpoint) px CSS */
$parse_css .= astra_parse_css( $global_button_tablet, '', astra_get_tablet_breakpoint() );
/* Parse CSS from array() -> min-width: (mobile-breakpoint) px CSS */
$parse_css .= astra_parse_css( $container_min_mobile_css, astra_get_mobile_breakpoint() );
$global_button_mobile = array(
'.ast-separate-container .ast-article-post, .ast-separate-container .ast-article-single, .ast-separate-container .comments-title, .ast-separate-container .ast-archive-description' => array(
'padding' => '1.5em 1em',
),
'.ast-separate-container #content .ast-container' => array(
'padding-left' => '0.54em',
'padding-right' => '0.54em',
),
'.ast-separate-container .ast-comment-list .bypostauthor' => array(
'padding' => '.5em',
),
'.ast-search-menu-icon.ast-dropdown-active .search-field' => array(
'width' => '170px',
),
'.menu-toggle, button, .ast-button, .button, input#submit, input[type="button"], input[type="submit"], input[type="reset"]' => array(
'font-size' => astra_get_font_css_value( $theme_btn_font_size['mobile'], $theme_btn_font_size['mobile-unit'] ),
),
);
if ( ! self::astra_4_6_0_compatibility() ) {
$global_button_tablet['.ast-separate-container .ast-comment-list li.depth-1'] = array(
'padding' => '1.5em 1em',
'margin-bottom' => '1.5em',
);
}
if ( 'no-sidebar' !== astra_page_layout() ) {
$global_button_mobile['.ast-separate-container #secondary'] = array(
'padding-top' => 0,
);
$global_button_mobile['.ast-separate-container.ast-two-container #secondary .widget'] = array(
'margin-bottom' => '1.5em',
'padding-left' => '1em',
'padding-right' => '1em',
);
}
// Add/Remove logo max-width: 100%; CSS for logo in old header layout.
if ( false === Astra_Builder_Helper::$is_header_footer_builder_active && false === self::remove_logo_max_width_mobile_static_css() ) {
$global_button_mobile['.site-branding img, .site-header .site-logo-img .custom-logo-link img'] = array(
'max-width' => '100%',
);
}
/* Parse CSS from array() -> max-width: (mobile-breakpoint) px */
$parse_css .= astra_parse_css( $global_button_mobile, '', astra_get_mobile_breakpoint() );
if ( Astra_Builder_Helper::is_component_loaded( 'search', 'header', 'mobile' ) ) {
if ( $is_site_rtl ) {
$global_button_tablet_lang_direction_css = array(
'.ast-header-break-point .ast-search-menu-icon.slide-search .search-form' => array(
'left' => '0',
),
'.ast-header-break-point .ast-mobile-header-stack .ast-search-menu-icon.slide-search .search-form' => array(
'left' => '-1em',
),
);
} else {
$global_button_tablet_lang_direction_css = array(
'.ast-header-break-point .ast-search-menu-icon.slide-search .search-form' => array(
'right' => '0',
),
'.ast-header-break-point .ast-mobile-header-stack .ast-search-menu-icon.slide-search .search-form' => array(
'right' => '-1em',
),
);
}
$parse_css .= astra_parse_css( $global_button_tablet_lang_direction_css, '', astra_get_tablet_breakpoint() );
}
if ( false === Astra_Builder_Helper::$is_header_footer_builder_active && 'custom-button' === $header_custom_button_style ) {
$css_output = array(
// Header button typography stylings.
'.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button, .ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' => array(
'font-family' => astra_get_font_family( $header_custom_btn_font_family ),
'font-weight' => esc_attr( $header_custom_btn_font_weight ),
'font-size' => astra_responsive_font( $header_custom_btn_font_size, 'desktop' ),
'line-height' => esc_attr( $header_custom_btn_line_height ),
'text-transform' => esc_attr( $header_custom_btn_text_transform ),
'letter-spacing' => astra_get_css_value( $header_custom_btn_letter_spacing, 'px' ),
),
// Custom menu item button - Default.
'.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' => array(
'color' => esc_attr( $header_custom_button_text_color ),
'background-color' => esc_attr( $header_custom_button_back_color ),
'padding-top' => astra_responsive_spacing( $header_custom_button_spacing, 'top', 'desktop' ),
'padding-bottom' => astra_responsive_spacing( $header_custom_button_spacing, 'bottom', 'desktop' ),
'padding-left' => astra_responsive_spacing( $header_custom_button_spacing, 'left', 'desktop' ),
'padding-right' => astra_responsive_spacing( $header_custom_button_spacing, 'right', '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' ),
'border-style' => 'solid',
'border-color' => esc_attr( $header_custom_button_border_color ),
'border-top-width' => ( isset( $header_custom_button_border_size['top'] ) && '' !== $header_custom_button_border_size['top'] ) ? astra_get_css_value( $header_custom_button_border_size['top'], 'px' ) : '0px',
'border-right-width' => ( isset( $header_custom_button_border_size['right'] ) && '' !== $header_custom_button_border_size['right'] ) ? astra_get_css_value( $header_custom_button_border_size['right'], 'px' ) : '0px',
'border-left-width' => ( isset( $header_custom_button_border_size['left'] ) && '' !== $header_custom_button_border_size['left'] ) ? astra_get_css_value( $header_custom_button_border_size['left'], 'px' ) : '0px',
'border-bottom-width' => ( isset( $header_custom_button_border_size['bottom'] ) && '' !== $header_custom_button_border_size['bottom'] ) ? astra_get_css_value( $header_custom_button_border_size['bottom'], 'px' ) : '0px',
),
'.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button:hover' => array(
'color' => esc_attr( $header_custom_button_text_h_color ),
'background-color' => esc_attr( $header_custom_button_back_h_color ),
'border-color' => esc_attr( $header_custom_button_border_h_color ),
),
// Custom menu item button - Transparent.
'.ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' => array(
'color' => esc_attr( $header_custom_trans_button_text_color ),
'background-color' => esc_attr( $header_custom_trans_button_back_color ),
'padding-top' => astra_responsive_spacing( $header_custom_trans_button_spacing, 'top', 'desktop' ),
'padding-bottom' => astra_responsive_spacing( $header_custom_trans_button_spacing, 'bottom', 'desktop' ),
'padding-left' => astra_responsive_spacing( $header_custom_trans_button_spacing, 'left', 'desktop' ),
'padding-right' => astra_responsive_spacing( $header_custom_trans_button_spacing, 'right', 'desktop' ),
'border-radius' => astra_get_css_value( $header_custom_trans_button_radius, 'px' ),
'border-style' => 'solid',
'border-color' => esc_attr( $header_custom_trans_button_border_color ),
'border-top-width' => ( isset( $header_custom_trans_button_border_size['top'] ) && '' !== $header_custom_trans_button_border_size['top'] ) ? astra_get_css_value( $header_custom_trans_button_border_size['top'], 'px' ) : '',
'border-right-width' => ( isset( $header_custom_trans_button_border_size['right'] ) && '' !== $header_custom_trans_button_border_size['right'] ) ? astra_get_css_value( $header_custom_trans_button_border_size['right'], 'px' ) : '',
'border-left-width' => ( isset( $header_custom_trans_button_border_size['left'] ) && '' !== $header_custom_trans_button_border_size['left'] ) ? astra_get_css_value( $header_custom_trans_button_border_size['left'], 'px' ) : '',
'border-bottom-width' => ( isset( $header_custom_trans_button_border_size['bottom'] ) && '' !== $header_custom_trans_button_border_size['bottom'] ) ? astra_get_css_value( $header_custom_trans_button_border_size['bottom'], 'px' ) : '',
),
'.ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button:hover' => array(
'color' => esc_attr( $header_custom_trans_button_text_h_color ),
'background-color' => esc_attr( $header_custom_trans_button_back_h_color ),
'border-color' => esc_attr( $header_custom_trans_button_border_h_color ),
),
);
/* Parse CSS from array() */
$parse_css .= astra_parse_css( $css_output );
/* Parse CSS from array()*/
/* Custom Menu Item Button */
$custom_button_css = array(
'.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' => array(
'font-size' => astra_responsive_font( $header_custom_btn_font_size, 'tablet' ),
'padding-top' => astra_responsive_spacing( $header_custom_button_spacing, 'top', 'tablet' ),
'padding-bottom' => astra_responsive_spacing( $header_custom_button_spacing, 'bottom', 'tablet' ),
'padding-left' => astra_responsive_spacing( $header_custom_button_spacing, 'left', 'tablet' ),
'padding-right' => astra_responsive_spacing( $header_custom_button_spacing, 'right', 'tablet' ),
),
);
$custom_trans_button_css = array(
'.ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' => array(
'font-size' => astra_responsive_font( $header_custom_btn_font_size, 'tablet' ),
'padding-top' => astra_responsive_spacing( $header_custom_trans_button_spacing, 'top', 'tablet' ),
'padding-bottom' => astra_responsive_spacing( $header_custom_trans_button_spacing, 'bottom', 'tablet' ),
'padding-left' => astra_responsive_spacing( $header_custom_trans_button_spacing, 'left', 'tablet' ),
'padding-right' => astra_responsive_spacing( $header_custom_trans_button_spacing, 'right', 'tablet' ),
),
);
/* Parse CSS from array()*/
$parse_css .= astra_parse_css( array_merge( $custom_button_css, $custom_trans_button_css ), '', astra_get_tablet_breakpoint() );
/* Custom Menu Item Button */
$custom_button = array(
'.main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' => array(
'font-size' => astra_responsive_font( $header_custom_btn_font_size, 'mobile' ),
'padding-top' => astra_responsive_spacing( $header_custom_button_spacing, 'top', 'mobile' ),
'padding-bottom' => astra_responsive_spacing( $header_custom_button_spacing, 'bottom', 'mobile' ),
'padding-left' => astra_responsive_spacing( $header_custom_button_spacing, 'left', 'mobile' ),
'padding-right' => astra_responsive_spacing( $header_custom_button_spacing, 'right', 'mobile' ),
),
);
$custom_trans_button = array(
'.ast-theme-transparent-header .main-header-bar .button-custom-menu-item .ast-custom-button-link .ast-custom-button' => array(
'font-size' => astra_responsive_font( $header_custom_btn_font_size, 'mobile' ),
'padding-top' => astra_responsive_spacing( $header_custom_trans_button_spacing, 'top', 'mobile' ),
'padding-bottom' => astra_responsive_spacing( $header_custom_trans_button_spacing, 'bottom', 'mobile' ),
'padding-left' => astra_responsive_spacing( $header_custom_trans_button_spacing, 'left', 'mobile' ),
'padding-right' => astra_responsive_spacing( $header_custom_trans_button_spacing, 'right', 'mobile' ),
),
);
/* Parse CSS from array()*/
$parse_css .= astra_parse_css( array_merge( $custom_button, $custom_trans_button ), '', astra_get_mobile_breakpoint() );
}
if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) {
// Foreground color.
if ( ! empty( $footer_adv_link_color ) ) {
$footer_adv_tagcloud = array(
'.footer-adv .tagcloud a:hover, .footer-adv .tagcloud a.current-item' => array(
'color' => astra_get_foreground_color( $footer_adv_link_color ),
),
'.footer-adv .calendar_wrap #today' => array(
'color' => astra_get_foreground_color( $footer_adv_link_color ),
),
);
$parse_css .= astra_parse_css( $footer_adv_tagcloud );
}
}
/* Width for Footer */
if ( false === Astra_Builder_Helper::$is_header_footer_builder_active && 'content' != $astra_footer_width ) {
$genral_global_responsive = array(
'.ast-small-footer .ast-container' => array(
'max-width' => '100%',
'padding-left' => '35px',
'padding-right' => '35px',
),
);
/* Parse CSS from array()*/
$parse_css .= astra_parse_css( $genral_global_responsive, astra_get_tablet_breakpoint( '', 1 ) );
}
/* Preventing link redirection when the cart is clicked */
if ( 'redirect' !== astra_get_option( 'responsive-cart-click-action' ) ) {
$desktop_cart_link_event = array(
' #ast-mobile-header .ast-site-header-cart-li a' => array(
'pointer-events' => 'none',
),
);
/* Parse CSS from array()*/
$parse_css .= astra_parse_css( $desktop_cart_link_event );
}
/* Preventing link redirection when the cart is clicked */
if ( is_customize_preview() && 'redirect' !== astra_get_option( 'woo-header-cart-click-action' ) ) {
$responsive_cart_link_event = array(
' #ast-desktop-header .ast-site-header-cart-li a' => array(
'pointer-events' => 'none',
),
);
/* Parse CSS from array()*/
$parse_css .= astra_parse_css( $responsive_cart_link_event );
}
/* Width for Comments for Full Width / Stretched Template */
if ( 'page-builder' == $container_layout ) {
$page_builder_comment = array(
'.ast-page-builder-template .comments-area, .single.ast-page-builder-template .entry-header, .single.ast-page-builder-template .post-navigation, .single.ast-page-builder-template .ast-single-related-posts-container' => array(
'max-width' => astra_get_css_value( $site_content_width + 40, 'px' ),
'margin-left' => 'auto',
'margin-right' => 'auto',
),
);
/* Parse CSS from array()*/
$parse_css .= astra_parse_css( $page_builder_comment, astra_get_mobile_breakpoint( '', 1 ) );
}
$astra_spearate_container_selector = 'body, .ast-separate-container';
if ( astra_has_gcp_typo_preset_compatibility() && true === astra_apply_content_background_fullwidth_layouts() ) {
$astra_spearate_container_selector = '.ast-separate-container';
}
$separate_container_css = array(
$astra_spearate_container_selector => astra_get_responsive_background_obj( $box_bg_obj, 'desktop' ),
);
$parse_css .= astra_parse_css( $separate_container_css );
if ( $block_editor_legacy_setup ) {
/**
* Added new compatibility & layout designs for core block layouts.
* - Compatibility for alignwide, alignfull, default width.
*
* @since 3.7.4
*/
$entry_content_selector = '.entry-content';
if ( true === $improve_gb_ui ) {
$entry_content_selector = '.entry-content >';
$core_blocks_width_desktop_ui_css = array(
'.entry-content > .wp-block-group, .entry-content > .wp-block-media-text, .entry-content > .wp-block-cover, .entry-content > .wp-block-columns' => array(
'max-width' => '58em',
'width' => 'calc(100% - 4em)',
'margin-left' => 'auto',
'margin-right' => 'auto',
),
'.entry-content [class*="__inner-container"] > .alignfull' => array(
'max-width' => '100%',
'margin-left' => 0,
'margin-right' => 0,
),
'.entry-content [class*="__inner-container"] > *:not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright)' => array(
'margin-left' => 'auto',
'margin-right' => 'auto',
),
'.entry-content [class*="__inner-container"] > *:not(.alignwide):not(p):not(.alignfull):not(.alignleft):not(.alignright):not(.is-style-wide):not(iframe)' => array(
'max-width' => '50rem',
'width' => '100%',
),
);
/* Parse CSS from array -> Desktop CSS. */
$parse_css .= astra_parse_css( $core_blocks_width_desktop_ui_css );
$core_blocks_min_width_tablet_ui_css = array(
'.entry-content > .wp-block-group.alignwide.has-background, .entry-content > .wp-block-group.alignfull.has-background, .entry-content > .wp-block-cover.alignwide, .entry-content > .wp-block-cover.alignfull, .entry-content > .wp-block-columns.has-background.alignwide, .entry-content > .wp-block-columns.has-background.alignfull' => array(
'margin-top' => '0',
'margin-bottom' => '0',
'padding' => '6em 4em',
),
'.entry-content > .wp-block-columns.has-background' => array(
'margin-bottom' => '0',
),
);
/* Parse CSS from array -> min-width(tablet-breakpoint) */
$parse_css .= astra_parse_css( $core_blocks_min_width_tablet_ui_css, astra_get_tablet_breakpoint() );
$core_blocks_min_width_1200_ui_css = array(
'.entry-content .alignfull p' => array(
'max-width' => astra_get_css_value( $site_content_width, 'px' ),
),
'.entry-content .alignfull' => array(
'max-width' => '100%',
'width' => '100%',
),
'.ast-page-builder-template .entry-content .alignwide, .entry-content [class*="__inner-container"] > .alignwide' => array(
'max-width' => astra_get_css_value( $site_content_width, 'px' ),
'margin-left' => '0',
'margin-right' => '0',
),
'.entry-content .alignfull [class*="__inner-container"] > .alignwide' => array(
'max-width' => '80rem',
),
);
/* Parse CSS from array -> min-width( 1200px ) */
$parse_css .= astra_parse_css( $core_blocks_min_width_1200_ui_css, '1200' );
$core_blocks_min_width_mobile_ui_css = array(
'.site-main .entry-content > .alignwide' => array(
'margin' => '0 auto',
),
'.wp-block-group.has-background, .entry-content > .wp-block-cover, .entry-content > .wp-block-columns.has-background' => array(
'padding' => '4em',
'margin-top' => '0',
'margin-bottom' => '0',
),
'.entry-content .wp-block-media-text.alignfull .wp-block-media-text__content, .entry-content .wp-block-media-text.has-background .wp-block-media-text__content' => array(
'padding' => '0 8%',
),
);
/* Parse CSS from array -> min-width(mobile-breakpoint + 1) */
$parse_css .= astra_parse_css( $core_blocks_min_width_mobile_ui_css, astra_get_mobile_breakpoint( '', 1 ) );
} else {
$astra_no_sidebar_layout_css =
'.ast-no-sidebar.ast-separate-container ' . $entry_content_selector . ' .alignfull {
margin-left: -6.67em;
margin-right: -6.67em;
width: auto;
}
@media (max-width: 1200px) {
.ast-no-sidebar.ast-separate-container ' . $entry_content_selector . ' .alignfull {
margin-left: -2.4em;
margin-right: -2.4em;
}
}
@media (max-width: 768px) {
.ast-no-sidebar.ast-separate-container ' . $entry_content_selector . ' .alignfull {
margin-left: -2.14em;
margin-right: -2.14em;
}
}
@media (max-width: 544px) {
.ast-no-sidebar.ast-separate-container ' . $entry_content_selector . ' .alignfull {
margin-left: -1em;
margin-right: -1em;
}
}
.ast-no-sidebar.ast-separate-container ' . $entry_content_selector . ' .alignwide {
margin-left: -20px;
margin-right: -20px;
}
.ast-no-sidebar.ast-separate-container ' . $entry_content_selector . ' .wp-block-column .alignfull,
.ast-no-sidebar.ast-separate-container ' . $entry_content_selector . ' .wp-block-column .alignwide {
margin-left: auto;
margin-right: auto;
width: 100%;
}
';
$parse_css .= Astra_Enqueue_Scripts::trim_css( $astra_no_sidebar_layout_css );
}
}
$tablet_typo = array();
if ( isset( $body_font_size['tablet'] ) && '' != $body_font_size['tablet'] ) {
$tablet_typo = array(
// Widget Title.
'.widget-title' => array(
'font-size' => astra_get_font_css_value( (int) $body_font_size['tablet'] * 1.428571429, 'px', 'tablet' ),
),
);
}
/* Tablet Typography */
$tablet_typography = array(
'body, button, input, select, textarea, .ast-button, .ast-custom-button' => array(
'font-size' => astra_responsive_font( $body_font_size, 'tablet' ),
),
'#secondary, #secondary button, #secondary input, #secondary select, #secondary textarea' => array(
'font-size' => astra_responsive_font( $body_font_size, 'tablet' ),
),
'.site-title' => array(
'font-size' => astra_responsive_font( $site_title_font_size, 'tablet' ),
'display' => esc_attr( $tablet_title_visibility ),
),
'.site-header .site-description' => array(
'font-size' => astra_responsive_font( $site_tagline_font_size, 'tablet' ),
'display' => esc_attr( $tablet_tagline_visibility ),
),
'.entry-title' => array(
'font-size' => astra_responsive_font( $archive_post_title_font_size, 'tablet' ),
),
'.ast-blog-single-element.ast-taxonomy-container a' => array(
'font-size' => astra_responsive_font( $archive_post_tax_font_size, 'tablet' ),
),
'.ast-blog-meta-container' => array(
'font-size' => astra_responsive_font( $archive_post_meta_font_size, 'tablet' ),
),
'blog-layout-4' === $blog_layout ? '.archive .ast-article-post .ast-article-inner, .blog .ast-article-post .ast-article-inner' : '.archive .ast-article-post, .ast-article-post .post-thumb-img-content, .ast-blog-layout-6-grid .ast-article-inner .post-thumb::after, .blog .ast-article-post' => array(
'border-top-left-radius' => astra_responsive_spacing( $archive_cards_radius, 'top', 'tablet' ),
'border-top-right-radius' => astra_responsive_spacing( $archive_cards_radius, 'right', 'tablet' ),
'border-bottom-right-radius' => astra_responsive_spacing( $archive_cards_radius, 'bottom', 'tablet' ),
'border-bottom-left-radius' => astra_responsive_spacing( $archive_cards_radius, 'left', 'tablet' ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h1, .entry-content h1, .entry-content h1 a',
'h1, .entry-content h1'
) => array(
'font-size' => astra_responsive_font( $heading_h1_font_size, 'tablet', $heading_font_size_comp ? '' : 30 ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h2, .entry-content h2, .entry-content h2 a',
'h2, .entry-content h2'
) => array(
'font-size' => astra_responsive_font( $heading_h2_font_size, 'tablet', $heading_font_size_comp ? '' : 25 ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h3, .entry-content h3, .entry-content h3 a',
'h3, .entry-content h3'
) => array(
'font-size' => astra_responsive_font( $heading_h3_font_size, 'tablet', $heading_font_size_comp ? '' : 20 ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h4, .entry-content h4, .entry-content h4 a',
'h4, .entry-content h4'
) => array(
'font-size' => astra_responsive_font( $heading_h4_font_size, 'tablet' ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h5, .entry-content h5, .entry-content h5 a',
'h5, .entry-content h5'
) => array(
'font-size' => astra_responsive_font( $heading_h5_font_size, 'tablet' ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h6, .entry-content h6, .entry-content h6 a',
'h6, .entry-content h6'
) => array(
'font-size' => astra_responsive_font( $heading_h6_font_size, 'tablet' ),
),
'.astra-logo-svg' => array(
'width' => astra_get_css_value( $header_logo_width['tablet'], 'px' ),
),
'.astra-logo-svg:not(.sticky-custom-logo .astra-logo-svg, .transparent-custom-logo .astra-logo-svg, .advanced-header-logo .astra-logo-svg)' => array(
'height' => astra_get_css_value( ( ! empty( $header_logo_width['tablet-svg-height'] ) && ! is_customize_preview() ) ? $header_logo_width['tablet-svg-height'] : '', 'px' ),
),
is_customize_preview() ? '.ast-sg-logo-section .custom-logo-link img, header .custom-logo-link img, .ast-header-break-point .site-logo-img .custom-mobile-logo-link img' : 'header .custom-logo-link img, .ast-header-break-point .site-logo-img .custom-mobile-logo-link img' => array(
'max-width' => astra_get_css_value( $header_logo_width['tablet'], 'px' ),
'width' => astra_get_css_value( $header_logo_width['tablet'], 'px' ),
),
'body, .ast-separate-container' => astra_get_responsive_background_obj( $box_bg_obj, 'tablet' ),
);
/* Parse CSS from array()*/
$parse_css .= astra_parse_css( array_merge( $tablet_typo, $tablet_typography ), '', astra_get_tablet_breakpoint() );
$mobile_typo = array();
if ( isset( $body_font_size['mobile'] ) && '' != $body_font_size['mobile'] ) {
$mobile_typo = array(
// Widget Title.
'.widget-title' => array(
'font-size' => astra_get_font_css_value( (int) $body_font_size['mobile'] * 1.428571429, 'px', 'mobile' ),
),
);
}
/* Mobile Typography */
$mobile_typography = array(
'body, button, input, select, textarea, .ast-button, .ast-custom-button' => array(
'font-size' => astra_responsive_font( $body_font_size, 'mobile' ),
),
'#secondary, #secondary button, #secondary input, #secondary select, #secondary textarea' => array(
'font-size' => astra_responsive_font( $body_font_size, 'mobile' ),
),
'.site-title' => array(
'font-size' => astra_responsive_font( $site_title_font_size, 'mobile' ),
'display' => esc_attr( $mobile_title_visibility ),
),
'.site-header .site-description' => array(
'font-size' => astra_responsive_font( $site_tagline_font_size, 'mobile' ),
'display' => esc_attr( $mobile_tagline_visibility ),
),
'.entry-title' => array(
'font-size' => astra_responsive_font( $archive_post_title_font_size, 'mobile' ),
),
'.ast-blog-single-element.ast-taxonomy-container a' => array(
'font-size' => astra_responsive_font( $archive_post_tax_font_size, 'mobile' ),
),
'.ast-blog-meta-container' => array(
'font-size' => astra_responsive_font( $archive_post_meta_font_size, 'mobile' ),
),
'blog-layout-4' === $blog_layout ? '.archive .ast-article-post .ast-article-inner, .blog .ast-article-post .ast-article-inner' : '.archive .ast-article-post, .ast-article-post .post-thumb-img-content, .ast-blog-layout-6-grid .ast-article-inner .post-thumb::after, .blog .ast-article-post' => array(
'border-top-left-radius' => astra_responsive_spacing( $archive_cards_radius, 'top', 'mobile' ),
'border-top-right-radius' => astra_responsive_spacing( $archive_cards_radius, 'right', 'mobile' ),
'border-bottom-right-radius' => astra_responsive_spacing( $archive_cards_radius, 'bottom', 'mobile' ),
'border-bottom-left-radius' => astra_responsive_spacing( $archive_cards_radius, 'left', 'mobile' ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h1, .entry-content h1, .entry-content h1 a',
'h1, .entry-content h1'
) => array(
'font-size' => astra_responsive_font( $heading_h1_font_size, 'mobile', $heading_font_size_comp ? '' : 30 ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h2, .entry-content h2, .entry-content h2 a',
'h2, .entry-content h2'
) => array(
'font-size' => astra_responsive_font( $heading_h2_font_size, 'mobile', $heading_font_size_comp ? '' : 25 ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h3, .entry-content h3, .entry-content h3 a',
'h3, .entry-content h3'
) => array(
'font-size' => astra_responsive_font( $heading_h3_font_size, 'mobile', $heading_font_size_comp ? '' : 20 ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h4, .entry-content h4, .entry-content h4 a',
'h4, .entry-content h4'
) => array(
'font-size' => astra_responsive_font( $heading_h4_font_size, 'mobile' ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h5, .entry-content h5, .entry-content h5 a',
'h5, .entry-content h5'
) => array(
'font-size' => astra_responsive_font( $heading_h5_font_size, 'mobile' ),
),
// Conditionally select the css selectors with or without achors.
self::conditional_headings_css_selectors(
'h6, .entry-content h6, .entry-content h6 a',
'h6, .entry-content h6'
) => array(
'font-size' => astra_responsive_font( $heading_h6_font_size, 'mobile' ),
),
is_customize_preview() ? '.ast-sg-logo-section .custom-logo-link img, header .custom-logo-link img, .ast-header-break-point .site-branding img, .ast-header-break-point .custom-logo-link img' : 'header .custom-logo-link img, .ast-header-break-point .site-branding img, .ast-header-break-point .custom-logo-link img' => array(
'max-width' => astra_get_css_value( $header_logo_width['mobile'], 'px' ),
'width' => astra_get_css_value( $header_logo_width['mobile'], 'px' ),
),
'.astra-logo-svg' => array(
'width' => astra_get_css_value( $header_logo_width['mobile'], 'px' ),
),
'.astra-logo-svg:not(.sticky-custom-logo .astra-logo-svg, .transparent-custom-logo .astra-logo-svg, .advanced-header-logo .astra-logo-svg)' => array(
'height' => astra_get_css_value( ( ! empty( $header_logo_width['mobile-svg-height'] ) && ! is_customize_preview() ) ? $header_logo_width['mobile-svg-height'] : '', 'px' ),
),
'.ast-header-break-point .site-logo-img .custom-mobile-logo-link img' => array(
'max-width' => astra_get_css_value( $header_logo_width['mobile'], 'px' ),
),
'body, .ast-separate-container' => astra_get_responsive_background_obj( $box_bg_obj, 'mobile' ),
);
/* Parse CSS from array()*/
$parse_css .= astra_parse_css( array_merge( $mobile_typo, $mobile_typography ), '', astra_get_mobile_breakpoint() );
/*
* Responsive Font Size for Tablet & Mobile to the root HTML element
*/
// Tablet Font Size for HTML tag.
if ( '' == $body_font_size['tablet'] ) {
$html_tablet_typography = array(
'html' => array(
'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 5.7, '%' ),
),
);
$parse_css .= astra_parse_css( $html_tablet_typography, '', astra_get_tablet_breakpoint() );
}
// Mobile Font Size for HTML tag.
if ( '' == $body_font_size['mobile'] ) {
$html_mobile_typography = array(
'html' => array(
'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 5.7, '%' ),
),
);
} else {
$html_mobile_typography = array(
'html' => array(
'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 6.25, '%' ),
),
);
}
/* Parse CSS from array()*/
$parse_css .= astra_parse_css( $html_mobile_typography, '', astra_get_mobile_breakpoint() );
/* Site width Responsive */
$site_width = array(
'.ast-container' => array(
'max-width' => astra_get_css_value( $site_content_width + 40, 'px' ),
),
);
/* Parse CSS from array()*/
$parse_css .= astra_parse_css( $site_width, astra_get_tablet_breakpoint( '', 1 ) );
/* Narrow width container layout dynamic css */
$parse_css .= astra_narrow_container_width( astra_get_content_layout(), $narrow_container_max_width );
// Page Meta.
$parse_css .= astra_narrow_container_width( astra_get_content_layout(), $narrow_container_max_width );
if ( Astra_Builder_Helper::apply_flex_based_css() ) {
$max_site_container_css = array(
'.site-content .ast-container' => array(
'display' => 'flex',
),
);
$parse_css .= astra_parse_css( $max_site_container_css, astra_get_tablet_breakpoint( '', 1 ) );
$min_site_container_css = array(
'.site-content .ast-container' => array(
'flex-direction' => 'column',
),
);
$parse_css .= astra_parse_css( $min_site_container_css, '', astra_get_tablet_breakpoint() );
}
/**
* Astra Fonts
*/
if ( apply_filters( 'astra_enable_default_fonts', true ) ) {
$astra_fonts = '@font-face {';
$astra_fonts .= 'font-family: "Astra";';
$astra_fonts .= 'src: url(' . ASTRA_THEME_URI . 'assets/fonts/astra.woff) format("woff"),';
$astra_fonts .= 'url(' . ASTRA_THEME_URI . 'assets/fonts/astra.ttf) format("truetype"),';
$astra_fonts .= 'url(' . ASTRA_THEME_URI . 'assets/fonts/astra.svg#astra) format("svg");';
$astra_fonts .= 'font-weight: normal;';
$astra_fonts .= 'font-style: normal;';
$astra_fonts .= 'font-display: ' . astra_get_fonts_display_property() . ';';
$astra_fonts .= '}';
$parse_css .= $astra_fonts;
}
if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) {
/**
* Hide the default naviagtion markup for responsive devices.
* Once class .ast-header-break-point is added to the body below CSS will be override by the
* .ast-header-break-point class
*/
$astra_navigation = '@media (max-width:' . $header_break_point . 'px) {';
$astra_navigation .= '.main-header-bar .main-header-bar-navigation{';
$astra_navigation .= 'display:none;';
$astra_navigation .= '}';
$astra_navigation .= '}';
$parse_css .= $astra_navigation;
}
/* Blog */
if ( 'custom' === $blog_width ) :
/* Site width Responsive */
$blog_css = array(
'.blog .site-content > .ast-container, .archive .site-content > .ast-container, .search .site-content > .ast-container' => array(
'max-width' => astra_get_css_value( $blog_max_width, 'px' ),
),
);
$parse_css .= astra_parse_css( $blog_css, astra_get_tablet_breakpoint( '', 1 ) );
endif;
/* Single Blog */
if ( 'custom' === $single_post_max ) :
/* Site width Responsive */
$single_blog_css = array(
'.single-post .site-content > .ast-container' => array(
'max-width' => astra_get_css_value( $single_post_max_width, 'px' ),
),
);
$parse_css .= astra_parse_css( $single_blog_css, astra_get_tablet_breakpoint( '', 1 ) );
endif;
/* Single Page */
if ( 'custom' === $single_page_max ) :
/* Site width Responsive */
$single_page_css = array(
' .page .site-content > .ast-container' => array(
'max-width' => astra_get_css_value( $single_page_max_width, 'px' ),
),
);
$parse_css .= astra_parse_css( $single_page_css, astra_get_tablet_breakpoint( '', 1 ) );
endif;
if ( self::astra_headings_clear_compatibility() && is_singular() ) {
/**
* Fix with backward compatibility for single blogs heading text wrap with image issue.
*/
$parse_css .= astra_parse_css(
array(
'.entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4, .entry-content h5, .entry-content h6' => array(
'clear' => 'none',
),
)
);
}
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$blog_addon_condition = defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'blog-pro' );
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( is_search() || is_archive() || is_home() ) {
if ( ! ( $blog_addon_condition ) ) {
// If a old pro user has used blog-layout-1 to 3 and disabled astra addon then moved layout to 'blog-layout-4'.
if ( 'blog-layout-1' == $blog_layout || 'blog-layout-2' === $blog_layout || 'blog-layout-3' === $blog_layout ) {
$blog_layout = 'blog-layout-4';
}
}
$bl_selector = '.ast-' . esc_attr( $blog_layout ) . '-grid';
$blog_grid = astra_get_option( 'blog-grid' );
$blog_layout_css = array();
if ( 'blog-layout-4' === $blog_layout || 'blog-layout-6' === $blog_layout ) {
$blog_layout_css = array(
$bl_selector . ' .ast-article-post' => array(
'border' => '0',
),
$bl_selector . ' .ast-article-inner .wp-post-image' => array(
'width' => '100%',
),
);
if ( $blog_addon_condition && 1 === $blog_grid ) {
$blog_layout_css['.ast-separate-container .ast-article-post'] = array(
'padding' => '1.5em',
);
}
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( ! ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'blog-pro' ) ) || ( $blog_addon_condition && 1 !== $blog_grid ) ) {
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$blog_layout_css['.ast-article-inner'] = array(
'padding' => '1.5em',
);
}
$blog_layout_css[ $bl_selector . ' .ast-row' ] = array(
'display' => 'flex',
'flex-wrap' => 'wrap',
'flex-flow' => 'row wrap',
'align-items' => 'stretch',
);
}
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( ! ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'blog-pro' ) ) ) {
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( 'blog-layout-4' === $blog_layout || 'blog-layout-6' === $blog_layout ) {
$blog_layout_css[ $bl_selector . ' .ast-article-post' ] = array(
'width' => '33.33%',
'margin-bottom' => '2em',
'border-bottom' => '0',
'background-color' => 'transparent',
);
$blog_layout_css[ '.ast-separate-container ' . $bl_selector . ' .ast-article-post' ] = array(
'padding' => '0 1em 0',
);
$blog_layout_css['.ast-separate-container.ast-desktop .ast-blog-layout-4-grid .ast-row'] = array(
'margin-left' => '-1em',
'margin-right' => '-1em',
);
}
$blog_layout_css[ $bl_selector . ' .ast-article-inner' ] = array(
'box-shadow' => '0px 6px 15px -2px rgba(16, 24, 40, 0.05)',
);
$blog_layout_css[ '.ast-separate-container ' . $bl_selector . ' .ast-article-inner, .ast-plain-container ' . $bl_selector . ' .ast-article-inner' ] = array(
'height' => '100%',
);
}
$parse_css .= astra_parse_css( $blog_layout_css );
if ( 'blog-layout-4' === $blog_layout ) {
$blog_layout_grid_css = array(
'.ast-row .blog-layout-4 .post-content, .blog-layout-4 .post-thumb' => array(
'padding-' . $rtl_left . '' => '0',
'padding-' . $rtl_right . '' => '0',
),
'.ast-article-post.remove-featured-img-padding .blog-layout-4 .post-content .ast-blog-featured-section:first-child .post-thumb-img-content' => array(
'margin-top' => '-1.5em',
),
'.ast-article-post.remove-featured-img-padding .blog-layout-4 .post-content .ast-blog-featured-section .post-thumb-img-content' => array(
'margin-' . $rtl_left . '' => '-1.5em',
'margin-' . $rtl_right . '' => '-1.5em',
),
);
$parse_css .= astra_parse_css( $blog_layout_grid_css );
}
if ( 'blog-layout-5' === $blog_layout ) {
$blog_layout_list_css = array(
$bl_selector . ' .ast-row' => array(
'margin-' . $rtl_left . '' => '0',
'margin-' . $rtl_right . '' => '0',
),
$bl_selector . ' .ast-article-inner' => array(
'width' => '100%',
),
$bl_selector . ' .blog-layout-5' => array(
'display' => 'flex',
'flex-wrap' => 'wrap',
'vertical-align' => 'middle',
),
$bl_selector . ' .ast-blog-featured-section' => array(
'width' => '25%',
'margin-bottom' => '0',
),
$bl_selector . ' .post-thumb-img-content' => array(
'height' => '100%',
),
$bl_selector . ' .ast-blog-featured-section img' => array(
'width' => '100%',
'height' => '100%',
'object-fit' => 'cover',
),
$bl_selector . ' .post-content' => array(
'width' => '75%',
'padding-' . $rtl_left . '' => '1.5em',
),
$bl_selector . ' .ast-no-thumb .ast-blog-featured-section' => array(
'width' => 'unset',
),
$bl_selector . ' .ast-no-thumb .post-content' => array(
'width' => '100%',
),
'.ast-separate-container ' . $bl_selector . ' .post-content' => array(
'padding-' . $rtl_right . '' => '1.5em',
'padding-top' => '1.5em',
'padding-bottom' => '1.5em',
),
);
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( ! ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'blog-pro' ) ) ) {
/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$blog_layout_list_css[ $bl_selector . ' .ast-article-post' ] = array(
'margin-bottom' => '2em',
'padding' => '0',
'border-bottom' => '0',
);
} else {
$blog_layout_list_css[ $bl_selector . ' .ast-article-post' ] = array(
'padding' => '0',
'border-bottom' => '0',
);
}
$parse_css .= astra_parse_css( $blog_layout_list_css );
$blog_layout_list_css_responsive = array();
$blog_layout_list_css_responsive[ '.ast-separate-container ' . $bl_selector . ' .post-content' ] = array(
'padding' => '0',
);
$blog_layout_list_css_responsive[ $bl_selector . ' .ast-blog-featured-section' ] = array(
'margin-bottom' => '1.5em',
);
$parse_css .= astra_parse_css( $blog_layout_list_css_responsive, '', astra_get_tablet_breakpoint() );
}
if ( 'blog-layout-6' === $blog_layout ) {
$blog_layout_cover_css = array(
$bl_selector . ' .blog-layout-6 .post-content' => array(
'position' => 'static',
'padding-left' => '0',
'padding-right' => '0',
),
$bl_selector . ' .blog-layout-6 .ast-blog-featured-section' => array(
'position' => 'absolute',
'top' => '0',
'left' => '0',
'right' => '0',
'bottom' => '0',
'left' => '0',
'width' => '100%',
'height' => '100%',
),
$bl_selector . ' .blog-layout-6 .post-thumb-img-content,' . $bl_selector . ' .blog-layout-6 .post-thumb-img-content img' => array(
'width' => '100%',
'height' => '100%',
),
$bl_selector . ' .blog-layout-6 .post-thumb-img-content img' => array(
'object-fit' => 'cover',
'border-radius' => '4px',
),
$bl_selector . ' .blog-layout-6 .ast-blog-single-element:not(.ast-blog-featured-section)' => array(
'position' => 'relative',
'z-index' => '1',
),
$bl_selector . ' .blog-layout-6 .ast-blog-single-element, ' . $bl_selector . ' .blog-layout-6 .ast-blog-single-element *, ' . $bl_selector . ' .blog-layout-6 .ast-blog-single-element *:hover' => array(
'color' => '#fff',
),
$bl_selector . ' .badge .ast-button,' . $bl_selector . ' .badge .ast-button:hover' => array(
'border' => '1px solid #fff',
'background-color' => 'transparent',
),
$bl_selector . ' .blog-layout-6 .ast-blog-featured-section:before' => array(
'position' => 'absolute',
'top' => '0',
'left' => '0',
'right' => '0',
'bottom' => '0',
'left' => '0',
'width' => '100%',
'height' => '100%',
'background-color' => 'rgba(30, 41, 59, 0.65)',
'border-radius' => '4px',
),
);
if ( ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'blog-pro' ) ) && ( 1 === astra_get_option( 'blog-grid' ) ) ) {
$blog_layout_cover_css[ $bl_selector . ' .ast-archive-post' ] = array(
'position' => 'relative',
);
} else {
$blog_layout_cover_css[ $bl_selector . ' .blog-layout-6' ] = array(
'position' => 'relative',
);
}
if ( 1 === $blog_grid ) {
$blog_layout_cover_css['.ast-plain-container .ast-article-post'] = array(
'padding' => '1.5em',
);
}
if ( 1 !== $blog_grid ) {
$blog_layout_cover_css['.ast-plain-container .ast-article-inner'] = array(
'padding' => '1.5em',
);
}
$parse_css .= astra_parse_css( $blog_layout_cover_css );
}
$blog_layout_css_responsive = array();
if ( 'blog-layout-4' === $blog_layout || 'blog-layout-6' === $blog_layout ) {
$blog_layout_css_responsive = array(
$bl_selector . ' .ast-article-post' => array(
'width' => '100%',
),
);
}
if ( 'blog-layout-5' === $blog_layout ) {
$blog_layout_css_responsive[ $bl_selector . ' .ast-blog-featured-section,' . $bl_selector . ' .post-content' ] = array(
'width' => '100%',
);
}
$parse_css .= astra_parse_css( $blog_layout_css_responsive, '', astra_get_tablet_breakpoint() );
$parse_css .= Astra_Enqueue_Scripts::trim_css( self::blog_layout_static_css() );
// Blog Archive Featured Image.
if ( $aspect_ratio && $with_aspect_img_width ) {
$blog_featured_image = array(
'.ast-article-post .post-thumb-img-content img' => array(
'aspect-ratio' => $aspect_ratio,
'width' => $with_aspect_img_width,
),
);
$parse_css .= astra_parse_css( $blog_featured_image );
}
// Added cover styling for Custom image ratio.
if ( 'custom' === $aspect_ratio_type ) {
$cover_style_image = array(
'.ast-article-post .post-thumb-img-content img' => array(
'object-fit' => 'cover',
),
);
$parse_css .= astra_parse_css( $cover_style_image );
}
$author_avatar = astra_get_option( 'blog-meta-author-avatar' );
if ( $author_avatar ) {
$blog_author_css = array(
'.ast-author-image' => array(
'aspect-ratio' => '1/1',
'border-radius' => '100%',
'margin-' . $rtl_right . '' => '.5em',
),
);
$parse_css .= astra_parse_css( $blog_author_css );
}
$blog_archive_hover_effect = astra_get_option( 'blog-hover-effect' );
if ( 'none' !== $blog_archive_hover_effect ) {
$blog_archive_hover_effect_css = array(
'.ast-article-post .post-thumb-img-content' => array(
'overflow' => 'hidden',
),
);
if ( 'zoom-in' === $blog_archive_hover_effect ) {
$blog_archive_hover_effect_css['.ast-article-post .post-thumb-img-content img'] = array(
'transform' => 'scale(1)',
'transition' => 'transform .5s ease',
);
$blog_archive_hover_effect_css['.ast-article-post:hover .post-thumb-img-content img'] = array(
'transform' => 'scale(1.1)',
);
}
if ( 'zoom-out' === $blog_archive_hover_effect ) {
$blog_archive_hover_effect_css['.ast-article-post .post-thumb-img-content img'] = array(
'transform' => 'scale(1.1)',
'transition' => 'transform .5s ease',
);
$blog_archive_hover_effect_css['.ast-article-post:hover .post-thumb-img-content img'] = array(
'transform' => 'scale(1)',
);
}
$parse_css .= astra_parse_css( $blog_archive_hover_effect_css );
}
// Post elements.
$categories_styles = astra_get_option( 'blog-category-style' );
$tag_styles = astra_get_option( 'blog-tag-style' );
$categories_meta_styles = astra_get_option( 'blog-meta-category-style' );
$tag_meta_styles = astra_get_option( 'blog-meta-tag-style' );
if ( $categories_styles || $tag_styles || $categories_meta_styles || $tag_meta_styles ) {
$post_tax_style = '
.cat-links.badge a, .tags-links.badge a {
padding: 4px 8px;
border-radius: 3px;
font-weight: 400;
}
';
$post_tax_style .= '
.cat-links.underline a, .tags-links.underline a{
text-decoration: underline;
}
';
$parse_css .= Astra_Enqueue_Scripts::trim_css( $post_tax_style );
}
}
// Primary Submenu Border Width & Color.
$submenu_border_style = array(
'.ast-desktop .main-header-menu.submenu-with-border .sub-menu, .ast-desktop .main-header-menu.submenu-with-border .astra-full-megamenu-wrapper' => array(
'border-color' => esc_attr( $primary_submenu_b_color ),
),
'.ast-desktop .main-header-menu.submenu-with-border .sub-menu' => array(
'border-top-width' => ! empty( $submenu_border['top'] ) ? astra_get_css_value( $submenu_border['top'], 'px' ) : '',
'border-right-width' => ! empty( $submenu_border['right'] ) ? astra_get_css_value( $submenu_border['right'], 'px' ) : '',
'border-left-width' => ! empty( $submenu_border['left'] ) ? astra_get_css_value( $submenu_border['left'], 'px' ) : '',
'border-bottom-width' => ! empty( $submenu_border['bottom'] ) ? astra_get_css_value( $submenu_border['bottom'], 'px' ) : '',
'border-style' => 'solid',
),
'.ast-desktop .main-header-menu.submenu-with-border .sub-menu .sub-menu' => array(
'top' => ( isset( $submenu_border['top'] ) && '' != $submenu_border['top'] ) ? astra_get_css_value( '-' . $submenu_border['top'], 'px' ) : '',
),
'.ast-desktop .main-header-menu.submenu-with-border .sub-menu .menu-link, .ast-desktop .main-header-menu.submenu-with-border .children .menu-link' => array(
'border-bottom-width' => ( $primary_submenu_item_border ) ? '1px' : '0px',
'border-style' => 'solid',
'border-color' => esc_attr( $primary_submenu_item_b_color ),
),
);
// Submenu items goes outside?
$submenu_border_for_left_align_menu = array(
'.main-header-menu .sub-menu .menu-item.ast-left-align-sub-menu:hover > .sub-menu, .main-header-menu .sub-menu .menu-item.ast-left-align-sub-menu.focus > .sub-menu' => array(
'margin-left' => ( ( isset( $submenu_border['left'] ) && '' != $submenu_border['left'] ) || isset( $submenu_border['right'] ) && '' != $submenu_border['right'] ) ? astra_get_css_value( '-' . ( (int) $submenu_border['left'] + (int) $submenu_border['right'] ), 'px' ) : '',
),
);
if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) {
$parse_css .= astra_parse_css( $submenu_border_style );
}
// Submenu items goes outside?
$parse_css .= astra_parse_css( $submenu_border_for_left_align_menu, astra_get_tablet_breakpoint( '', 1 ) );
/* Small Footer CSS */
if ( false === Astra_Builder_Helper::$is_header_footer_builder_active && 'disabled' != $small_footer_layout ) :
$sml_footer_css = array(
'.ast-small-footer' => array(
'border-top-style' => 'solid',
'border-top-width' => astra_get_css_value( $small_footer_divider, 'px' ),
'border-top-color' => esc_attr( $small_footer_divider_color ),
),
);
$parse_css .= astra_parse_css( $sml_footer_css );
if ( 'footer-sml-layout-2' != $small_footer_layout ) {
$sml_footer_css = array(
'.ast-small-footer-wrap' => array(
'text-align' => 'center',
),
);
$parse_css .= astra_parse_css( $sml_footer_css );
}
endif;
/* Transparent Header - Comonent header specific CSS compatibility */
if ( true === Astra_Builder_Helper::$is_header_footer_builder_active && Astra_Ext_Transparent_Header_Markup::is_transparent_header() ) {
$html_text_color = astra_get_option( 'transparent-header-html-text-color' );
$html_link_color = astra_get_option( 'transparent-header-html-link-color' );
$html_link_h_color = astra_get_option( 'transparent-header-html-link-h-color' );
$search_icon_color = astra_get_option( 'transparent-header-search-icon-color' );
$search_text_color = astra_get_option( 'transparent-header-search-box-placeholder-color' );
$search_box_bg_color = astra_get_option( 'transparent-header-search-box-background-color' );
$social_color = astra_get_option( 'transparent-header-social-icons-color' );
$social_hover_color = astra_get_option( 'transparent-header-social-icons-h-color' );
$social_bg_color = astra_get_option( 'transparent-header-social-icons-bg-color' );
$social_bg_hover_color = astra_get_option( 'transparent-header-social-icons-bg-h-color' );
$button_color = astra_get_option( 'transparent-header-button-text-color' );
$button_h_color = astra_get_option( 'transparent-header-button-text-h-color' );
$button_bg_color = astra_get_option( 'transparent-header-button-bg-color' );
$button_bg_h_color = astra_get_option( 'transparent-header-button-bg-h-color' );
$button_border_color = astra_get_option( 'transparent-header-button-border-color' );
$button_h_border_color = astra_get_option( 'transparent-header-button-border-h-color' );
$divider_color = astra_get_option( 'transparent-header-divider-color' );
$account_icon_color = astra_get_option( 'transparent-account-icon-color' );
$account_loggedout_text_color = astra_get_option( 'transparent-account-type-text-color' );
// Menu colors.
$account_menu_color = astra_get_option( 'transparent-account-menu-color' );
$account_menu_bg_color = astra_get_option( 'transparent-account-menu-bg-obj' );
$account_menu_color_hover = astra_get_option( 'transparent-account-menu-h-color' );
$account_menu_bg_color_hover = astra_get_option( 'transparent-account-menu-h-bg-color' );
$account_menu_color_active = astra_get_option( 'transparent-account-menu-a-color' );
$account_menu_bg_color_active = astra_get_option( 'transparent-account-menu-a-bg-color' );
$transparent_header_builder_desktop_css = array(
'.ast-theme-transparent-header [CLASS*="ast-header-html-"] .ast-builder-html-element' => array(
'color' => esc_attr( $html_text_color ),
),
'.ast-theme-transparent-header [CLASS*="ast-header-html-"] .ast-builder-html-element a' => array(
'color' => esc_attr( $html_link_color ),
),
'.ast-theme-transparent-header [CLASS*="ast-header-html-"] .ast-builder-html-element a:hover' => array(
'color' => esc_attr( $html_link_h_color ),
),
'.ast-theme-transparent-header .ast-header-search .astra-search-icon, .ast-theme-transparent-header .ast-header-search .search-field::placeholder, .ast-theme-transparent-header .ast-header-search .ast-icon' => array(
'color' => esc_attr( $search_icon_color ),
),
'.ast-theme-transparent-header .ast-header-search .ast-search-menu-icon .search-field, .ast-theme-transparent-header .ast-header-search .ast-search-menu-icon .search-field::placeholder' => array(
'color' => esc_attr( $search_text_color ),
),
'.ast-theme-transparent-header .ast-header-search .ast-search-menu-icon .search-field, .ast-theme-transparent-header .ast-header-search .ast-search-menu-icon .search-form, .ast-theme-transparent-header .ast-header-search .ast-search-menu-icon .search-submit' => array(
'background-color' => esc_attr( $search_box_bg_color ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element' => array(
'background' => esc_attr( $social_bg_color['desktop'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element svg' => array(
'fill' => esc_attr( $social_color['desktop'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element:hover' => array(
'background' => esc_attr( $social_bg_hover_color['desktop'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element:hover svg' => array(
'fill' => esc_attr( $social_hover_color['desktop'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element .social-item-label' => array(
'color' => esc_attr( $social_color['desktop'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element:hover .social-item-label' => array(
'color' => esc_attr( $social_hover_color['desktop'] ),
),
'.ast-theme-transparent-header [CLASS*="ast-header-button-"] .ast-custom-button' => array(
'color' => esc_attr( $button_color ),
'background' => esc_attr( $button_bg_color ),
'border-color' => esc_attr( $button_border_color ),
),
'.ast-theme-transparent-header [CLASS*="ast-header-button-"] .ast-custom-button:hover' => array(
'color' => esc_attr( $button_h_color ),
'background' => esc_attr( $button_bg_h_color ),
'border-color' => esc_attr( $button_h_border_color ),
),
'.ast-theme-transparent-header .ast-header-divider-element .ast-divider-wrapper' => array(
'border-color' => esc_attr( $divider_color ),
),
'.ast-theme-transparent-header .ast-header-account-wrap .ast-header-account-type-icon .ahfb-svg-iconset svg path:not(.ast-hf-account-unfill), .ast-theme-transparent-header .ast-header-account-wrap .ast-header-account-type-icon .ahfb-svg-iconset svg circle' => array(
'fill' => esc_attr( $account_icon_color ),
),
'.ast-theme-transparent-header .ast-header-account-wrap .ast-account-nav-menu .menu-item .menu-link' => array(
'color' => esc_attr( $account_menu_color ),
),
'.ast-theme-transparent-header .ast-header-account-wrap .ast-account-nav-menu .menu-item:hover > .menu-link' => array(
'color' => $account_menu_color_hover,
'background' => $account_menu_bg_color_hover,
),
'.ast-theme-transparent-header .ast-header-account-wrap .ast-account-nav-menu .menu-item.current-menu-item > .menu-link' => array(
'color' => $account_menu_color_active,
'background' => $account_menu_bg_color_active,
),
'.ast-theme-transparent-header .ast-header-account-wrap .account-main-navigation ul' => array(
'background' => $account_menu_bg_color,
),
'.ast-theme-transparent-header .ast-header-account-wrap .ast-header-account-text' => array(
'color' => $account_loggedout_text_color,
),
);
$widget_title_color = astra_get_option( 'transparent-header-widget-title-color' );
$widget_content_color = astra_get_option( 'transparent-header-widget-content-color' );
$widget_link_color = astra_get_option( 'transparent-header-widget-link-color' );
$widget_link_hover_color = astra_get_option( 'transparent-header-widget-link-h-color' );
$transparent_header_builder_desktop_css['.ast-theme-transparent-header .widget-area.header-widget-area .widget-title'] = array(
'color' => esc_attr( $widget_title_color ),
);
$transparent_header_builder_desktop_css['.ast-theme-transparent-header .widget-area.header-widget-area .header-widget-area-inner'] = array(
'color' => esc_attr( $widget_content_color ),
);
$transparent_header_builder_desktop_css['.ast-theme-transparent-header .widget-area.header-widget-area .header-widget-area-inner a'] = array(
'color' => esc_attr( $widget_link_color ),
);
$transparent_header_builder_desktop_css['.ast-theme-transparent-header .widget-area.header-widget-area .header-widget-area-inner a:hover'] = array(
'color' => esc_attr( $widget_link_hover_color ),
);
if ( Astra_Builder_Helper::apply_flex_based_css() ) {
$transparent_header_widget_selector = '.ast-theme-transparent-header .widget-area.header-widget-area.header-widget-area-inner';
} else {
$transparent_header_widget_selector = '.ast-theme-transparent-header .widget-area.header-widget-area. header-widget-area-inner';
}
$transparent_header_builder_desktop_css[ $transparent_header_widget_selector ] = array(
'color' => esc_attr( $widget_content_color ),
);
$transparent_header_builder_desktop_css[ $transparent_header_widget_selector . ' a' ] = array(
'color' => esc_attr( $widget_link_color ),
);
$transparent_header_builder_desktop_css[ $transparent_header_widget_selector . ' a:hover' ] = array(
'color' => esc_attr( $widget_link_hover_color ),
);
if ( Astra_Builder_Helper::is_component_loaded( 'mobile-trigger', 'header', 'mobile' ) ) {
$transparent_toggle_selector = '.ast-theme-transparent-header [data-section="section-header-mobile-trigger"]';
$trigger_bg = astra_get_option( 'transparent-header-toggle-btn-bg-color' );
$trigger_border_color = astra_get_option( 'transparent-header-toggle-border-color', $trigger_bg );
$style = astra_get_option( 'mobile-header-toggle-btn-style' );
$default = '#ffffff';
if ( 'fill' !== $style ) {
$default = $theme_color;
}
$icon_color = astra_get_option( 'transparent-header-toggle-btn-color' );
/**
* Off-Canvas CSS.
*/
$transparent_header_builder_desktop_css[ $transparent_toggle_selector . ' .ast-button-wrap .mobile-menu-toggle-icon .ast-mobile-svg' ] = array(
'fill' => $icon_color,
);
$transparent_header_builder_desktop_css[ $transparent_toggle_selector . ' .ast-button-wrap .mobile-menu-wrap .mobile-menu' ] = array(
// Color.
'color' => $icon_color,
);
if ( 'fill' === $style ) {
$transparent_header_builder_desktop_css[ $transparent_toggle_selector . ' .ast-button-wrap .ast-mobile-menu-trigger-fill' ] = array(
'background' => esc_attr( $trigger_bg ),
);
$transparent_header_builder_desktop_css[ $transparent_toggle_selector . ' .ast-button-wrap .ast-mobile-menu-trigger-fill, ' . $transparent_toggle_selector . ' .ast-button-wrap .ast-mobile-menu-trigger-minimal' ] = array(
// Color & Border.
'color' => esc_attr( $icon_color ),
'border' => 'none',
);
} elseif ( 'outline' === $style ) {
$transparent_header_builder_desktop_css[ $transparent_toggle_selector . ' .ast-button-wrap .ast-mobile-menu-trigger-outline' ] = array(
// Background.
'background' => 'transparent',
'color' => esc_attr( $icon_color ),
'border-color' => $trigger_border_color,
);
} else {
$transparent_header_builder_desktop_css[ $transparent_toggle_selector . ' .ast-button-wrap .ast-mobile-menu-trigger-minimal' ] = array(
'background' => 'transparent',
);
}
}
$parse_css .= astra_parse_css( $transparent_header_builder_desktop_css );
/**
* Max-width: Tablet Breakpoint CSS.
*/
$transparent_header_builder_tablet_css = array(
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element' => array(
'background' => esc_attr( $social_bg_color['tablet'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element svg' => array(
'fill' => esc_attr( $social_color['tablet'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element:hover' => array(
'background' => esc_attr( $social_bg_hover_color['tablet'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element:hover svg' => array(
'fill' => esc_attr( $social_hover_color['tablet'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element .social-item-label' => array(
'color' => esc_attr( $social_color['tablet'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element:hover .social-item-label' => array(
'color' => esc_attr( $social_hover_color['tablet'] ),
),
);
$parse_css .= astra_parse_css( $transparent_header_builder_tablet_css, '', astra_get_tablet_breakpoint() );
/**
* Max-width: Mobile Breakpoint CSS.
*/
$transparent_header_builder_mobile_css = array(
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element' => array(
'background' => esc_attr( $social_bg_color['mobile'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element svg' => array(
'fill' => esc_attr( $social_color['mobile'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element:hover' => array(
'background' => esc_attr( $social_bg_hover_color['mobile'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element:hover svg' => array(
'fill' => esc_attr( $social_hover_color['mobile'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element .social-item-label' => array(
'color' => esc_attr( $social_color['mobile'] ),
),
'.ast-theme-transparent-header .ast-header-social-wrap .ast-social-color-type-custom .ast-builder-social-element:hover .social-item-label' => array(
'color' => esc_attr( $social_hover_color['mobile'] ),
),
);
$parse_css .= astra_parse_css( $transparent_header_builder_mobile_css, '', astra_get_mobile_breakpoint() );
}
if ( self::astra_list_block_vertical_spacing() ) {
$list_spacing_css = array(
'.entry-content li > p' => array(
'margin-bottom' => 0,
),
);
$parse_css .= astra_parse_css( $list_spacing_css );
}
if ( self::astra_fullwidth_sidebar_support() ) {
if ( 'page-builder' == $ast_container_layout ) {
add_filter(
'astra_page_layout',
function() { // phpcs:ignore PHPCompatibility.FunctionDeclarations.NewClosure.Found
return 'no-sidebar';
}
);
}
}
if ( astra_get_option( 'enable-comments-area', true ) ) {
$parse_css .= Astra_Extended_Base_Dynamic_CSS::prepare_inner_section_advanced_css( 'ast-sub-section-comments', '.site .comments-area' );
$comments_radius = astra_get_option(
'ast-sub-section-comments-border-radius',
array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
)
);
$list_spacing_css = array(
'.comments-area .comments-title, .comments-area .comment-respond' => array(
'border-top-left-radius' => ! empty( astra_get_css_value( $comments_radius['top'] ) ) ? astra_get_css_value( $comments_radius['top'], 'px' ) : '',
'border-bottom-right-radius' => ! empty( astra_get_css_value( $comments_radius['bottom'] ) ) ? astra_get_css_value( $comments_radius['bottom'], 'px' ) : '',
'border-bottom-left-radius' => ! empty( astra_get_css_value( $comments_radius['left'] ) ) ? astra_get_css_value( $comments_radius['left'], 'px' ) : '',
'border-top-right-radius' => ! empty( astra_get_css_value( $comments_radius['right'] ) ) ? astra_get_css_value( $comments_radius['right'], 'px' ) : '',
),
);
$parse_css .= astra_parse_css( $list_spacing_css );
}
$parse_css .= $dynamic_css;
$custom_css = astra_get_option( 'custom-css' );
if ( '' != $custom_css ) {
$parse_css .= $custom_css;
}
// trim white space for faster page loading.
$parse_css = Astra_Enqueue_Scripts::trim_css( $parse_css );
return apply_filters( 'astra_theme_dynamic_css', $parse_css );
}
/**
* Astra update default font size and font weight.
*
* @since 4.6.5
* @return boolean
*/
public static function elementor_heading_margin_style_comp() {
$astra_settings = astra_get_options();
return apply_filters( 'elementor_heading_margin', isset( $astra_settings['elementor-headings-style'] ) ? false : true );
}
/**
* Heading font size fix in footer builder compatibility.
*
* @since 4.7.0
* @return boolean
*/
public static function astra_heading_inside_widget_font_size_comp() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_heading_inside_widget_font_size', isset( $astra_settings['heading-widget-font-size'] ) ? false : true );
}
/**
* Added Elementor post loop block padding support .
*
* @since 4.6.6
* @return boolean
*/
public static function elementor_container_padding_style_comp() {
$astra_settings = astra_get_options();
return apply_filters( 'elementor_container_padding', isset( $astra_settings['elementor-container-padding-style'] ) ? false : true );
}
/**
* Added Elementor button styling support.
*
* @since 4.6.12
* @return boolean
*/
public static function elementor_btn_styling_comp() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_elementor_button_body_selector_compatibility', isset( $astra_settings['elementor-btn-styling'] ) && $astra_settings['elementor-btn-styling'] ? true : false );
}
/**
* PX to em conversion failed with default value set.
*
* @since 4.8.4
* @return boolean
*/
public static function heading_font_size_comp() {
$astra_settings = astra_get_options();
return apply_filters( 'heading_font_size_compatibility', isset( $astra_settings['astra-heading-font-size-compatibility'] ) ? false : true );
}
/**
* Return post meta CSS
*
* @param string $dynamic_css Astra Dynamic CSS.
* @param string $dynamic_css_filtered Astra Dynamic CSS Filters.
* @return mixed Return the CSS.
*/
public static function return_meta_output( $dynamic_css, $dynamic_css_filtered = '' ) {
/**
* - Page Layout
*
* - Sidebar Positions CSS
*/
$secondary_width = absint( astra_get_option( 'site-sidebar-width' ) );
$primary_width = absint( 100 - $secondary_width );
$meta_style = '';
// Header Separator.
$header_separator = astra_get_option( 'header-main-sep' );
$header_separator_color = astra_get_option( 'header-main-sep-color' );
$meta_style = array(
'.ast-header-break-point .main-header-bar' => array(
'border-bottom-width' => astra_get_css_value( $header_separator, 'px' ),
'border-bottom-color' => esc_attr( $header_separator_color ),
),
);
$parse_css = astra_parse_css( $meta_style );
$meta_style = array(
'.main-header-bar' => array(
'border-bottom-width' => astra_get_css_value( $header_separator, 'px' ),
'border-bottom-color' => esc_attr( $header_separator_color ),
),
);
$parse_css .= astra_parse_css( $meta_style, astra_get_tablet_breakpoint( '', 1 ) );
if ( 'no-sidebar' !== astra_page_layout() ) :
$meta_style = array(
'#primary' => array(
'width' => astra_get_css_value( $primary_width, '%' ),
),
'#secondary' => array(
'width' => astra_get_css_value( strval( $secondary_width ), '%' ),
),
);
$parse_css .= astra_parse_css( $meta_style, astra_get_tablet_breakpoint( '', 1 ) );
endif;
if ( false === self::astra_submenu_below_header_fix() ) :
// If submenu below header fix is not to be loaded then add removed flex properties from class `ast-flex`.
// Also restore the padding to class `main-header-bar`.
$submenu_below_header = array(
'.ast-flex' => array(
'-webkit-align-content' => 'center',
'-ms-flex-line-pack' => 'center',
'align-content' => 'center',
'-webkit-box-align' => 'center',
'-webkit-align-items' => 'center',
'-moz-box-align' => 'center',
'-ms-flex-align' => 'center',
'align-items' => 'center',
),
'.main-header-bar' => array(
'padding' => '1em 0',
),
'.ast-site-identity' => array(
'padding' => '0',
),
// CSS to open submenu just below menu.
'.header-main-layout-1 .ast-flex.main-header-container, .header-main-layout-3 .ast-flex.main-header-container' => array(
'-webkit-align-content' => 'center',
'-ms-flex-line-pack' => 'center',
'align-content' => 'center',
'-webkit-box-align' => 'center',
'-webkit-align-items' => 'center',
'-moz-box-align' => 'center',
'-ms-flex-align' => 'center',
'align-items' => 'center',
),
);
$parse_css .= astra_parse_css( $submenu_below_header );
else :
// `.menu-item` required display:flex, although weight of this css increases because of which custom CSS added from child themes to be not working.
// Hence this is added to dynamic CSS which will be applied only if this filter `astra_submenu_below_header_fix` is enabled.
// @see https://github.com/brainstormforce/astra/pull/828
$submenu_below_header = array(
'.main-header-menu .menu-item, #astra-footer-menu .menu-item, .main-header-bar .ast-masthead-custom-menu-items' => array(
'-js-display' => 'flex',
'display' => '-webkit-box',
'display' => '-webkit-flex',
'display' => '-moz-box',
'display' => '-ms-flexbox',
'display' => 'flex',
'-webkit-box-pack' => 'center',
'-webkit-justify-content' => 'center',
'-moz-box-pack' => 'center',
'-ms-flex-pack' => 'center',
'justify-content' => 'center',
'-webkit-box-orient' => 'vertical',
'-webkit-box-direction' => 'normal',
'-webkit-flex-direction' => 'column',
'-moz-box-orient' => 'vertical',
'-moz-box-direction' => 'normal',
'-ms-flex-direction' => 'column',
'flex-direction' => 'column',
),
'.main-header-menu > .menu-item > .menu-link, #astra-footer-menu > .menu-item > .menu-link' => array(
'height' => '100%',
'-webkit-box-align' => 'center',
'-webkit-align-items' => 'center',
'-moz-box-align' => 'center',
'-ms-flex-align' => 'center',
'align-items' => 'center',
'-js-display' => 'flex',
'display' => '-webkit-box',
'display' => '-webkit-flex',
'display' => '-moz-box',
'display' => '-ms-flexbox',
'display' => 'flex',
),
);
if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) {
$submenu_below_header['.ast-primary-menu-disabled .main-header-bar .ast-masthead-custom-menu-items'] = array(
'flex' => 'unset',
);
}
$parse_css .= astra_parse_css( $submenu_below_header );
endif;
if ( false === self::astra_submenu_open_below_header_fix() ) {
// If submenu below header fix is not to be loaded then add removed flex properties from class `ast-flex`.
// Also restore the padding to class `main-header-bar`.
$submenu_below_header = array(
// CSS to open submenu just below menu.
'.header-main-layout-1 .ast-flex.main-header-container, .header-main-layout-3 .ast-flex.main-header-container' => array(
'-webkit-align-content' => 'center',
'-ms-flex-line-pack' => 'center',
'align-content' => 'center',
'-webkit-box-align' => 'center',
'-webkit-align-items' => 'center',
'-moz-box-align' => 'center',
'-ms-flex-align' => 'center',
'align-items' => 'center',
),
);
$parse_css .= astra_parse_css( $submenu_below_header );
}
$submenu_toggle = '';
$is_site_rtl = is_rtl();
if ( false === Astra_Icons::is_svg_icons() ) {
// Update styles depend on RTL sites.
$transform_svg_style = 'translate(0,-50%) rotate(270deg)';
$transform_nested_svg_transform = 'translate(0, -2px) rotateZ(270deg)';
$default_left_rtl_right = 'left';
$default_right_rtl_left = 'right';
if ( $is_site_rtl ) {
$transform_svg_style = 'translate(0,-50%) rotate(90deg)';
$transform_nested_svg_transform = 'translate(0, -2px) rotateZ(90deg)';
$default_left_rtl_right = 'right';
$default_right_rtl_left = 'left';
}
$submenu_toggle = array(
// HFB / Old Header Footer - CSS compatibility when SVGs are disabled.
'.main-header-menu .sub-menu .menu-item.menu-item-has-children > .menu-link:after' => array(
'position' => 'absolute',
$default_right_rtl_left => '1em',
'top' => '50%',
'transform' => $transform_svg_style,
),
'.ast-header-break-point .main-header-bar .main-header-bar-navigation .page_item_has_children > .ast-menu-toggle::before, .ast-header-break-point .main-header-bar .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle::before, .ast-mobile-popup-drawer .main-header-bar-navigation .menu-item-has-children>.ast-menu-toggle::before, .ast-header-break-point .ast-mobile-header-wrap .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle::before' => array(
'font-weight' => 'bold',
'content' => '"\e900"',
'font-family' => 'Astra',
'text-decoration' => 'inherit',
'display' => 'inline-block',
),
'.ast-header-break-point .main-navigation ul.sub-menu .menu-item .menu-link:before' => array(
'content' => '"\e900"',
'font-family' => 'Astra',
'font-size' => '.65em',
'text-decoration' => 'inherit',
'display' => 'inline-block',
'transform' => $transform_nested_svg_transform,
'margin-' . $default_right_rtl_left => '5px',
),
'.widget_search .search-form:after' => array(
'font-family' => 'Astra',
'font-size' => '1.2em',
'font-weight' => 'normal',
'content' => '"\e8b6"',
'position' => 'absolute',
'top' => '50%',
$default_right_rtl_left => '15px',
'transform' => 'translate(0, -50%)',
),
'.astra-search-icon::before' => array(
'content' => '"\e8b6"',
'font-family' => 'Astra',
'font-style' => 'normal',
'font-weight' => 'normal',
'text-decoration' => 'inherit',
'text-align' => 'center',
'-webkit-font-smoothing' => 'antialiased',
'-moz-osx-font-smoothing' => 'grayscale',
'z-index' => '3',
),
'.main-header-bar .main-header-bar-navigation .page_item_has_children > a:after, .main-header-bar .main-header-bar-navigation .menu-item-has-children > a:after, .menu-item-has-children .ast-header-navigation-arrow:after' => array(
'content' => '"\e900"',
'display' => 'inline-block',
'font-family' => 'Astra',
'font-size' => '9px',
'font-size' => '.6rem',
'font-weight' => 'bold',
'text-rendering' => 'auto',
'-webkit-font-smoothing' => 'antialiased',
'-moz-osx-font-smoothing' => 'grayscale',
'margin-' . $default_left_rtl_right => '10px',
'line-height' => 'normal',
),
'.menu-item-has-children .sub-menu .ast-header-navigation-arrow:after' => array(
'margin-left' => '0',
),
'.ast-mobile-popup-drawer .main-header-bar-navigation .ast-submenu-expanded>.ast-menu-toggle::before' => array(
'transform' => 'rotateX(180deg)',
),
'.ast-header-break-point .main-header-bar-navigation .menu-item-has-children > .menu-link:after' => array(
'display' => 'none',
),
);
} else {
if ( ! Astra_Builder_Helper::$is_header_footer_builder_active ) {
// Update styles depend on RTL sites.
$transform_svg_style = 'translate(0,-50%) rotate(270deg)';
$transform_nested_svg_transform = 'translate(0, -2px) rotateZ(270deg)';
$default_left_rtl_right = 'left';
$default_right_rtl_left = 'right';
if ( $is_site_rtl ) {
$transform_svg_style = 'translate(0,-50%) rotate(900deg)';
$transform_nested_svg_transform = 'translate(0, -2px) rotateZ(90deg)';
$default_left_rtl_right = 'right';
$default_right_rtl_left = 'left';
}
$submenu_toggle = array(
// Old Header Footer - SVG Support.
'.ast-desktop .main-header-menu .sub-menu .menu-item.menu-item-has-children>.menu-link .icon-arrow svg' => array(
'position' => 'absolute',
$default_right_rtl_left => '.6em',
'top' => '50%',
'transform' => $transform_svg_style,
),
'.ast-header-break-point .main-navigation ul .menu-item .menu-link .icon-arrow:first-of-type svg' => array(
$default_left_rtl_right => '.1em',
'top' => '.1em',
'transform' => $transform_nested_svg_transform,
),
);
} else {
$transform_svg_style = 'translate(0, -2px) rotateZ(270deg)';
$default_left_rtl_right = 'left';
if ( $is_site_rtl ) {
$transform_svg_style = 'translate(0, -2px) rotateZ(90deg)';
$default_left_rtl_right = 'right';
}
$submenu_toggle = array(
// New Header Footer - SVG Support.
'.ast-header-break-point .main-navigation ul .menu-item .menu-link .icon-arrow:first-of-type svg' => array(
'top' => '.2em',
'margin-top' => '0px',
'margin-' . $default_left_rtl_right => '0px',
'width' => '.65em',
'transform' => $transform_svg_style,
),
'.ast-mobile-popup-content .ast-submenu-expanded > .ast-menu-toggle' => array(
'transform' => 'rotateX(180deg)',
'overflow-y' => 'auto',
),
);
}
}
$parse_css .= astra_parse_css( $submenu_toggle );
$dynamic_css .= $parse_css;
$ltr_right = is_rtl() ? esc_attr( 'left' ) : esc_attr( 'right' );
$dynamic_css .= astra_parse_css(
array(
'.ast-builder-menu .main-navigation > ul > li:last-child a' => array(
'margin-' . $ltr_right => '0',
),
),
astra_get_tablet_breakpoint( '', 1 )
);
return $dynamic_css;
}
/**
* Conditionally iclude CSS Selectors with anchors in the typography settings.
*
* Historically Astra adds Colors/Typography CSS for headings and anchors for headings but this causes irregularities with the expected output.
* For eg Link color does not work for the links inside headings.
*
* If filter `astra_include_achors_in_headings_typography` is set to true or Astra Option `include-headings-in-typography` is set to true, This will return selectors with anchors. Else This will return selectors without anchors.
*
* @since 1.4.9
* @param String $selectors_with_achors CSS Selectors with anchors.
* @param String $selectors_without_achors CSS Selectors withour annchors.
*
* @return String CSS Selectors based on the condition of filters.
*/
private static function conditional_headings_css_selectors( $selectors_with_achors, $selectors_without_achors ) {
if ( true === self::anchors_in_css_selectors_heading() ) {
return $selectors_with_achors;
} else {
return $selectors_without_achors;
}
}
/**
* Check if CSS selectors in Headings should use anchors.
*
* @since 1.4.9
* @return boolean true if it should include anchors, False if not.
*/
public static function anchors_in_css_selectors_heading() {
if ( true === astra_get_option( 'include-headings-in-typography' ) &&
true === apply_filters(
'astra_include_achors_in_headings_typography',
true
) ) {
return true;
}
return false;
}
/**
* Check backwards compatibility CSS for loading submenu below the header needs to be added.
*
* @since 1.5.0
* @return boolean true if CSS should be included, False if not.
*/
public static function astra_submenu_below_header_fix() {
if ( false === astra_get_option( 'submenu-below-header', true ) &&
false === apply_filters(
'astra_submenu_below_header_fix',
false
) ) {
return false;
}
return true;
}
/**
* Check backwards compatibility CSS for loading submenu below the header needs to be added.
*
* @since 2.1.3
* @return boolean true if submenu below header fix is to be loaded, False if not.
*/
public static function astra_submenu_open_below_header_fix() {
if ( false === astra_get_option( 'submenu-open-below-header', true ) &&
false === apply_filters(
'astra_submenu_open_below_header_fix',
false
) ) {
return false;
}
return true;
}
/**
* Check backwards compatibility to not load default CSS for the button styling of Page Builders.
*
* @since 2.2.0
* @return boolean true if button style CSS should be loaded, False if not.
*/
public static function page_builder_button_style_css() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_page_builder_button_style_css', ( isset( $astra_settings['pb-button-color-compatibility'] ) && false === $astra_settings['pb-button-color-compatibility'] ) ? false : true );
}
/**
* Elementor Theme Style - Button Text Color compatibility. This should be looked in the future for proper solution.
*
* Reference: https://github.com/elementor/elementor/issues/10733
* Reference: https://github.com/elementor/elementor/issues/10739
*
* @since 2.3.3
*
* @return mixed
*/
public static function is_elementor_kit_button_color_set() {
$ele_btn_global_text_color = false;
$ele_kit_id = get_option( 'elementor_active_kit', false );
if ( false !== $ele_kit_id ) {
$ele_global_btn_data = get_post_meta( $ele_kit_id, '_elementor_page_settings' );
// Elementor Global theme style button text color fetch value from database.
$ele_btn_global_text_color = isset( $ele_global_btn_data[0]['button_text_color'] ) ? $ele_global_btn_data[0]['button_text_color'] : $ele_btn_global_text_color;
}
return $ele_btn_global_text_color;
}
/**
* Check if Elementor - Disable Default Colors or Disable Default Fonts checked or unchecked.
*
* @since 2.3.3
*
* @return mixed String if any of the settings are enabled. False if no settings are enabled.
*/
public static function elementor_default_color_font_setting() {
$ele_default_color_setting = get_option( 'elementor_disable_color_schemes' );
$ele_default_typo_setting = get_option( 'elementor_disable_typography_schemes' );
if ( ( 'yes' === $ele_default_color_setting && 'yes' === $ele_default_typo_setting ) || ( false === self::is_elementor_default_color_font_comp() ) ) {
return 'color-typo';
}
if ( 'yes' === $ele_default_color_setting ) {
return 'color';
}
if ( 'yes' === $ele_default_typo_setting ) {
return 'typo';
}
return false;
}
/**
* For existing users, do not reflect direct change.
*
* @since 3.6.5
* @return boolean true if WordPress-5.8 compatibility enabled, False if not.
*/
public static function is_block_editor_support_enabled() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_has_block_editor_support', ( isset( $astra_settings['support-block-editor'] ) && false === $astra_settings['support-block-editor'] ) ? false : true );
}
/**
* For existing users, do not provide Elementor Default Color Typo settings compatibility by default.
*
* @since 2.3.3
* @return boolean true if elementor default color and typo setting should work with theme, False if not.
*/
public static function is_elementor_default_color_font_comp() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_elementor_default_color_font_comp', ( isset( $astra_settings['ele-default-color-typo-setting-comp'] ) && false === $astra_settings['ele-default-color-typo-setting-comp'] ) ? false : true );
}
/**
* For existing users, do not provide list vertical spacing.
*
* @since 4.1.6
* @return boolean true for new users, false for old users.
*/
public static function astra_list_block_vertical_spacing() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_list_block_vertical_spacing', isset( $astra_settings['list-block-vertical-spacing'] ) ? false : true );
}
/**
* For existing users, do not load the wide/full width image CSS by default.
*
* @since 2.4.4
* @return boolean false if it is an existing user , true if not.
*/
public static function gtn_image_group_css_comp() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_gutenberg_image_group_style_support', isset( $astra_settings['gtn-full-wide-image-grp-css'] ) ? false : true );
}
/**
* Do not apply new wide/full Group and Cover block CSS for existing users.
*
* @since 2.5.0
* @return boolean false if it is an existing user , true if not.
*/
public static function gtn_group_cover_css_comp() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_gtn_group_cover_css_comp', isset( $astra_settings['gtn-full-wide-grp-cover-css'] ) ? false : true );
}
/**
* Do not apply new Group, Column and Media & Text block CSS for existing users.
*
* @since 2.6.0
* @return boolean false if it is an existing user , true if not.
*/
public static function gutenberg_core_blocks_css_comp() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_gutenberg_core_blocks_design_compatibility', isset( $astra_settings['guntenberg-core-blocks-comp-css'] ) ? false : true );
}
/**
* Do not apply new Group, Column and Media & Text block CSS for existing users.
*
* CSS for adding spacing|padding support to Gutenberg Media-&-Text Block
*
* @since 2.6.1
* @return boolean false if it is an existing user , true if not.
*/
public static function gutenberg_media_text_block_css_compat() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_gutenberg_media_text_block_spacing_compatibility', isset( $astra_settings['guntenberg-media-text-block-padding-css'] ) ? false : true );
}
/**
* Gutenberg pattern compatibility changes.
*
* @since 3.3.0
* @return boolean false if it is an existing user , true if not.
*/
public static function gutenberg_core_patterns_compat() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_gutenberg_patterns_compatibility', isset( $astra_settings['guntenberg-button-pattern-compat-css'] ) ? false : true );
}
/**
* Font CSS support for widget-title heading fonts & fonts which are not working in editor.
*
* 1. Adding Font-weight support to widget titles.
* 2. Customizer font CSS not supporting in editor.
*
* @since 3.6.0
* @return boolean false if it is an existing user, true if not.
*/
public static function support_font_css_to_widget_and_in_editor() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_heading_fonts_typo_support', isset( $astra_settings['can-support-widget-and-editor-fonts'] ) ? false : true );
}
/**
* Whether to remove or not following CSS which restricts logo size on responsive devices.
*
* @see https://github.com/brainstormforce/astra/commit/d09f63336b73d58c8f8951726edbc90671d7f419
*
* @since 3.6.0
* @return boolean false if it is an existing user, true if not.
*/
public static function remove_logo_max_width_mobile_static_css() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_remove_logo_max_width_css', isset( $astra_settings['can-remove-logo-max-width-css'] ) ? false : true );
}
/**
* Remove text-decoration: underline; CSS for builder specific elements to maintain their UI/UX better.
*
* 1. UAG : Marketing Button, Info Box CTA, MultiButtons, Tabs.
* 2. UABB : Button, Slide Box CTA, Flip box CTA, Info Banner, Posts, Info Circle, Call to Action, Subscribe Form.
*
* @since 3.6.9
*/
public static function unset_builder_elements_underline() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_unset_builder_elements_underline', isset( $astra_settings['unset-builder-elements-underline'] ) ? false : true );
}
/**
* Block editor experience improvements css introduced with v4.0.0.
*
* @since 4.0.0
* @return boolean false if it is an existing user , true if not.
*/
public static function v4_block_editor_compat() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_v4_block_editor_compat', isset( $astra_settings['v4-block-editor-compat'] ) ? false : true );
}
/**
* Load sidebar static CSS when it is enabled.
*
* @since 3.0.0
*/
public static function load_sidebar_static_css() {
$update_customizer_strctural_defaults = astra_check_is_structural_setup();
$secondary_li_bottom_spacing = ( true === $update_customizer_strctural_defaults ) ? '0.75em' : '0.25em';
$is_site_rtl = is_rtl() ? true : false;
$ltr_left = $is_site_rtl ? esc_attr( 'right' ) : esc_attr( 'left' );
$ltr_right = $is_site_rtl ? esc_attr( 'left' ) : esc_attr( 'right' );
$sidebar_static_css = '
#secondary {
margin: 4em 0 2.5em;
word-break: break-word;
line-height: 2;
}
#secondary li {
margin-bottom: ' . esc_attr( $secondary_li_bottom_spacing ) . ';
}
#secondary li:last-child {
margin-bottom: 0;
}
@media (max-width: 768px) {
.js_active .ast-plain-container.ast-single-post #secondary {
margin-top: 1.5em;
}
}
.ast-separate-container.ast-two-container #secondary .widget {
background-color: #fff;
padding: 2em;
margin-bottom: 2em;
}
';
if ( defined( 'CFVSW_VER' ) ) {
$sidebar_static_css .= '
#secondary .cfvsw-filters li{
margin-bottom: 0;
margin-top: 0;
}
';
}
$sidebar_static_css .= '
@media (min-width: 993px) {
.ast-left-sidebar #secondary {
padding-' . $ltr_right . ': 60px;
}
.ast-right-sidebar #secondary {
padding-' . $ltr_left . ': 60px;
}
}
@media (max-width: 993px) {
.ast-right-sidebar #secondary {
padding-' . $ltr_left . ': 30px;
}
.ast-left-sidebar #secondary {
padding-' . $ltr_right . ': 30px;
}
}
';
if ( $update_customizer_strctural_defaults ) {
$sidebar_static_css .= '
@media (min-width: 993px) {
.ast-page-builder-template.ast-left-sidebar #secondary {
padding-' . $ltr_left . ': 60px;
}
.ast-page-builder-template.ast-right-sidebar #secondary {
padding-' . $ltr_right . ': 60px;
}
}
@media (max-width: 993px) {
.ast-page-builder-template.ast-right-sidebar #secondary {
padding-' . $ltr_right . ': 30px;
}
.ast-page-builder-template.ast-left-sidebar #secondary {
padding-' . $ltr_left . ': 30px;
}
}
';
}
return $sidebar_static_css;
}
/**
* Astra Spectra Gutenberg Compatibility CSS.
*
* @since 3.9.4
* @return boolean false if it is an existing user , true if not.
*/
public static function spectra_gutenberg_compat_css() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_spectra_gutenberg_compat_css', isset( $astra_settings['spectra-gutenberg-compat-css'] ) ? false : true );
}
/**
* Load static card(EDD/Woo) CSS.
*
* @since 3.0.0
* @return string static css for Woocommerce and EDD card.
*/
public static function load_cart_static_css() {
$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_h_color = astra_get_option( 'theme-button-border-group-border-h-color' );
$link_h_color = astra_get_option( 'link-h-color' );
$btn_bg_h_color = astra_get_option( 'button-bg-h-color', '', $link_h_color );
$normal_border_color = $btn_border_color ? $btn_border_color : $btn_bg_color;
$hover_border_color = $btn_border_h_color ? $btn_border_h_color : $btn_bg_h_color;
$is_site_rtl = is_rtl();
$ltr_left = $is_site_rtl ? 'right' : 'left';
$ltr_right = $is_site_rtl ? 'left' : 'right';
$cart_static_css = '
.ast-site-header-cart .cart-container,
.ast-edd-site-header-cart .ast-edd-cart-container {
transition: all 0.2s linear;
}
.ast-site-header-cart .ast-woo-header-cart-info-wrap,
.ast-edd-site-header-cart .ast-edd-header-cart-info-wrap {
padding: 0 6px 0 2px;
font-weight: 600;
line-height: 2.7;
display: inline-block;
}
.ast-site-header-cart i.astra-icon {
font-size: 20px;
font-size: 1.3em;
font-style: normal;
font-weight: normal;
position: relative;
padding: 0 2px;
}
.ast-site-header-cart i.astra-icon.no-cart-total:after,
.ast-header-break-point.ast-header-custom-item-outside .ast-edd-header-cart-info-wrap,
.ast-header-break-point.ast-header-custom-item-outside .ast-woo-header-cart-info-wrap {
display: none;
}
.ast-site-header-cart.ast-menu-cart-fill i.astra-icon,
.ast-edd-site-header-cart.ast-edd-menu-cart-fill span.astra-icon {
font-size: 1.1em;
}
.astra-cart-drawer {
position: fixed;
display: block;
visibility: hidden;
overflow: auto;
-webkit-overflow-scrolling: touch;
z-index: 10000;
background-color: var(--ast-global-color-primary, var(--ast-global-color-5));
transform: translate3d(0, 0, 0);
opacity: 0;
will-change: transform;
transition: 0.25s ease;
}
.woocommerce-mini-cart {
position: relative;
}
.woocommerce-mini-cart::before {
content: "";
transition: .3s;
}
.woocommerce-mini-cart.ajax-mini-cart-qty-loading::before {
position: absolute;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
z-index: 5;
background-color: var(--ast-global-color-primary, var(--ast-global-color-5));
opacity: .5;
}
.astra-cart-drawer {
width: 460px;
height: 100%;
' . $ltr_left . ': 100%;
top: 0px;
opacity: 1;
transform: translate3d(0%, 0, 0);
}
.astra-cart-drawer .astra-cart-drawer-header {
position: absolute;
width: 100%;
text-align: ' . $ltr_left . ';
text-transform: inherit;
font-weight: 500;
border-bottom: 1px solid var(--ast-border-color);
padding: 1.34em;
line-height: 1;
z-index: 1;
max-height: 3.5em;
}
.astra-cart-drawer .astra-cart-drawer-header .astra-cart-drawer-title {
color: var(--ast-global-color-2);
}
.astra-cart-drawer .astra-cart-drawer-close .ast-close-svg {
width: 22px;
height: 22px;
}
.astra-cart-drawer .astra-cart-drawer-content,
.astra-cart-drawer .astra-cart-drawer-content .widget_shopping_cart,
.astra-cart-drawer .astra-cart-drawer-content .widget_shopping_cart_content {
height: 100%;
}
.astra-cart-drawer .astra-cart-drawer-content {
padding-top: 3.5em;
}
.astra-cart-drawer .ast-mini-cart-price-wrap .multiply-symbol{
padding: 0 0.5em;
}
.astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart-item .ast-mini-cart-price-wrap {
float: ' . $ltr_right . ';
margin-top: 0.5em;
max-width: 50%;
}
.astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart-item .variation {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
.astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart-item .variation dt {
font-weight: 500;
}
.astra-cart-drawer .astra-cart-drawer-content .widget_shopping_cart_content {
display: flex;
flex-direction: column;
overflow: hidden;
}
.astra-cart-drawer .astra-cart-drawer-content .widget_shopping_cart_content ul li {
min-height: 60px;
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__total {
display: flex;
justify-content: space-between;
padding: 0.7em 1.34em;
margin-bottom: 0;
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__total strong,
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__total .amount {
width: 50%;
}
.astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart {
padding: 1.3em;
flex: 1;
overflow: auto;
}
.astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart a.remove {
width: 20px;
height: 20px;
line-height: 16px;
}
.astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__total {
padding: 1em 1.5em;
margin: 0;
text-align: center;
}
.astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons {
padding: 1.34em;
text-align: center;
margin-bottom: 0;
}
.astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons .button.checkout {
margin-' . $ltr_right . ': 0;
}
.astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons a{
width: 100%;
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons a:nth-last-child(1) {
margin-bottom: 0;
}
.astra-cart-drawer .astra-cart-drawer-content .edd-cart-item {
padding: .5em 2.6em .5em 1.5em;
}
.astra-cart-drawer .astra-cart-drawer-content .edd-cart-item .edd-remove-from-cart::after {
width: 20px;
height: 20px;
line-height: 16px;
}
.astra-cart-drawer .astra-cart-drawer-content .edd-cart-number-of-items {
padding: 1em 1.5em 1em 1.5em;
margin-bottom: 0;
text-align: center;
}
.astra-cart-drawer .astra-cart-drawer-content .edd_total {
padding: .5em 1.5em;
margin: 0;
text-align: center;
}
.astra-cart-drawer .astra-cart-drawer-content .cart_item.edd_checkout {
padding: 1em 1.5em 0;
text-align: center;
margin-top: 0;
}
.astra-cart-drawer .widget_shopping_cart_content > .woocommerce-mini-cart__empty-message {
display: none;
}
.astra-cart-drawer .woocommerce-mini-cart__empty-message,
.astra-cart-drawer .cart_item.empty {
text-align: center;
margin-top: 10px;
}
body.admin-bar .astra-cart-drawer {
padding-top: 32px;
}
@media (max-width: 782px) {
body.admin-bar .astra-cart-drawer {
padding-top: 46px;
}
}
.ast-mobile-cart-active body.ast-hfb-header {
overflow: hidden;
}
.ast-mobile-cart-active .astra-mobile-cart-overlay {
opacity: 1;
cursor: pointer;
visibility: visible;
z-index: 999;
}
.ast-mini-cart-empty-wrap {
display: flex;
flex-wrap: wrap;
height: 100%;
align-items: flex-end;
}
.ast-mini-cart-empty-wrap > * {
width: 100%;
}
.astra-cart-drawer-content .ast-mini-cart-empty {
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
text-align: center;
}
.astra-cart-drawer-content .ast-mini-cart-empty .ast-mini-cart-message {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
padding: 1.34em;
}
@media (min-width: 546px) {
.astra-cart-drawer .astra-cart-drawer-content.ast-large-view .woocommerce-mini-cart__buttons {
display: flex;
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content.ast-large-view .woocommerce-mini-cart__buttons a,
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content.ast-large-view .woocommerce-mini-cart__buttons a.checkout {
margin-top: 0;
margin-bottom: 0;
}
}
.ast-site-header-cart .cart-container:focus-visible {
display: inline-block;
}
';
if ( is_rtl() ) {
$cart_static_css .= '
.ast-site-header-cart i.astra-icon:after {
content: attr(data-cart-total);
position: absolute;
font-family: ' . astra_get_font_family( astra_body_font_family() ) . ';
font-style: normal;
top: -10px;
left: -12px;
font-weight: bold;
box-shadow: 1px 1px 3px 0px rgba(0, 0, 0, 0.3);
font-size: 11px;
padding-right: 0px;
padding-left: 2px;
line-height: 17px;
letter-spacing: -.5px;
height: 18px;
min-width: 18px;
border-radius: 99px;
text-align: center;
z-index: 3;
}
li.woocommerce-custom-menu-item .ast-site-header-cart i.astra-icon:after,
li.edd-custom-menu-item .ast-edd-site-header-cart span.astra-icon:after {
padding-right: 2px;
}
.astra-cart-drawer .astra-cart-drawer-close {
position: absolute;
top: 0.5em;
left: 0;
border: none;
margin: 0;
padding: .6em 1em .4em;
color: var(--ast-global-color-2);
background-color: transparent;
}
.astra-mobile-cart-overlay {
background-color: rgba(0, 0, 0, 0.4);
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
visibility: hidden;
opacity: 0;
transition: opacity 0.2s ease-in-out;
}
.astra-cart-drawer .astra-cart-drawer-content .edd-cart-item .edd-remove-from-cart {
left: 1.2em;
}
.ast-header-break-point.ast-woocommerce-cart-menu.ast-hfb-header .ast-cart-menu-wrap, .ast-header-break-point.ast-hfb-header .ast-cart-menu-wrap,
.ast-header-break-point .ast-edd-site-header-cart-wrap .ast-edd-cart-menu-wrap {
width: auto;
height: 2em;
font-size: 1.4em;
line-height: 2;
vertical-align: middle;
text-align: left;
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons .button:not(.checkout):not(.ast-continue-shopping) {
margin-left: 10px;
background-color: transparent;
border: 2px solid var( --ast-global-color-0 );
color: var( --ast-global-color-0 );
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons .button:not(.checkout):not(.ast-continue-shopping):hover {
border-color: var( --ast-global-color-1 );
color: var( --ast-global-color-1 );
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons a.checkout {
margin-right: 0;
margin-top: 10px;
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__total strong{
padding-left: .5em;
text-align: right;
font-weight: 500;
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__total .amount{
text-align: left;
}
.astra-cart-drawer.active {
transform: translate3d(100%, 0, 0);
visibility: visible;
}
';
} else {
$cart_static_css .= '
.ast-site-header-cart i.astra-icon:after {
content: attr(data-cart-total);
position: absolute;
font-family: ' . astra_get_font_family( astra_body_font_family() ) . ';
font-style: normal;
top: -10px;
right: -12px;
font-weight: bold;
box-shadow: 1px 1px 3px 0px rgba(0, 0, 0, 0.3);
font-size: 11px;
padding-left: 0px;
padding-right: 2px;
line-height: 17px;
letter-spacing: -.5px;
height: 18px;
min-width: 18px;
border-radius: 99px;
text-align: center;
z-index: 3;
}
li.woocommerce-custom-menu-item .ast-site-header-cart i.astra-icon:after,
li.edd-custom-menu-item .ast-edd-site-header-cart span.astra-icon:after {
padding-left: 2px;
}
.astra-cart-drawer .astra-cart-drawer-close {
position: absolute;
top: 0.5em;
right: 0;
border: none;
margin: 0;
padding: .6em 1em .4em;
color: var(--ast-global-color-2);
background-color: transparent;
}
.astra-mobile-cart-overlay {
background-color: rgba(0, 0, 0, 0.4);
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
visibility: hidden;
opacity: 0;
transition: opacity 0.2s ease-in-out;
}
.astra-cart-drawer .astra-cart-drawer-content .edd-cart-item .edd-remove-from-cart {
right: 1.2em;
}
.ast-header-break-point.ast-woocommerce-cart-menu.ast-hfb-header .ast-cart-menu-wrap, .ast-header-break-point.ast-hfb-header .ast-cart-menu-wrap,
.ast-header-break-point .ast-edd-site-header-cart-wrap .ast-edd-cart-menu-wrap {
width: auto;
height: 2em;
font-size: 1.4em;
line-height: 2;
vertical-align: middle;
text-align: right;
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons .button:not(.checkout):not(.ast-continue-shopping) {
margin-right: 10px;
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons .button:not(.checkout):not(.ast-continue-shopping),
.ast-site-header-cart .widget_shopping_cart .buttons .button:not(.checkout),
.ast-site-header-cart .ast-site-header-cart-data .ast-mini-cart-empty .woocommerce-mini-cart__buttons a.button {
background-color: transparent;
border-style: solid;
border-width: 1px;
border-color: ' . $normal_border_color . ';
color: ' . esc_attr( $normal_border_color ) . ';
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons .button:not(.checkout):not(.ast-continue-shopping):hover,
.ast-site-header-cart .widget_shopping_cart .buttons .button:not(.checkout):hover {
border-color: ' . $hover_border_color . ';
color: ' . esc_attr( $hover_border_color ) . ';
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons a.checkout {
margin-left: 0;
margin-top: 10px;
border-style: solid;
border-width: 2px;
border-color: ' . $normal_border_color . ';
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__buttons a.checkout:hover {
border-color: ' . $hover_border_color . ';
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__total strong{
padding-right: .5em;
text-align: left;
font-weight: 500;
}
.woocommerce-js .astra-cart-drawer .astra-cart-drawer-content .woocommerce-mini-cart__total .amount{
text-align: right;
}
.astra-cart-drawer.active {
transform: translate3d(-100%, 0, 0);
visibility: visible;
}
';
}
$cart_static_css .= '
.ast-site-header-cart.ast-menu-cart-outline .ast-cart-menu-wrap, .ast-site-header-cart.ast-menu-cart-fill .ast-cart-menu-wrap,
.ast-edd-site-header-cart.ast-edd-menu-cart-outline .ast-edd-cart-menu-wrap, .ast-edd-site-header-cart.ast-edd-menu-cart-fill .ast-edd-cart-menu-wrap {
line-height: 1.8;
}';
// This CSS requires in case of :before Astra icons. But in case of SVGs this loads twice that's why removed this from static & loading conditionally.
if ( false === Astra_Icons::is_svg_icons() ) {
$cart_static_css .= '
.ast-site-header-cart .cart-container *,
.ast-edd-site-header-cart .ast-edd-cart-container * {
transition: all 0s linear;
}
';
}
return $cart_static_css;
}
/**
* Check is new structural things are updated.
*
* @return bool true|false.
* @since 4.0.0
*/
public static function astra_check_default_color_typo() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_get_option_update_default_color_typo', isset( $astra_settings['update-default-color-typo'] ) ? false : true );
}
/**
* Check is new structural things are updated.
*
* @return bool true|false.
* @since 4.1.0
*/
public static function astra_woo_support_global_settings() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_get_option_woo_support_global_settings', isset( $astra_settings['woo_support_global_settings'] ) ? false : true );
}
/**
* Dynamic CSS to make Sidebar Sticky.
*
* @return string Sticky Sidebar CSS.
* @since 4.4.0
*/
public static function astra_sticky_sidebar_css() {
$css = '';
if ( astra_get_option( 'site-sticky-sidebar', false ) ) {
$sidebar_sticky_css = array(
'.ast-sticky-sidebar .sidebar-main' => array(
'top' => '50px',
'position' => 'sticky',
'overflow-y' => 'auto',
),
);
$sidebar_webkit_sticky_css = array(
'.ast-sticky-sidebar .sidebar-main' => array(
'position' => '-webkit-sticky',
),
);
$css .= astra_parse_css(
$sidebar_sticky_css,
astra_get_tablet_breakpoint( '', 1 )
);
$css .= astra_parse_css(
$sidebar_webkit_sticky_css,
astra_get_tablet_breakpoint( '', 1 )
);
}
return $css;
}
/**
* Dynamic CSS for default forms styling improvements.
*
* @return string Dynamic CSS.
* @since 4.6.0
*/
public static function astra_default_forms_styling_dynamic_css() {
$css = '';
$enable_site_accessibility = astra_get_option( 'site-accessibility-toggle', false );
$forms_default_styling_css = array(
'input[type="text"], input[type="number"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], input[type=reset], input[type=tel], input[type=date], select, textarea' => array(
'font-size' => '16px',
'font-style' => 'normal',
'font-weight' => '400',
'line-height' => '24px',
'width' => '100%',
'padding' => '12px 16px',
'border-radius' => '4px',
'box-shadow' => '0px 1px 2px 0px rgba(0, 0, 0, 0.05)',
'color' => 'var(--ast-form-input-text, #475569)',
),
'input[type="text"], input[type="number"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], input[type=reset], input[type=tel], input[type=date], select' => array(
'height' => '40px',
),
'input[type="date"]' => array(
'border-width' => '1px',
'border-style' => 'solid',
'border-color' => 'var(--ast-border-color)',
),
'input[type="text"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type=reset]:focus, input[type="tel"]:focus, input[type="date"]:focus, select:focus, textarea:focus' => array(
'border-color' => 'var(--ast-global-color-0, #046BD2)',
'box-shadow' => 'none',
'outline' => 'none',
'color' => 'var(--ast-form-input-focus-text, #475569)',
),
'label, legend' => array(
'color' => '#111827',
'font-size' => '14px',
'font-style' => 'normal',
'font-weight' => '500',
'line-height' => '20px',
),
'select' => array(
'padding' => '6px 10px',
),
'fieldset' => array(
'padding' => '30px',
'border-radius' => '4px',
),
'button, .ast-button, .button, input[type="button"], input[type="reset"], input[type="submit"]' => array(
'border-radius' => '4px',
'box-shadow' => '0px 1px 2px 0px rgba(0, 0, 0, 0.05)',
),
':root' => array(
'--ast-comment-inputs-background' => '#FFF',
),
'::placeholder' => array(
'color' => 'var(--ast-form-field-color, #9CA3AF)',
),
'::-ms-input-placeholder' => array( /* Edge 12-18 */
'color' => 'var(--ast-form-field-color, #9CA3AF)',
),
);
if ( defined( 'WPCF7_VERSION' ) ) {
$wpcf7_dynamic_css = array(
'.wpcf7 input.wpcf7-form-control:not([type=submit]), .wpcf7 textarea.wpcf7-form-control' => array(
'padding' => '12px 16px',
),
'.wpcf7 select.wpcf7-form-control' => array(
'padding' => '6px 10px',
),
'.wpcf7 input.wpcf7-form-control:not([type=submit]):focus, .wpcf7 select.wpcf7-form-control:focus, .wpcf7 textarea.wpcf7-form-control:focus' => array(
'border-color' => 'var(--ast-global-color-0, #046BD2)',
'box-shadow' => 'none',
'outline' => 'none',
'color' => 'var(--ast-form-input-focus-text, #475569)',
),
'.wpcf7 .wpcf7-not-valid-tip' => array(
'color' => '#DC2626',
'font-size' => '14px',
'font-weight' => '400',
'line-height' => '20px',
'margin-top' => '8px',
),
'.wpcf7 input[type=file].wpcf7-form-control' => array(
'font-size' => '16px',
'font-style' => 'normal',
'font-weight' => '400',
'line-height' => '24px',
'width' => '100%',
'padding' => '12px 16px',
'border-radius' => '4px',
'box-shadow' => '0px 1px 2px 0px rgba(0, 0, 0, 0.05)',
'color' => 'var(--ast-form-input-text, #475569)',
),
);
$forms_default_styling_css = array_merge( $forms_default_styling_css, $wpcf7_dynamic_css );
}
if ( class_exists( 'GFForms' ) ) {
$gravity_forms_dynamic_css = array(
'input[type="radio"].gfield-choice-input:checked, input[type="checkbox"].gfield-choice-input:checked, .ginput_container_consent input[type="checkbox"]:checked' => array(
'border-color' => 'inherit',
'background-color' => 'inherit',
),
'input[type="radio"].gfield-choice-input:focus, input[type="checkbox"].gfield-choice-input:focus, .ginput_container_consent input[type="checkbox"]:focus' => array(
'border-color' => 'var(--ast-global-color-0, #046BD2)',
'box-shadow' => 'none',
'outline' => 'none',
'color' => 'var(--ast-form-input-focus-text, #475569)',
),
);
$forms_default_styling_css = array_merge( $forms_default_styling_css, $gravity_forms_dynamic_css );
}
// Default form styling accessibility options compatibility.
if ( $enable_site_accessibility ) {
$outline_style = astra_get_option( 'site-accessibility-highlight-type' );
$outline_color = astra_get_option( 'site-accessibility-highlight-color' );
$outline_input_style = astra_get_option( 'site-accessibility-highlight-input-type' );
$outline_input_color = astra_get_option( 'site-accessibility-highlight-input-color' );
$input_highlight = ( 'unset' !== $outline_input_style );
$selected_outline_style = $input_highlight ? $outline_input_style : $outline_style;
$selected_outline_color = $input_highlight ? $outline_input_color : $outline_color;
$forms_default_styling_css['input[type="text"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type=reset]:focus, input[type="tel"]:focus, input[type="date"]:focus, select:focus, textarea:focus'] = array(
'border-color' => $selected_outline_color ? $selected_outline_color : '#046BD2',
'box-shadow' => 'none',
'outline' => 'none',
'color' => 'var(--ast-form-input-focus-text, #475569)',
);
// Contact form 7 accessibility compatibility.
if ( defined( 'WPCF7_VERSION' ) ) {
$forms_default_styling_css['.wpcf7 input.wpcf7-form-control:not([type=submit]):focus, .wpcf7 select.wpcf7-form-control:focus, .wpcf7 textarea.wpcf7-form-control:focus'] = array(
'border-style' => $selected_outline_style ? $selected_outline_style : 'inherit',
'border-color' => $selected_outline_color ? $selected_outline_color : '#046BD2',
'border-width' => 'thin',
'box-shadow' => 'none',
'outline' => 'none',
'color' => 'var(--ast-form-input-focus-text, #475569)',
);
}
// Gravity forms accessibility compatibility.
if ( class_exists( 'GFForms' ) ) {
$forms_default_styling_css['input[type="radio"].gfield-choice-input:focus, input[type="checkbox"].gfield-choice-input:focus, .ginput_container_consent input[type="checkbox"]:focus'] = array(
'border-style' => $selected_outline_style ? $selected_outline_style : 'inherit',
'border-color' => $selected_outline_color ? $selected_outline_color : '#046BD2',
'border-width' => 'thin',
'box-shadow' => 'none',
'outline' => 'none',
'color' => 'var(--ast-form-input-focus-text, #475569)',
);
}
}
$css .= astra_parse_css( $forms_default_styling_css );
return $css;
}
/**
* Check if fullwidth layout with sidebar is supported.
* Old users - yes
* New users - no
*
* @return bool true|false.
* @since 4.2.0
*/
public static function astra_fullwidth_sidebar_support() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_get_option_fullwidth_sidebar_support', isset( $astra_settings['fullwidth_sidebar_support'] ) ? false : true );
}
/**
* Core Comment & Search Button Styling Compatibility.
* Old Users - Will not reflect directly.
* New Users - Direct reflection
*
* @return bool true|false.
* @since 4.2.2
*/
public static function astra_core_form_btns_styling() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_core_form_btns_styling', isset( $astra_settings['v4-2-2-core-form-btns-styling'] ) ? false : true );
}
/**
* Load Blog Layout static CSS when it is enabled.
*
* @since 4.6.0
*/
public static function blog_layout_static_css() {
$bl_selector = '.ast-blog-layout-6-grid';
$blog_layout_css = '
' . $bl_selector . ' .ast-blog-featured-section:before {
content: "";
}
';
return $blog_layout_css;
}
/**
* Improve full screen search Submit button style.
*
* @since 4.4.0
* @return boolean false if it is an existing user, true if not.
*/
public static function astra_4_4_0_compatibility() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_addon_upgrade_fullscreen_search_submit_style', isset( $astra_settings['v4-4-0-backward-option'] ) ? false : true );
}
/**
* Check version 4.5.0 backward compatibility.
*
* @since 4.5.0
* @return boolean false if it is an existing user, true if not.
*/
public static function astra_4_5_0_compatibility() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_upgrade_color_styles', isset( $astra_settings['v4-5-0-backward-option'] ) ? false : true );
}
/**
* In 4.6.0 version we are having new stylings.
* 1. Comments area refined.
* 2. Defaults improvement for single-blog layouts.
* 3. Form default UI improved.
*
* @return bool true|false.
* @since 4.6.0
*/
public static function astra_4_6_0_compatibility() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_get_option_v4-6-0-backward-option', isset( $astra_settings['v4-6-0-backward-option'] ) ? false : true );
}
/**
* In 4.6.2 version we are having new stylings.
* 1. Keeping meta featured image disable option useless for old users.
*
* @return bool true|false.
* @since 4.6.2
*/
public static function astra_4_6_2_compatibility() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_get_option_v4-6-2-backward-option', isset( $astra_settings['v4-6-2-backward-option'] ) ? false : true );
}
/**
* Upgrade Astra default button stylings & compatibility with Spectra buttons.
*
* @return bool true|false.
* @since 4.6.4
*/
public static function astra_4_6_4_compatibility() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_get_option_btn-stylings-upgrade', isset( $astra_settings['btn-stylings-upgrade'] ) ? false : true );
}
/**
* Handle backward compatibility for heading `clear:both` css in single posts and pages.
*
* @return bool true|false If returns true then set `clear:none`.
* @since 4.6.12
*/
public static function astra_headings_clear_compatibility() {
$astra_settings = astra_get_options();
/**
* If `single_posts_pages_heading_clear_none` is set then this user is probably old user
* so in that case, we will not convert the "clear:both" to "clear:none" for old users.
*/
return apply_filters( 'astra_get_option_single_posts_pages_heading_clear_none', isset( $astra_settings['single_posts_pages_heading_clear_none'] ) ? false : true );
}
/**
* Single post outside padding was not working.
*
* @return bool true|false.
* @since 4.8.2
*/
public static function astra_4_8_2_compatibility() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_get_option_v4-8-2-backward-option', isset( $astra_settings['v4-8-2-backward-option'] ) ? false : true );
}
/**
* Restrict unitless support to body font by default.
*
* 1. Unitless line-height support.
* 2. Font-size of h5-h6 default update.
*
* @since 4.6.14
* @return bool true|false.
*/
public static function astra_4_6_14_compatibility() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_get_option_enable-4-6-14-compatibility', isset( $astra_settings['enable-4-6-14-compatibility'] ) ? false : true );
}
/**
* Upgrade Astra secondary button border to look style guide in sync.
*
* @return bool true|false.
* @since 4.8.0
*/
public static function astra_4_8_0_compatibility() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_get_option_enable-4-8-0-compatibility', isset( $astra_settings['enable-4-8-0-compatibility'] ) ? false : true );
}
/**
* Added compatibility for alignwide Spectra container width.
*
* @return bool true|false.
* @since 4.8.4
*/
public static function astra_4_8_4_compatibility() {
$astra_settings = astra_get_options();
return apply_filters( 'astra_get_option_enable-4-8-4-compatibility', isset( $astra_settings['enable-4-8-4-compatibility'] ) ? false : true );
}
/**
* In 4.8.9 version we are having following compatibilities.
* 1. Color sequence & tooltips updated (AST-3809).
*
* @return bool true|false.
* @since 4.8.9
*/
public static function astra_4_8_9_compatibility() {
$astra_settings = get_option( ASTRA_THEME_SETTINGS );
return apply_filters( 'astra_get_option_enable-4-8-9-compatibility', isset( $astra_settings['enable-4-8-9-compatibility'] ) ? false : true );
}
}
}
PK VmZ< < &