From 9d4123cee1867ee7199b06bdc92d40611f547ecc Mon Sep 17 00:00:00 2001 From: Zach van Rijn Date: Wed, 21 Jul 2021 14:54:07 -0500 Subject: Initial unmodified import from Astra (Version: 3.6.5) @ /wp-content/themes/astra/. --- inc/compatibility/class-astra-amp.php | 1209 +++++++++++++ .../class-astra-bb-ultimate-addon.php | 428 +++++ inc/compatibility/class-astra-beaver-builder.php | 113 ++ inc/compatibility/class-astra-beaver-themer.php | 410 +++++ inc/compatibility/class-astra-bne-flyout.php | 68 + inc/compatibility/class-astra-contact-form-7.php | 74 + inc/compatibility/class-astra-divi-builder.php | 68 + inc/compatibility/class-astra-elementor-pro.php | 424 +++++ inc/compatibility/class-astra-elementor.php | 254 +++ inc/compatibility/class-astra-gravity-forms.php | 74 + inc/compatibility/class-astra-jetpack.php | 83 + inc/compatibility/class-astra-site-origin.php | 68 + inc/compatibility/class-astra-ubermeu.php | 87 + inc/compatibility/class-astra-visual-composer.php | 141 ++ inc/compatibility/class-astra-web-stories.php | 97 ++ inc/compatibility/class-astra-yoast-seo.php | 40 + inc/compatibility/edd/class-astra-edd.php | 1087 ++++++++++++ ...class-astra-customizer-register-edd-section.php | 67 + .../sections/class-astra-edd-container-configs.php | 64 + .../sections/class-astra-edd-sidebar-configs.php | 84 + .../class-astra-edd-archive-layout-configs.php | 214 +++ ...ass-astra-edd-single-product-layout-configs.php | 57 + inc/compatibility/edd/edd-common-functions.php | 324 ++++ inc/compatibility/index.php | 9 + .../learndash/class-astra-learndash.php | 677 ++++++++ ...astra-customizer-register-learndash-section.php | 50 + .../class-astra-learndash-container-configs.php | 63 + .../class-astra-learndash-sidebar-configs.php | 62 + .../class-astra-learndash-general-configs.php | 72 + .../lifterlms/class-astra-lifterlms.php | 858 +++++++++ .../class-astra-liferlms-section-configs.php | 60 + .../class-astra-lifter-container-configs.php | 66 + .../class-astra-lifter-sidebar-configs.php | 80 + .../layout/class-astra-lifter-general-configs.php | 104 ++ .../woocommerce/class-astra-woocommerce.php | 1819 ++++++++++++++++++++ ...class-astra-customizer-register-woo-section.php | 74 + .../class-astra-woo-shop-container-configs.php | 64 + .../class-astra-woo-shop-sidebar-configs.php | 84 + .../class-astra-woo-shop-cart-layout-configs.php | 57 + .../layout/class-astra-woo-shop-layout-configs.php | 158 ++ .../class-astra-woo-shop-single-layout-configs.php | 80 + .../woocommerce/woocommerce-common-functions.php | 299 ++++ 42 files changed, 10271 insertions(+) create mode 100644 inc/compatibility/class-astra-amp.php create mode 100644 inc/compatibility/class-astra-bb-ultimate-addon.php create mode 100644 inc/compatibility/class-astra-beaver-builder.php create mode 100644 inc/compatibility/class-astra-beaver-themer.php create mode 100644 inc/compatibility/class-astra-bne-flyout.php create mode 100644 inc/compatibility/class-astra-contact-form-7.php create mode 100644 inc/compatibility/class-astra-divi-builder.php create mode 100644 inc/compatibility/class-astra-elementor-pro.php create mode 100644 inc/compatibility/class-astra-elementor.php create mode 100644 inc/compatibility/class-astra-gravity-forms.php create mode 100644 inc/compatibility/class-astra-jetpack.php create mode 100644 inc/compatibility/class-astra-site-origin.php create mode 100644 inc/compatibility/class-astra-ubermeu.php create mode 100644 inc/compatibility/class-astra-visual-composer.php create mode 100644 inc/compatibility/class-astra-web-stories.php create mode 100644 inc/compatibility/class-astra-yoast-seo.php create mode 100644 inc/compatibility/edd/class-astra-edd.php create mode 100644 inc/compatibility/edd/customizer/class-astra-customizer-register-edd-section.php create mode 100644 inc/compatibility/edd/customizer/sections/class-astra-edd-container-configs.php create mode 100644 inc/compatibility/edd/customizer/sections/class-astra-edd-sidebar-configs.php create mode 100644 inc/compatibility/edd/customizer/sections/layout/class-astra-edd-archive-layout-configs.php create mode 100644 inc/compatibility/edd/customizer/sections/layout/class-astra-edd-single-product-layout-configs.php create mode 100644 inc/compatibility/edd/edd-common-functions.php create mode 100644 inc/compatibility/index.php create mode 100644 inc/compatibility/learndash/class-astra-learndash.php create mode 100644 inc/compatibility/learndash/customizer/class-astra-customizer-register-learndash-section.php create mode 100644 inc/compatibility/learndash/customizer/sections/class-astra-learndash-container-configs.php create mode 100644 inc/compatibility/learndash/customizer/sections/class-astra-learndash-sidebar-configs.php create mode 100644 inc/compatibility/learndash/customizer/sections/layout/class-astra-learndash-general-configs.php create mode 100644 inc/compatibility/lifterlms/class-astra-lifterlms.php create mode 100644 inc/compatibility/lifterlms/customizer/class-astra-liferlms-section-configs.php create mode 100644 inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-container-configs.php create mode 100644 inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-sidebar-configs.php create mode 100644 inc/compatibility/lifterlms/customizer/sections/layout/class-astra-lifter-general-configs.php create mode 100644 inc/compatibility/woocommerce/class-astra-woocommerce.php create mode 100644 inc/compatibility/woocommerce/customizer/class-astra-customizer-register-woo-section.php create mode 100644 inc/compatibility/woocommerce/customizer/sections/class-astra-woo-shop-container-configs.php create mode 100644 inc/compatibility/woocommerce/customizer/sections/class-astra-woo-shop-sidebar-configs.php create mode 100644 inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-cart-layout-configs.php create mode 100644 inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-layout-configs.php create mode 100644 inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-single-layout-configs.php create mode 100644 inc/compatibility/woocommerce/woocommerce-common-functions.php (limited to 'inc/compatibility') diff --git a/inc/compatibility/class-astra-amp.php b/inc/compatibility/class-astra-amp.php new file mode 100644 index 0000000..f8c1468 --- /dev/null +++ b/inc/compatibility/class-astra-amp.php @@ -0,0 +1,1209 @@ + array( + 'display' => 'none', + ), + + '#ast-mobile-header' => array( + 'display' => 'block', + ), + + '.ast-amp.ast-main-header-nav-open .ast-mobile-header-content' => array( + 'display' => 'block', + ), + + '.ast-mobile-header-content .ast-main-header-bar-alignment.toggle-on .main-header-bar-navigation' => array( + 'display' => 'block', + ), + + '.ast-amp .ast-mobile-header-content .main-navigation ul .menu-item .menu-link' => array( + 'padding' => '0 20px', + 'display' => 'inline-block', + 'width' => '100%', + 'border' => '0', + 'border-bottom-width' => '1px', + 'border-style' => 'solid', + 'border-color' => '#eaeaea', + ), + + '.ast-amp .ast-mobile-header-content .toggled-on .main-header-bar-navigation' => array( + 'line-height' => '3', + 'display' => 'none', + ), + '.ast-amp .ast-mobile-header-content .main-header-bar-navigation .sub-menu' => array( + 'line-height' => '3', + ), + '.ast-amp .ast-mobile-header-content .main-header-bar-navigation .menu-item-has-children .sub-menu' => array( + 'display' => 'none', + ), + '.ast-amp .ast-mobile-header-content .main-header-bar-navigation .menu-item-has-children .dropdown-open+ul.sub-menu' => array( + 'display' => 'block', + ), + '.ast-amp .ast-mobile-header-content .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle' => array( + 'display' => 'inline-block', + 'position' => 'absolute', + 'font-size' => 'inherit', + 'top' => '-1px', + 'right' => '20px', + 'cursor' => 'pointer', + 'webkit-font-smoothing' => 'antialiased', + 'moz-osx-font-smoothing' => 'grayscale', + 'padding' => '0 0.907em', + 'font-weight' => 'normal', + 'line-height' => 'inherit', + 'transition' => 'all 0.2s', + ), + '.ast-amp .ast-mobile-header-content .main-header-bar-navigation .ast-submenu-expanded > .ast-menu-toggle::before' => array( + '-webkit-transform' => 'rotateX(180deg)', + 'transform' => 'rotateX(180deg)', + ), + '.ast-amp .ast-mobile-header-content .main-header-bar-navigation .main-header-menu' => array( + 'border-top-width' => '1px', + 'border-style' => 'solid', + 'border-color' => '#eaeaea', + ), + '.ast-amp .ast-below-header-bar, .ast-amp .main-header-bar, .ast-amp .ast-above-header-bar' => array( + 'display' => 'grid', + ), + ); + if ( false === Astra_Icons::is_svg_icons() ) { + $css['.ast-amp .ast-mobile-header-content .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', + ); + } + } else { + $css = array( + '.ast-mobile-menu-buttons' => array( + 'text-align' => 'right', + '-js-display' => 'flex', + 'display' => '-webkit-box', + 'display' => '-webkit-flex', + 'display' => '-moz-box', + 'display' => '-ms-flexbox', + 'display' => 'flex', + '-webkit-box-pack' => 'end', + '-webkit-justify-content' => 'flex-end', + '-moz-box-pack' => 'end', + '-ms-flex-pack' => 'end', + 'justify-content' => 'flex-end', + '-webkit-align-self' => 'center', + '-ms-flex-item-align' => 'center', + 'align-self' => 'center', + ), + '.header-main-layout-1 .main-navigation' => array( + 'padding' => '0', + ), + ); + } + + $parse_css = $compiled_css . astra_parse_css( $css, '', astra_header_break_point() ); + + $css = array( + + '.site-header .main-header-bar-wrap .site-branding' => array( + 'display' => '-webkit-box', + 'display' => '-webkit-flex', + 'display' => '-moz-box', + 'display' => '-ms-flexbox', + 'display' => 'flex', + '-webkit-box-flex' => '1', + '-webkit-flex' => '1', + '-moz-box-flex' => '1', + '-ms-flex' => '1', + 'flex' => '1', + '-webkit-align-self' => 'center', + '-ms-flex-item-align' => 'center', + 'align-self' => 'center', + ), + + '.ast-main-header-bar-alignment.toggle-on .main-header-bar-navigation' => array( + 'display' => 'block', + ), + + '.main-navigation' => array( + 'display' => 'block', + 'width' => '100%', + ), + + '.main-header-menu > .menu-item > .menu-link' => array( + 'padding' => '0 20px', + 'display' => 'inline-block', + 'width' => '100%', + 'border-bottom-width' => '1px', + 'border-style' => 'solid', + 'border-color' => '#eaeaea', + ), + + '.ast-main-header-bar-alignment.toggle-on' => array( + 'display' => 'block', + 'width' => '100%', + '-webkit-box-flex' => '1', + '-webkit-flex' => 'auto', + '-moz-box-flex' => '1', + '-ms-flex' => 'auto', + 'flex' => 'auto', + '-webkit-box-ordinal-group' => '5', + '-webkit-order' => '4', + '-moz-box-ordinal-group' => '5', + '-ms-flex-order' => '4', + 'order' => '4', + ), + + '.main-header-menu .menu-item' => array( + 'width' => '100%', + 'text-align' => 'left', + 'border-top' => '0', + ), + + '.main-header-bar-navigation' => array( + 'width' => '-webkit-calc( 100% + 40px)', + 'width' => 'calc( 100% + 40px)', + 'margin' => '0 -20px', + ), + + '.main-header-bar .main-header-bar-navigation .main-header-menu' => array( + 'border-top-width' => '1px', + 'border-style' => 'solid', + 'border-color' => '#eaeaea', + ), + + '.main-header-bar .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle' => array( + 'display' => 'inline-block', + 'position' => 'absolute', + 'font-size' => 'inherit', + 'top' => '-1px', + 'right' => '20px', + 'cursor' => 'pointer', + '-webkit-font-smoothing' => 'antialiased', + '-moz-osx-font-smoothing' => 'grayscale', + 'padding' => '0 0.907em', + 'font-weight' => 'normal', + 'line-height' => 'inherit', + '-webkit-transition' => 'all .2s', + 'transition' => 'all .2s', + ), + ); + + if ( false === Astra_Icons::is_svg_icons() ) { + $css['.main-header-bar-navigation .menu-item-has-children > .menu-link:after'] = array( + 'content' => 'none', + ); + $css['.ast-button-wrap .menu-toggle.toggled .menu-toggle-icon:before'] = array( + 'content' => "\e5cd", + ); + $css['.main-header-bar .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', + ); + } + + $parse_css .= astra_parse_css( $css, '', astra_header_break_point() ); + + if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { + + $astra_break_point_navigation = array( + '.ast-amp .main-header-bar-navigation' => array( + 'margin' => '0', + ), + ); + + } else { + $astra_break_point_navigation = array( + '.ast-amp .main-header-bar-navigation' => array( + 'margin' => '0 -20px', + ), + '.ast-amp .ast-mobile-menu-buttons' => array( + 'text-align' => 'right', + '-js-display' => 'flex', + 'display' => '-webkit-box', + 'display' => '-webkit-flex', + 'display' => '-moz-box', + 'display' => '-ms-flexbox', + 'display' => 'flex', + '-webkit-box-pack' => 'end', + '-webkit-justify-content' => 'flex-end', + '-moz-box-pack' => 'end', + '-ms-flex-pack' => 'end', + 'justify-content' => 'flex-end', + '-webkit-align-self' => 'center', + '-ms-flex-item-align' => 'center', + 'align-self' => 'center', + ), + '.ast-theme.ast-header-custom-item-outside .main-header-bar .ast-search-icon' => array( + 'margin-right' => '1em', + ), + '.ast-theme.ast-header-custom-item-inside .main-header-bar .main-header-bar-navigation .ast-search-icon' => array( + 'display' => 'none', + ), + '.ast-theme.ast-header-custom-item-inside .main-header-bar .ast-search-menu-icon .search-field, .ast-theme.ast-header-custom-item-inside .main-header-bar .ast-search-menu-icon.ast-inline-search .search-field' => array( + 'width' => '100%', + 'padding-right' => '5.5em', + ), + '.ast-theme.ast-header-custom-item-inside .main-header-bar .ast-search-menu-icon .search-submit' => array( + 'display' => 'block', + 'position' => 'absolute', + 'height' => '100%', + 'top' => '0', + 'right' => '0', + 'padding' => '0 1em', + 'border-radius' => '0', + ), + '.ast-theme.ast-header-custom-item-inside .main-header-bar .ast-search-menu-icon .search-form' => array( + 'padding' => '0', + 'display' => 'block', + 'overflow' => 'hidden', + ), + '.ast-amp .ast-header-custom-item' => array( + 'background-color' => '#f9f9f9', + ), + '.ast-amp .ast-mobile-header-stack .site-description' => array( + 'text-align' => 'center', + ), + '.ast-amp .ast-mobile-header-stack.ast-logo-title-inline .site-description' => array( + 'text-align' => 'left', + ), + '.ast-theme.ast-header-custom-item-outside .ast-primary-menu-disabled .ast-mobile-menu-buttons' => array( + 'display' => 'none', + ), + '.ast-amp .ast-hide-custom-menu-mobile .ast-masthead-custom-menu-items' => array( + 'display' => 'none', + ), + '.ast-amp .ast-mobile-header-inline .site-branding' => array( + 'text-align' => 'left', + 'padding-bottom' => '0', + ), + '.ast-amp .ast-mobile-header-inline.header-main-layout-3 .site-branding' => array( + 'text-align' => 'right', + ), + '.ast-amp ul li.ast-masthead-custom-menu-items a' => array( + 'padding' => '0', + 'width' => 'auto', + 'display' => 'initial', + ), + '.ast-amp li.ast-masthead-custom-menu-items' => array( + 'padding-left' => '20px', + 'padding-right' => '20px', + 'margin-bottom' => '1em', + 'margin-top' => '1em', + ), + '.ast-theme.ast-header-custom-item-inside .ast-search-menu-icon' => array( + 'position' => 'relative', + 'display' => 'block', + 'right' => 'auto', + 'visibility' => 'visible', + 'opacity' => '1', + '-webkit-transform' => 'none', + '-ms-transform' => 'none', + 'transform' => 'none', + ), + '.ast-theme.ast-header-custom-item-outside .ast-mobile-menu-buttons' => array( + '-webkit-box-ordinal-group' => '3', + '-webkit-order' => '2', + '-moz-box-ordinal-group' => '3', + '-ms-flex-order' => '2', + 'order' => '2', + ), + '.ast-theme.ast-header-custom-item-outside .main-header-bar-navigation' => array( + '-webkit-box-ordinal-group' => '4', + '-webkit-order' => '3', + '-moz-box-ordinal-group' => '4', + '-ms-flex-order' => '3', + 'order' => '3', + ), + '.ast-theme.ast-header-custom-item-outside .ast-masthead-custom-menu-items' => array( + '-webkit-box-ordinal-group' => '2', + '-webkit-order' => '1', + '-moz-box-ordinal-group' => '2', + '-ms-flex-order' => '1', + 'order' => '1', + ), + '.ast-theme.ast-header-custom-item-outside .header-main-layout-2 .ast-masthead-custom-menu-items' => array( + 'text-align' => 'center', + ), + '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline .site-branding, .ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline .ast-mobile-menu-buttons' => array( + '-js-display' => 'flex', + 'display' => '-webkit-box', + 'display' => '-webkit-flex', + 'display' => '-moz-box', + 'display' => '-ms-flexbox', + 'display' => 'flex', + ), + '.ast-theme.ast-header-custom-item-outside.ast-header-custom-item-outside .header-main-layout-2 .ast-mobile-menu-buttons' => array( + 'padding-bottom' => '0', + ), + '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline .ast-site-identity' => array( + 'width' => '100%', + ), + '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline.header-main-layout-3 .ast-site-identity' => array( + 'width' => 'auto', + ), + '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline.header-main-layout-2 .site-branding' => array( + '-webkit-box-flex' => '1', + '-webkit-flex' => '1 1 auto', + '-moz-box-flex' => '1', + '-ms-flex' => '1 1 auto', + 'flex' => '1 1 auto', + ), + '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline .site-branding' => array( + 'text-align' => 'left', + ), + '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline .site-title' => array( + '-webkit-box-pack' => 'left', + '-webkit-justify-content' => 'left', + '-moz-box-pack' => 'left', + '-ms-flex-pack' => 'left', + 'justify-content' => 'left', + ), + '.ast-theme.ast-header-custom-item-outside .header-main-layout-2 .ast-mobile-menu-buttons' => array( + 'padding-bottom' => '1em', + ), + '.ast-amp .ast-mobile-header-stack .main-header-container, .ast-amp .ast-mobile-header-inline .main-header-container' => array( + '-js-display' => 'flex', + 'display' => '-webkit-box', + 'display' => '-webkit-flex', + 'display' => '-moz-box', + 'display' => '-ms-flexbox', + 'display' => 'flex', + ), + '.ast-amp .header-main-layout-1 .site-branding' => array( + 'padding-right' => '1em', + ), + '.ast-amp .header-main-layout-1 .main-header-bar-navigation' => array( + 'text-align' => 'left', + ), + '.ast-amp .header-main-layout-1 .main-navigation' => array( + 'padding-left' => '0', + ), + '.ast-amp .ast-mobile-header-stack .ast-masthead-custom-menu-items' => array( + '-webkit-box-flex' => '1', + '-webkit-flex' => '1 1 100%', + '-moz-box-flex' => '1', + '-ms-flex' => '1 1 100%', + 'flex' => '1 1 100%', + ), + '.ast-amp .ast-mobile-header-stack .site-branding' => array( + 'padding-left' => '0', + 'padding-right' => '0', + 'padding-bottom' => '1em', + '-webkit-box-flex' => '1', + '-webkit-flex' => '1 1 100%', + '-moz-box-flex' => '1', + '-ms-flex' => '1 1 100%', + 'flex' => '1 1 100%', + ), + '.ast-amp .ast-mobile-header-stack .ast-masthead-custom-menu-items, .ast-amp .ast-mobile-header-stack .site-branding, .ast-amp .ast-mobile-header-stack .site-title, .ast-amp .ast-mobile-header-stack .ast-site-identity' => array( + '-webkit-box-pack' => 'center', + '-webkit-justify-content' => 'center', + '-moz-box-pack' => 'center', + '-ms-flex-pack' => 'center', + 'justify-content' => 'center', + 'text-align' => 'center', + ), + '.ast-amp .ast-mobile-header-stack.ast-logo-title-inline .site-title' => array( + 'text-align' => 'left', + ), + '.ast-amp .ast-mobile-header-stack .ast-mobile-menu-buttons' => array( + '-webkit-box-flex' => '1', + '-webkit-flex' => '1 1 100%', + '-moz-box-flex' => '1', + '-ms-flex' => '1 1 100%', + 'flex' => '1 1 100%', + 'text-align' => 'center', + '-webkit-box-pack' => 'center', + '-webkit-justify-content' => 'center', + '-moz-box-pack' => 'center', + '-ms-flex-pack' => 'center', + 'justify-content' => 'center', + ), + '.ast-amp .ast-mobile-header-stack.header-main-layout-3 .main-header-container' => array( + 'flex-direction' => 'initial', + ), + '.ast-amp .header-main-layout-2 .ast-mobile-menu-buttons' => 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', + ), + '.ast-amp .header-main-layout-2 .main-header-bar-navigation, .ast-amp .header-main-layout-2 .widget' => array( + 'text-align' => 'left', + ), + '.ast-theme.ast-header-custom-item-outside .header-main-layout-3 .main-header-bar .ast-search-icon' => array( + 'margin-right' => 'auto', + 'margin-left' => '1em', + ), + '.ast-amp .header-main-layout-3 .main-header-bar .ast-search-menu-icon.slide-search .search-form' => array( + 'right' => 'auto', + 'left' => '0', + ), + '.ast-amp .header-main-layout-3.ast-mobile-header-inline .ast-mobile-menu-buttons' => array( + '-webkit-box-pack' => 'start', + '-webkit-justify-content' => 'flex-start', + '-moz-box-pack' => 'start', + '-ms-flex-pack' => 'start', + 'justify-content' => 'flex-start', + ), + '.ast-amp .header-main-layout-3 li .ast-search-menu-icon' => array( + 'left' => '0', + ), + '.ast-amp .header-main-layout-3 .site-branding' => array( + 'padding-left' => '1em', + '-webkit-box-pack' => 'end', + '-webkit-justify-content' => 'flex-end', + '-moz-box-pack' => 'end', + '-ms-flex-pack' => 'end', + 'justify-content' => 'flex-end', + ), + '.ast-amp .header-main-layout-3 .main-navigation' => array( + 'padding-right' => '0', + ), + '.ast-amp .header-main-layout-1 .site-branding' => array( + 'padding-right' => '1em', + ), + '.ast-amp .header-main-layout-1 .main-header-bar-navigation' => array( + 'text-align' => 'left', + ), + '.ast-amp .header-main-layout-1 .main-navigation' => array( + 'padding-left' => '0', + ), + '.ast-amp .ast-mobile-header-stack .ast-masthead-custom-menu-items' => array( + '-webkit-box-flex' => '1', + '-webkit-flex' => '1 1 100%', + '-moz-box-flex' => '1', + '-ms-flex' => '1 1 100%', + 'flex' => '1 1 100%', + ), + '.ast-amp .ast-mobile-header-stack .site-branding' => array( + 'padding-left' => '0', + 'padding-right' => '0', + 'padding-bottom' => '1em', + '-webkit-box-flex' => '1', + '-webkit-flex' => '1 1 100%', + '-moz-box-flex' => '1', + '-ms-flex' => '1 1 100%', + 'flex' => '1 1 100%', + ), + '.ast-amp .ast-mobile-header-stack .ast-masthead-custom-menu-items, .ast-amp .ast-mobile-header-stack .site-branding, .ast-amp .ast-mobile-header-stack .site-title, .ast-amp .ast-mobile-header-stack .ast-site-identity' => array( + '-webkit-box-pack' => 'center', + '-webkit-justify-content' => 'center', + '-moz-box-pack' => 'center', + '-ms-flex-pack' => 'center', + 'justify-content' => 'center', + 'text-align' => 'center', + ), + '.ast-amp .ast-mobile-header-stack.ast-logo-title-inline .site-title' => array( + 'text-align' => 'left', + ), + '.ast-amp .ast-mobile-header-stack .ast-mobile-menu-buttons' => array( + 'flex' => '1 1 100%', + 'text-align' => 'center', + '-webkit-box-pack' => 'center', + '-webkit-justify-content' => 'center', + '-moz-box-pack' => 'center', + '-ms-flex-pack' => 'center', + 'justify-content' => 'center', + ), + '.ast-amp .ast-mobile-header-stack.header-main-layout-3 .main-header-container' => array( + 'flex-direction' => 'initial', + ), + '.ast-amp .header-main-layout-2 .ast-mobile-menu-buttons' => array( + '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', + ), + '.ast-amp .header-main-layout-2 .main-header-bar-navigation, .ast-amp .header-main-layout-2 .widget' => array( + 'text-align' => 'left', + ), + '.ast-theme.ast-header-custom-item-outside .header-main-layout-3 .main-header-bar .ast-search-icon' => array( + 'margin-right' => 'auto', + 'margin-left' => '1em', + ), + '.ast-amp .header-main-layout-3 .main-header-bar .ast-search-menu-icon.slide-search .search-form' => array( + 'right' => 'auto', + 'left' => '0', + ), + '.ast-amp .header-main-layout-3.ast-mobile-header-inline .ast-mobile-menu-buttons' => array( + '-webkit-box-pack' => 'start', + '-webkit-justify-content' => 'flex-start', + '-moz-box-pack' => 'start', + '-ms-flex-pack' => 'start', + 'justify-content' => 'flex-start', + ), + '.ast-amp .header-main-layout-3 li .ast-search-menu-icon' => array( + 'left' => '0', + ), + '.ast-amp .header-main-layout-3 .site-branding' => array( + 'padding-left' => '1em', + '-webkit-box-pack' => 'end', + '-webkit-justify-content' => 'flex-end', + '-moz-box-pack' => 'end', + '-ms-flex-pack' => 'end', + 'justify-content' => 'flex-end', + ), + '.ast-amp .header-main-layout-3 .main-navigation' => array( + 'padding-right' => '0', + ), + '.ast-amp .ast-header-custom-item' => array( + 'border-top' => '1px solid #eaeaea', + ), + '.ast-amp .ast-header-custom-item .ast-masthead-custom-menu-items' => array( + 'padding-left' => '20px', + 'padding-right' => '20px', + 'margin-bottom' => '1em', + 'margin-top' => '1em', + ), + '.ast-amp .ast-header-custom-item .widget:last-child' => array( + 'margin-bottom' => '1em', + ), + '.ast-header-custom-item-inside.ast-amp .button-custom-menu-item .menu-link' => array( + 'display' => 'block', + ), + '.ast-header-custom-item-inside.ast-amp .button-custom-menu-item' => array( + 'padding-left' => '0', + 'padding-right' => '0', + 'margin-top' => '0', + 'margin-bottom' => '0', + ), + '.ast-header-custom-item-inside.ast-amp .button-custom-menu-item .ast-custom-button-link' => array( + 'display' => 'none', + ), + '.ast-header-custom-item-inside.ast-amp .button-custom-menu-item .menu-link' => array( + 'display' => 'block', + ), + '.ast-amp .woocommerce-custom-menu-item .ast-cart-menu-wrap' => array( + 'width' => '2em', + 'height' => '2em', + 'font-size' => '1.4em', + 'line-height' => '2', + 'vertical-align' => 'middle', + 'text-align' => 'right', + ), + '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-3 .ast-site-header-cart' => array( + 'padding' => '0 0 1em 1em', + ), + '.ast-theme.ast-woocommerce-cart-menu.ast-header-custom-item-outside .ast-site-header-cart' => array( + 'padding' => '0', + ), + '.ast-amp .ast-masthead-custom-menu-items.woocommerce-custom-menu-item' => array( + 'margin-bottom' => '0', + 'margin-top' => '0', + ), + '.ast-amp .ast-masthead-custom-menu-items.woocommerce-custom-menu-item .ast-site-header-cart' => array( + 'padding' => '0', + ), + '.ast-amp .ast-masthead-custom-menu-items.woocommerce-custom-menu-item .ast-site-header-cart a' => array( + 'border' => 'none', + 'display' => 'inline-block', + ), + '.ast-theme.ast-header-custom-item-inside .main-header-bar .ast-search-menu-icon .search-form' => array( + 'visibility' => 'visible', + 'opacity' => '1', + 'position' => 'relative', + 'right' => 'auto', + 'top' => 'auto', + 'transform' => 'none', + ), + '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-stack .main-header-bar .ast-search-icon' => array( + 'margin' => '0', + ), + '.ast-amp .ast-mobile-header-stack .main-header-bar .ast-search-menu-icon.slide-search .search-form' => array( + 'right' => '-1em', + ), + '.ast-amp .ast-mobile-header-stack .site-branding, .ast-amp .ast-mobile-header-stack .ast-mobile-menu-buttons' => array( + '-webkit-box-pack' => 'center', + '-webkit-justify-content' => 'center', + '-moz-box-pack' => 'center', + '-ms-flex-pack' => 'center', + 'justify-content' => 'center', + 'text-align' => 'center', + 'padding-bottom' => '0', + ), + '.ast-safari-browser-less-than-11.ast-woocommerce-cart-menu.ast-header-break-point .header-main-layout-2 .main-header-container' => array( + 'display' => 'flex', + ), + ); + + // Tablet CSS. + $astra_medium_break_point_navigation = array( + '.ast-amp .footer-sml-layout-2 .ast-small-footer-section-2' => array( + 'margin-top' => '1em', + ), + ); + + $parse_css .= astra_parse_css( $astra_medium_break_point_navigation, astra_get_tablet_breakpoint() ); + + // Mobile CSS. + $astra_small_break_point_navigation = array( + '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack.ast-no-menu-items .ast-site-header-cart, .ast-theme.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack.ast-no-menu-items .ast-site-header-cart' => array( + 'padding-right' => '0', + 'padding-left' => '0', + ), + '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack .main-header-bar, .ast-theme.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .main-header-bar' => array( + 'text-align' => 'center', + ), + '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack .ast-site-header-cart, .ast-theme.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .ast-site-header-cart' => array( + 'display' => 'inline-block', + ), + '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack .ast-mobile-menu-buttons, .ast-theme.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .ast-mobile-menu-buttons' => array( + 'display' => 'inline-block', + ), + '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-2.ast-mobile-header-inline .site-branding' => array( + 'flex' => 'auto', + ), + '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .site-branding' => array( + 'flex' => '0 0 100%', + ), + '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .main-header-container' => array( + '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', + ), + '.ast-amp .ast-mobile-header-stack .ast-mobile-menu-buttons' => array( + 'width' => '100%', + ), + '.ast-amp .ast-mobile-header-stack .site-branding, .ast-amp .ast-mobile-header-stack .ast-mobile-menu-buttons' => array( + '-webkit-box-pack' => 'center', + '-webkit-justify-content' => 'center', + '-moz-box-pack' => 'center', + '-ms-flex-pack' => 'center', + 'justify-content' => 'center', + ), + '.ast-amp .ast-mobile-header-stack .main-header-bar-wrap .site-branding' => array( + '-webkit-box-flex' => '1', + '-webkit-flex' => '1 1 auto', + '-moz-box-flex' => '1', + '-ms-flex' => '1 1 auto', + '-webkit-box-flex' => '1', + '-webkit-flex' => '1 1 auto', + '-moz-box-flex' => '1', + '-ms-flex' => '1 1 auto', + 'flex' => '1 1 auto', + ), + '.ast-amp .ast-mobile-header-stack .ast-mobile-menu-buttons' => array( + 'padding-top' => '0.8em', + ), + '.ast-amp .ast-mobile-header-stack.header-main-layout-2 .ast-mobile-menu-buttons' => array( + 'padding-top' => '0.8em', + ), + '.ast-amp .ast-mobile-header-stack.header-main-layout-1 .site-branding' => array( + 'padding-bottom' => '0', + ), + '.ast-header-custom-item-outside.ast-amp .ast-mobile-header-stack .ast-masthead-custom-menu-items' => array( + 'padding' => '0.8em 1em 0 1em', + 'text-align' => 'center', + 'width' => '100%', + ), + '.ast-header-custom-item-outside.ast-amp .ast-mobile-header-stack.header-main-layout-3 .ast-mobile-menu-buttons, .ast-header-custom-item-outside.ast-amp .ast-mobile-header-stack.header-main-layout-3 .ast-masthead-custom-menu-items' => array( + 'padding-top' => '0.8em', + ), + // Tablet CSS. + '.ast-amp .footer-sml-layout-2 .ast-small-footer-section-2' => array( + 'margin-top' => '1em', + ), + ); + + $parse_css .= astra_parse_css( $astra_small_break_point_navigation, astra_get_mobile_breakpoint() ); + } + + $parse_css .= astra_parse_css( $astra_break_point_navigation, '', astra_header_break_point() ); + + // Move all header-break-point css from class based css to media query based CSS. + $astra_break_point_navigation = array( + + '.ast-amp .entry-content .alignwide' => array( + 'margin-left' => 'auto', + 'margin-right' => 'auto', + ), + '.ast-amp .main-navigation' => array( + 'padding-left' => '0', + ), + '.ast-amp .main-navigation ul .menu-item .menu-link, .ast-amp .main-navigation ul .button-custom-menu-item a' => array( + 'padding' => '0 20px', + 'display' => 'inline-block', + 'width' => '100%', + 'border-bottom-width' => '1px', + 'border-style' => 'solid', + 'border-color' => '#eaeaea', + ), + '.ast-amp .main-navigation .sub-menu .menu-item .menu-link' => array( + 'padding-left' => '30px', + ), + '.ast-amp .main-navigation .sub-menu .menu-item .menu-item .menu-link' => array( + 'padding-left' => '40px', + ), + '.ast-amp .main-navigation .sub-menu .menu-item .menu-item .menu-item .menu-link' => array(), + '.ast-amp .main-navigation .sub-menu .menu-item .menu-item .menu-item .menu-item .menu-link' => array( + 'padding-left' => '60px', + ), + '.ast-amp .main-header-menu' => array( + 'background-color' => '#f9f9f9', + ), + '.ast-amp .main-header-menu ul' => array( + 'background-color' => '#f9f9f9', + 'position' => 'static', + 'opacity' => '1', + 'visibility' => 'visible', + 'border' => '0', + 'width' => 'auto', + ), + '.ast-amp .main-header-menu ul li.ast-left-align-sub-menu:hover > ul, .ast-amp .main-header-menu ul li.ast-left-align-sub-menu.focus > ul' => array( + 'left' => '0', + ), + '.ast-amp .main-header-menu li.ast-sub-menu-goes-outside:hover > ul, .ast-amp .main-header-menu li.ast-sub-menu-goes-outside.focus > ul' => array( + 'left' => '0', + ), + '.ast-amp .submenu-with-border .sub-menu' => array( + 'border' => '0', + ), + '.ast-amp .user-select' => array( + 'clear' => 'both', + ), + '.ast-amp .ast-mobile-menu-buttons' => array( + 'display' => 'block', + '-webkit-align-self' => 'center', + '-ms-flex-item-align' => 'center', + 'align-self' => 'center', + ), + '.ast-amp .main-header-bar-navigation' => array( + '-webkit-box-flex' => '1', + '-webkit-flex' => 'auto', + '-moz-box-flex' => '1', + '-ms-flex' => 'auto', + 'flex' => 'auto', + 'width' => '-webkit-calc( 100% + 40px)', + 'width' => 'calc(100% + 40px )', + ), + '.ast-amp .ast-main-header-bar-alignment' => array( + 'display' => 'block', + 'width' => '100%', + '-webkit-box-flex' => '1', + '-webkit-flex' => 'auto', + '-moz-box-flex' => '1', + '-ms-flex' => 'auto', + 'flex' => 'auto', + '-webkit-box-ordinal-group' => '5', + '-webkit-order' => '4', + '-moz-box-ordinal-group' => '5', + '-ms-flex-order' => '4', + 'order' => '4', + ), + '.ast-amp .ast-mobile-menu-buttons' => array( + 'text-align' => 'right', + 'display' => '-webkit-box', + 'display' => '-webkit-flex', + 'display' => '-moz-box', + 'display' => '-ms-flexbox', + 'display' => 'flex', + '-webkit-box-pack' => 'end', + '-webkit-justify-content' => 'flex-end', + '-moz-box-pack' => 'end', + '-ms-flex-pack' => 'end', + 'justify-content' => 'flex-end', + ), + '.ast-amp .site-header .main-header-bar-wrap .site-branding' => array( + '-js-display' => 'flex', + 'display' => '-webkit-box', + 'display' => '-webkit-flex', + 'display' => '-moz-box', + 'display' => '-ms-flexbox', + 'display' => 'flex', + '-webkit-box-flex' => '1', + '-webkit-flex' => '1', + '-moz-box-flex' => '1', + '-ms-flex' => '1', + 'flex' => '1', + '-webkit-align-self' => 'center', + '-ms-flex-item-align' => 'center', + 'align-self' => 'center', + ), + '.ast-amp .ast-site-identity' => array( + 'width' => '100%', + ), + '.ast-amp .main-header-bar-navigation .menu-item-has-children > .menu-link .sub-arrow:after' => array( + 'display' => 'none', + ), + '.ast-amp .main-header-bar' => array( + 'display' => 'block', + 'line-height' => '3', + ), + '.ast-main-header-bar-alignment .main-header-bar-navigation' => array( + 'line-height' => '3', + 'display' => 'none', + ), + '.ast-amp .main-header-bar .toggled-on .main-header-bar-navigation' => array( + 'line-height' => '3', + 'display' => 'none', + ), + '.ast-amp .main-header-bar .main-header-bar-navigation .sub-menu' => array( + 'line-height' => '3', + ), + '.ast-amp .main-header-bar .main-header-bar-navigation .menu-item-has-children .sub-menu' => array( + 'display' => 'none', + ), + '.ast-amp .main-header-bar .main-header-bar-navigation .menu-item-has-children .dropdown-open+ul.sub-menu' => array( + 'display' => 'block', + ), + '.ast-amp .main-header-bar .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle' => array( + 'display' => 'inline-block', + 'position' => 'absolute', + 'font-size' => 'inherit', + 'top' => '-1px', + 'right' => '20px', + 'cursor' => 'pointer', + 'webkit-font-smoothing' => 'antialiased', + 'moz-osx-font-smoothing' => 'grayscale', + 'padding' => '0 0.907em', + 'font-weight' => 'normal', + 'line-height' => 'inherit', + 'transition' => 'all 0.2s', + ), + '.ast-amp .main-header-bar .main-header-bar-navigation .ast-submenu-expanded > .ast-menu-toggle::before' => array( + '-webkit-transform' => 'rotateX(180deg)', + 'transform' => 'rotateX(180deg)', + ), + '.ast-amp .main-header-bar .main-header-bar-navigation .main-header-menu' => array( + 'border-top-width' => '1px', + 'border-style' => 'solid', + 'border-color' => '#eaeaea', + ), + '.ast-amp .main-navigation' => array( + 'display' => 'block', + 'width' => '100%', + ), + '.ast-amp .main-navigation ul > li:first-child' => array( + 'border-top' => '0', + ), + '.ast-amp .main-navigation ul ul' => array( + 'left' => 'auto', + 'right' => 'auto', + ), + '.ast-amp .main-navigation li' => array( + 'width' => '100%', + ), + '.ast-amp .main-navigation .widget' => array( + 'margin-bottom' => '1em', + ), + '.ast-amp .main-navigation .widget li' => array( + 'width' => 'auto', + ), + '.ast-amp .main-navigation .widget:last-child' => array( + 'margin-bottom' => '0', + ), + '.ast-amp .main-header-menu ul ul' => array( + 'top' => '0', + ), + '.ast-amp .ast-has-mobile-header-logo .custom-logo-link, .ast-amp .ast-has-mobile-header-logo .astra-logo-svg' => array( + 'display' => 'none', + ), + '.ast-amp .ast-has-mobile-header-logo .custom-mobile-logo-link' => array( + 'display' => 'inline-block', + ), + '.ast-theme.ast-mobile-inherit-site-logo .ast-has-mobile-header-logo .custom-logo-link, .ast-theme.ast-mobile-inherit-site-logo .ast-has-mobile-header-logo .astra-logo-svg' => array( + 'display' => 'block', + ), + '.ast-amp .ast-header-widget-area .widget' => array( + 'margin' => '0.5em 0', + 'display' => 'block', + ), + '.ast-amp .main-header-bar' => array( + 'border' => '0', + 'border-bottom-color' => '#eaeaea', + 'border-bottom-style' => 'solid', + ), + '.ast-amp .nav-fallback-text' => array( + 'float' => 'none', + ), + '.ast-amp .main-header-menu .woocommerce-custom-menu-item .ast-cart-menu-wrap' => array( + 'height' => '3em', + 'line-height' => '3', + 'text-align' => 'left', + ), + '.ast-amp #ast-site-header-cart .widget_shopping_cart' => array( + 'display' => 'none', + ), + '.ast-theme.ast-woocommerce-cart-menu .ast-site-header-cart' => array( + 'order' => 'initial', + 'line-height' => '3', + 'padding' => '0 1em 1em 0', + ), + '.ast-amp .ast-edd-site-header-cart .widget_edd_cart_widget, .ast-amp .ast-edd-site-header-cart .ast-edd-header-cart-info-wrap' => array( + 'display' => 'none', + ), + '.ast-amp div.ast-masthead-custom-menu-items.edd-custom-menu-item' => array( + 'padding' => '0', + ), + '.ast-amp .main-header-bar .ast-search-menu-icon.slide-search .search-form' => array( + 'right' => '0', + ), + '.ast-amp .main-header-menu .sub-menu' => array( + 'box-shadow' => 'none', + ), + '.ast-amp .submenu-with-border .sub-menu a' => array( + 'border-width' => '1px', + ), + '.ast-amp .submenu-with-border .sub-menu > li:last-child > a' => array( + 'border-width' => '1px', + ), + ); + + if ( false === Astra_Icons::is_svg_icons() ) { + $astra_break_point_navigation['.ast-amp .main-navigation ul.children li a:before, .ast-amp .main-navigation ul.sub-menu li a:before'] = array( + 'content' => '"\e900"', + 'font-family' => '"Astra"', + 'font-size' => '0.65em', + 'text-decoration' => 'inherit', + 'display' => 'inline-block', + 'transform' => 'translate(0, -2px) rotateZ(270deg)', + 'margin-right' => '5px', + ); + $astra_break_point_navigation['.ast-amp .main-header-bar .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', + ); + } else { + $astra_break_point_navigation['[data-section="section-header-mobile-trigger"] .ast-button-wrap .ast-mobile-menu-buttons-minimal'] = array( + 'background' => 'transparent', + 'border' => 'none', + ); + } + + $parse_css .= astra_parse_css( $astra_break_point_navigation, '', astra_header_break_point() ); + + return $parse_css; + } + + /** + * Add AMP attributes to the nav menu wrapper. + * + * @since 1.7.0 + * @param Array $attr HTML attributes to be added to the nav menu wrapper. + * + * @return Array updated HTML attributes. + */ + public function nav_menu_wrapper( $attr ) { + $attr['[class]'] = '( astraAmpMenuExpanded ? \'ast-main-header-bar-alignment toggle-on\' : \'ast-main-header-bar-alignment\' )'; + $attr['aria-expanded'] = 'false'; + $attr['[aria-expanded]'] = '(astraAmpMenuExpanded ? \'true\' : \'false\')'; + + return $attr; + } + + /** + * Set AMP State for eeach sub menu toggle. + * + * @since 1.7.0 + * @param String $item_output HTML markup for the menu item. + * @param WP_Post $item Post object for the navigation menu. + * + * @return String HTML MArkup for the menu including the AML State. + */ + public function toggle_button_markup( $item_output, $item ) { + $item_output .= ''; + + return $item_output; + } + + /** + * Add AMP attribites to the toggle button to add `.ast-submenu-expanded` class to parent li. + * + * @since 1.7.0 + * @param array $attr Optional. Extra attributes to merge with defaults. + * @param string $context The context, to build filter name. + * @param array $args Optional. Custom data to pass to filter. + * + * @return Array updated HTML attributes. + */ + public function menu_toggle_button( $attr, $context, $args ) { + $attr['[class]'] = '( astraNavMenuItemExpanded' . $args->ID . ' ? \' ast-menu-toggle dropdown-open\' : \'ast-menu-toggle\')'; + $attr['on'] = 'tap:AMP.setState( { astraNavMenuItemExpanded' . $args->ID . ': ! astraNavMenuItemExpanded' . $args->ID . ' } )'; + + return $attr; + } + + /** + * Add amp states to the dom. + */ + public function render_amp_states() { + echo ''; + echo ''; + echo ''; + } + + /** + * Add search slide data attributes. + * + * @param string $input the data attrs already existing in the nav. + * + * @return string + */ + public function add_search_slide_toggle_attrs( $input ) { + $input .= ' on="tap:AMP.setState( { astraAmpSlideSearchMenuExpanded: ! astraAmpSlideSearchMenuExpanded } )" '; + $input .= ' [class]="( astraAmpSlideSearchMenuExpanded ? \'ast-search-menu-icon slide-search ast-dropdown-active\' : \'ast-search-menu-icon slide-search\' )" '; + $input .= ' aria-expanded="false" [aria-expanded]="astraAmpSlideSearchMenuExpanded ? \'true\' : \'false\'" '; + + return $input; + } + + /** + * Add search slide data attributes. + * + * @param string $input the data attrs already existing in the nav. + * + * @return string + */ + public function add_search_field_toggle_attrs( $input ) { + $input .= ' on="tap:AMP.setState( { astraAmpSlideSearchMenuExpanded: astraAmpSlideSearchMenuExpanded } )" '; + + return $input; + } + + /** + * Add the nav toggle data attributes. + * + * @param string $input the data attrs already existing in nav toggle. + * + * @return string + */ + public function add_nav_toggle_attrs( $input ) { + $input .= ' on="tap:AMP.setState( { astraAmpMenuExpanded: ! astraAmpMenuExpanded } ),astra-body.toggleClass(class=ast-main-header-nav-open)" '; + $input .= ' [class]="\'menu-toggle main-header-menu-toggle ast-mobile-menu-buttons-minimal\' + ( astraAmpMenuExpanded ? \' toggled\' : \'\' )" '; + $input .= ' aria-expanded="false" '; + $input .= ' [aria-expanded]="astraAmpMenuExpanded ? \'true\' : \'false\'" '; + + return $input; + } + + } +endif; + +/** +* Kicking this off by calling 'get_instance()' method +*/ +Astra_AMP::get_instance(); diff --git a/inc/compatibility/class-astra-bb-ultimate-addon.php b/inc/compatibility/class-astra-bb-ultimate-addon.php new file mode 100644 index 0000000..c77b165 --- /dev/null +++ b/inc/compatibility/class-astra-bb-ultimate-addon.php @@ -0,0 +1,428 @@ + $font_family[0], + 'weight' => astra_get_option( 'font-weight-button' ), + ); + } + + /** + * Button Font Size + */ + public function button_font_size() { + return ''; + } + + /** + * Button Line Height + */ + public function button_line_height() { + return ''; + } + + /** + * Default type : Button Font Size + * + * @since 2.2.0 + */ + public function default_type_button_font_size() { + $font_size_arr = array(); + $body_font_size = astra_get_option( 'font-size-body' ); + $theme_btn_font_size = astra_get_option( 'font-size-button' ); + + $font_size_arr['desktop'] = astra_responsive_font( $theme_btn_font_size, 'desktop' ); + $font_size_arr['tablet'] = astra_responsive_font( $theme_btn_font_size, 'tablet' ); + $font_size_arr['mobile'] = astra_responsive_font( $theme_btn_font_size, 'mobile' ); + + if ( empty( $font_size_arr['desktop'] ) ) { + $font_size_arr['desktop'] = astra_responsive_font( $body_font_size, 'desktop' ); + } + if ( empty( $font_size_arr['tablet'] ) ) { + $font_size_arr['tablet'] = astra_responsive_font( $body_font_size, 'tablet' ); + } + if ( empty( $font_size_arr['mobile'] ) ) { + $font_size_arr['mobile'] = astra_responsive_font( $body_font_size, 'mobile' ); + } + + return $font_size_arr; + } + + /** + * Default type : Button Line Height + * + * @since 2.2.0 + */ + public function default_type_button_line_height() { + $theme_btn_body_line_height = astra_get_option( 'body-line-height', 1.85714285714286 ); + $theme_btn_line_height = astra_get_option( 'theme-btn-line-height', $theme_btn_body_line_height ); + return $theme_btn_line_height; + } + + /** + * Button Letter Spacing + */ + public function button_letter_spacing() { + return ''; + } + + /** + * Default type : Button Letter Spacing + * + * @since 2.2.0 + */ + public function default_type_button_letter_spacing() { + $theme_btn_letter_spacing = astra_get_option( 'theme-btn-letter-spacing' ); + return $theme_btn_letter_spacing; + } + + /** + * Button Text Transform + */ + public function button_text_transform() { + return ''; + } + + /** + * Default type : Button Text Transform + * + * @since 2.2.0 + */ + public function default_type_button_text_transform() { + $theme_btn_text_transform = astra_get_option( 'text-transform-button' ); + return $theme_btn_text_transform; + } + + /** + * Button Text Color + */ + public function button_text_color() { + $theme_color = astra_get_option( 'theme-color' ); + $link_color = astra_get_option( 'link-color', $theme_color ); + $color = astra_get_option( 'button-color' ); + if ( empty( $color ) ) { + $color = astra_get_foreground_color( $link_color ); + } + return $color; + } + + /** + * Default type : Button Text Color + * + * @since 2.2.0 + */ + public function default_type_button_text_color() { + $theme_color = astra_get_option( 'theme-color' ); + $btn_text_color = astra_get_option( 'button-color' ); + if ( empty( $btn_text_color ) ) { + $btn_text_color = astra_get_foreground_color( $theme_color ); + } + + return $btn_text_color; + } + + /** + * Button Text Hover Color + */ + public function button_text_hover_color() { + $link_hover_color = astra_get_option( 'link-h-color' ); + $btn_text_hover_color = astra_get_option( 'button-h-color' ); + if ( empty( $btn_text_hover_color ) ) { + $btn_text_hover_color = astra_get_foreground_color( $link_hover_color ); + } + + return $btn_text_hover_color; + } + + /** + * Default type : Button Text Hover Color + * + * @since 2.2.0 + */ + public function default_type_button_text_hover_color() { + $link_hover_color = astra_get_option( 'link-h-color' ); + $btn_text_hover_color = astra_get_option( 'button-h-color' ); + if ( empty( $btn_text_hover_color ) ) { + $btn_text_hover_color = astra_get_foreground_color( $link_hover_color ); + } + + return $btn_text_hover_color; + } + + /** + * Button Background Color + */ + public function button_bg_color() { + return astra_get_option( 'button-bg-color' ); + } + + /** + * Default type : Button Background Color + * + * @since 2.2.0 + */ + public function default_type_button_bg_color() { + $theme_color = astra_get_option( 'theme-color' ); + $btn_bg_color = astra_get_option( 'button-bg-color', $theme_color ); + return $btn_bg_color; + } + + /** + * Button Background Color + */ + public function button_bg_hover_color() { + return astra_get_option( 'button-bg-h-color' ); + } + + /** + * Default type : Button Background Color + * + * @since 2.2.0 + */ + public function default_type_button_bg_hover_color() { + $link_hover_color = astra_get_option( 'link-h-color' ); + $btn_bg_hover_color = astra_get_option( 'button-bg-h-color', $link_hover_color ); + return $btn_bg_hover_color; + } + + /** + * Button Border Radius + */ + public function button_border_radius() { + return astra_get_option( 'button-radius' ); + } + + + /** + * Button Padding + */ + public function button_padding() { + $padding = ''; + $v_padding = astra_get_option( 'button-v-padding' ); + $h_padding = astra_get_option( 'button-h-padding' ); + if ( '' != $v_padding && '' != $h_padding ) { + $padding = $v_padding . 'px ' . $h_padding . 'px'; + } + return $padding; + } + + /** + * Default type : Button Padding + * + * @since 2.2.0 + */ + public function default_type_button_padding() { + + $padding = astra_get_option( 'theme-button-padding' ); + + return $padding; + } + + /** + * Button Border Width + */ + public function button_border_width() { + + $btn_width = array(); + $get_btn_width = astra_get_option( 'theme-button-border-group-border-size' ); + + if ( ! empty( $get_btn_width ) ) { + $btn_width = $get_btn_width; + } + + return $btn_width; + } + + /** + * Button Border Color + */ + public function button_border_color() { + + $theme_color = astra_get_option( 'theme-color' ); + $btn_bg_color = astra_get_option( 'button-bg-color', $theme_color ); + $get_btn_border_color = astra_get_option( 'theme-button-border-group-border-color', $btn_bg_color ); + + return $get_btn_border_color; + } + + /** + * Button Border Hover Color + */ + public function button_border_hover_color() { + + $link_hover_color = astra_get_option( 'link-h-color' ); + $btn_bg_hover_color = astra_get_option( 'button-bg-h-color', $link_hover_color ); + $get_btn_border_h_color = astra_get_option( 'theme-button-border-group-border-h-color', $btn_bg_hover_color ); + + return $get_btn_border_h_color; + } + + /** + * Button Vertical Padding. + * + * @deprecated 2.2.0 + */ + public function button_vertical_padding() { + + $padding = ''; + $v_padding = astra_get_option( 'button-v-padding' ); + + if ( '' != $v_padding ) { + $padding = $v_padding; + } + + return $padding; + } + + /** + * Button Horizontal Padding. + * + * @deprecated 2.2.0 + */ + public function button_horizontal_padding() { + + $padding = ''; + $h_padding = astra_get_option( 'button-h-padding' ); + + if ( '' != $h_padding ) { + $padding = $h_padding; + } + + return $padding; + } + + } + +endif; + +/** + * Kicking this off by calling 'get_instance()' method + */ +Astra_BB_Ultimate_Addon::get_instance(); diff --git a/inc/compatibility/class-astra-beaver-builder.php b/inc/compatibility/class-astra-beaver-builder.php new file mode 100644 index 0000000..c372683 --- /dev/null +++ b/inc/compatibility/class-astra-beaver-builder.php @@ -0,0 +1,113 @@ +post_content ) && $do_render && FLBuilderModel::is_builder_enabled() ) { + + update_post_meta( $id, '_astra_content_layout_flag', 'disabled' ); + update_post_meta( $id, 'site-post-title', 'disabled' ); + update_post_meta( $id, 'ast-title-bar-display', 'disabled' ); + update_post_meta( $id, 'ast-featured-img', 'disabled' ); + + $content_layout = get_post_meta( $id, 'site-content-layout', true ); + if ( empty( $content_layout ) || 'default' == $content_layout ) { + update_post_meta( $id, 'site-content-layout', 'page-builder' ); + } + + $sidebar_layout = get_post_meta( $id, 'site-sidebar-layout', true ); + if ( empty( $sidebar_layout ) || 'default' == $sidebar_layout ) { + update_post_meta( $id, 'site-sidebar-layout', 'no-sidebar' ); + } + } + } + } + + /** + * Add assets in theme + * + * @param array $assets list of theme assets (JS & CSS). + * @return array List of updated assets. + * @since 3.5.0 + */ + public function add_styles( $assets ) { + + if ( ! empty( $assets['css'] ) ) { + $assets['css'] = array( 'astra-bb-builder' => 'compatibility/page-builder/bb-plugin' ) + $assets['css']; + } + return $assets; + } + + } + +endif; + +/** + * Kicking this off by calling 'get_instance()' method + */ +Astra_Beaver_Builder::get_instance(); diff --git a/inc/compatibility/class-astra-beaver-themer.php b/inc/compatibility/class-astra-beaver-themer.php new file mode 100644 index 0000000..7be43a9 --- /dev/null +++ b/inc/compatibility/class-astra-beaver-themer.php @@ -0,0 +1,410 @@ + 0 ) { + $classes = array_diff( + $classes, + array( + // Astra common grid. + 'ast-col-xs-1', + 'ast-col-xs-2', + 'ast-col-xs-3', + 'ast-col-xs-4', + 'ast-col-xs-5', + 'ast-col-xs-6', + 'ast-col-xs-7', + 'ast-col-xs-8', + 'ast-col-xs-9', + 'ast-col-xs-10', + 'ast-col-xs-11', + 'ast-col-xs-12', + 'ast-col-sm-1', + 'ast-col-sm-2', + 'ast-col-sm-3', + 'ast-col-sm-4', + 'ast-col-sm-5', + 'ast-col-sm-6', + 'ast-col-sm-7', + 'ast-col-sm-8', + 'ast-col-sm-9', + 'ast-col-sm-10', + 'ast-col-sm-11', + 'ast-col-sm-12', + 'ast-col-md-1', + 'ast-col-md-2', + 'ast-col-md-3', + 'ast-col-md-4', + 'ast-col-md-5', + 'ast-col-md-6', + 'ast-col-md-7', + 'ast-col-md-8', + 'ast-col-md-9', + 'ast-col-md-10', + 'ast-col-md-11', + 'ast-col-md-12', + 'ast-col-lg-1', + 'ast-col-lg-2', + 'ast-col-lg-3', + 'ast-col-lg-4', + 'ast-col-lg-5', + 'ast-col-lg-6', + 'ast-col-lg-7', + 'ast-col-lg-8', + 'ast-col-lg-9', + 'ast-col-lg-10', + 'ast-col-lg-11', + 'ast-col-lg-12', + 'ast-col-xl-1', + 'ast-col-xl-2', + 'ast-col-xl-3', + 'ast-col-xl-4', + 'ast-col-xl-5', + 'ast-col-xl-6', + 'ast-col-xl-7', + 'ast-col-xl-8', + 'ast-col-xl-9', + 'ast-col-xl-10', + 'ast-col-xl-11', + 'ast-col-xl-12', + + // Astra Blog / Single Post. + 'ast-article-post', + 'ast-article-single', + 'ast-separate-posts', + 'remove-featured-img-padding', + 'ast-featured-post', + + // Astra Woocommerce. + 'ast-product-gallery-layout-vertical', + 'ast-product-gallery-layout-horizontal', + 'ast-product-gallery-with-no-image', + + 'ast-product-tabs-layout-vertical', + 'ast-product-tabs-layout-horizontal', + + 'ast-qv-disabled', + 'ast-qv-on-image', + 'ast-qv-on-image-click', + 'ast-qv-after-summary', + + 'astra-woo-hover-swap', + + 'box-shadow-0', + 'box-shadow-0-hover', + 'box-shadow-1', + 'box-shadow-1-hover', + 'box-shadow-2', + 'box-shadow-2-hover', + 'box-shadow-3', + 'box-shadow-3-hover', + 'box-shadow-4', + 'box-shadow-4-hover', + 'box-shadow-5', + 'box-shadow-5-hover', + ) + ); + + add_filter( 'astra_post_link_enabled', '__return_false' ); + } + + return $classes; + } + + /** + * Function to add Theme Support + * + * @since 1.0.0 + */ + public function header_footer_support() { + + add_theme_support( 'fl-theme-builder-headers' ); + add_theme_support( 'fl-theme-builder-footers' ); + add_theme_support( 'fl-theme-builder-parts' ); + } + + /** + * Function to update Atra header/footer with Beaver template + * + * @since 1.0.0 + */ + public function theme_header_footer_render() { + + // Get the header ID. + $header_ids = FLThemeBuilderLayoutData::get_current_page_header_ids(); + + // If we have a header, remove the theme header and hook in Theme Builder's. + if ( ! empty( $header_ids ) ) { + remove_action( 'astra_header', 'astra_header_markup' ); + add_action( 'astra_header', 'FLThemeBuilderLayoutRenderer::render_header' ); + } + + // Get the footer ID. + $footer_ids = FLThemeBuilderLayoutData::get_current_page_footer_ids(); + + // If we have a footer, remove the theme footer and hook in Theme Builder's. + if ( ! empty( $footer_ids ) ) { + remove_action( 'astra_footer', 'astra_footer_markup' ); + add_action( 'astra_footer', 'FLThemeBuilderLayoutRenderer::render_footer' ); + } + + // BB Themer Support. + $template_ids = FLThemeBuilderLayoutData::get_current_page_content_ids(); + + if ( ! empty( $template_ids ) ) { + + $template_id = $template_ids[0]; + $template_type = get_post_meta( $template_id, '_fl_theme_layout_type', true ); + + if ( 'archive' === $template_type || 'singular' === $template_type || '404' === $template_type ) { + + $sidebar = get_post_meta( $template_id, 'site-sidebar-layout', true ); + + if ( 'default' !== $sidebar ) { + add_filter( + 'astra_page_layout', + function( $page_layout ) use ( $sidebar ) { // phpcs:ignore PHPCompatibility.FunctionDeclarations.NewClosure.Found + + return $sidebar; + } + ); + } + + $content_layout = get_post_meta( $template_id, 'site-content-layout', true ); + if ( 'default' !== $content_layout ) { + add_filter( + 'astra_get_content_layout', + function( $layout ) use ( $content_layout ) {// phpcs:ignore PHPCompatibility.FunctionDeclarations.NewClosure.Found + + return $content_layout; + } + ); + } + + $main_header_display = get_post_meta( $template_id, 'ast-main-header-display', true ); + if ( 'disabled' === $main_header_display ) { + + if ( 'archive' === $template_type ) { + remove_action( 'astra_masthead', 'astra_masthead_primary_template' ); + } else { + add_filter( + 'ast_main_header_display', + function( $display_header ) {// phpcs:ignore PHPCompatibility.FunctionDeclarations.NewClosure.Found + + return 'disabled'; + } + ); + } + } + + $footer_layout = get_post_meta( $template_id, 'footer-sml-layout', true ); + if ( 'disabled' === $footer_layout ) { + + add_filter( + 'ast_footer_sml_layout', + function( $is_footer ) {// phpcs:ignore PHPCompatibility.FunctionDeclarations.NewClosure.Found + + return 'disabled'; + } + ); + } + + // Override! Footer Widgets. + $footer_widgets = get_post_meta( $template_id, 'footer-adv-display', true ); + if ( 'disabled' === $footer_widgets ) { + add_filter( 'astra_advanced_footer_disable', '__return_true' ); + } + } + } + } + + /** + * Function to Astra theme parts + * + * @since 1.0.0 + */ + public function register_part_hooks() { + + return array( + array( + 'label' => 'Page', + 'hooks' => array( + 'astra_body_top' => __( 'Before Page', 'astra' ), + 'astra_body_bottom' => __( 'After Page', 'astra' ), + ), + ), + array( + 'label' => 'Header', + 'hooks' => array( + 'astra_header_before' => __( 'Before Header', 'astra' ), + 'astra_header_after' => __( 'After Header', 'astra' ), + ), + ), + array( + 'label' => 'Content', + 'hooks' => array( + 'astra_primary_content_top' => __( 'Before Content', 'astra' ), + 'astra_primary_content_bottom' => __( 'After Content', 'astra' ), + ), + ), + array( + 'label' => 'Footer', + 'hooks' => array( + 'astra_footer_before' => __( 'Before Footer', 'astra' ), + 'astra_footer_after' => __( 'After Footer', 'astra' ), + ), + ), + array( + 'label' => 'Sidebar', + 'hooks' => array( + 'astra_sidebars_before' => __( 'Before Sidebar', 'astra' ), + 'astra_sidebars_after' => __( 'After Sidebar', 'astra' ), + ), + ), + array( + 'label' => 'Posts', + 'hooks' => array( + 'loop_start' => __( 'Loop Start', 'astra' ), + 'astra_entry_top' => __( 'Before Post', 'astra' ), + 'astra_entry_content_before' => __( 'Before Post Content', 'astra' ), + 'astra_entry_content_after' => __( 'After Post Content', 'astra' ), + 'astra_entry_bottom' => __( 'After Post', 'astra' ), + 'astra_comments_before' => __( 'Before Comments', 'astra' ), + 'astra_comments_after' => __( 'After Comments', 'astra' ), + 'loop_end' => __( 'Loop End', 'astra' ), + ), + ), + ); + } + + /** + * Function to theme before render content + * + * @param int $post_id Post ID. + * @since 1.0.28 + */ + public function builder_before_render_content( $post_id ) { + + ?> + + + + + + +
> + +
+ + + + + + + + register_all_core_location(); + } + + /** + * Template Parts Support + * + * @since 1.2.7 + * @return void + */ + public function do_template_parts() { + // Is Archive? + $did_location = Module::instance()->get_locations_manager()->do_location( 'archive' ); + if ( $did_location ) { + // Search and default. + remove_action( 'astra_template_parts_content', array( \Astra_Loop::get_instance(), 'template_parts_search' ) );// phpcs:ignore PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound + remove_action( 'astra_template_parts_content', array( \Astra_Loop::get_instance(), 'template_parts_default' ) );// phpcs:ignore PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound + + // Remove pagination. + remove_action( 'astra_pagination', 'astra_number_pagination' ); + remove_action( 'astra_entry_after', 'astra_single_post_navigation_markup' ); + + // Content. + remove_action( 'astra_entry_content_single', 'astra_entry_content_single_template' ); + } + + // IS Single? + $did_location = Module::instance()->get_locations_manager()->do_location( 'single' ); + if ( $did_location ) { + + // @codingStandardsIgnoreStart PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound + remove_action( 'astra_page_template_parts_content', array( \Astra_Loop::get_instance(), 'template_parts_page' ) ); + remove_action( 'astra_template_parts_content', array( \Astra_Loop::get_instance(), 'template_parts_post' ) ); + remove_action( 'astra_template_parts_content', array( \Astra_Loop::get_instance(), 'template_parts_comments' ), 15 ); + remove_action( 'astra_page_template_parts_content', array( \Astra_Loop::get_instance(), 'template_parts_comments' ), 15 ); + // @codingStandardsIgnoreEnd PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound + } + } + + /** + * Override 404 page + * + * @since 1.2.7 + * @return void + */ + public function do_template_part_404() { + if ( is_404() ) { + + // Is Single? + $did_location = Module::instance()->get_locations_manager()->do_location( 'single' ); + if ( $did_location ) { + remove_action( 'astra_entry_content_404_page', 'astra_entry_content_404_page_template' ); + } + } + } + + /** + * Override sidebar, title etc with post meta + * + * @since 1.2.7 + * @return void + */ + public function override_meta() { + + // don't override meta for `elementor_library` post type. + if ( 'elementor_library' == get_post_type() ) { + return; + } + + // Override post meta for single pages. + $documents_single = Module::instance()->get_conditions_manager()->get_documents_for_location( 'single' ); + if ( $documents_single ) { + foreach ( $documents_single as $document ) { + $this->override_with_post_meta( $document->get_post()->ID ); + } + } + + // Override post meta for archive pages. + $documents_archive = Module::instance()->get_conditions_manager()->get_documents_for_location( 'archive' ); + if ( $documents_archive ) { + foreach ( $documents_archive as $document ) { + $this->override_with_post_meta( $document->get_post()->ID ); + } + } + } + + /** + * Override sidebar, title etc with post meta + * + * @since 1.2.7 + * @param integer $post_id Post ID. + * @return void + */ + public function override_with_post_meta( $post_id = 0 ) { + // Override! Page Title. + $title = get_post_meta( $post_id, 'site-post-title', true ); + if ( 'disabled' === $title ) { + + // Archive page. + add_filter( 'astra_the_title_enabled', '__return_false', 99 ); + + // Single page. + add_filter( 'astra_the_title_enabled', '__return_false' ); + remove_action( 'astra_archive_header', 'astra_archive_page_info' ); + } + + // Override! Sidebar. + $sidebar = get_post_meta( $post_id, 'site-sidebar-layout', true ); + if ( '' === $sidebar ) { + $sidebar = 'default'; + } + + // @codingStandardsIgnoreStart PHPCompatibility.FunctionDeclarations.NewClosure.Found + + if ( 'default' !== $sidebar ) { + add_filter( + 'astra_page_layout', + function( $page_layout ) use ( $sidebar ) { + return $sidebar; + } + ); + } + + // Override! Content Layout. + $content_layout = get_post_meta( $post_id, 'site-content-layout', true ); + if ( '' === $content_layout ) { + $content_layout = 'default'; + } + + if ( 'default' !== $content_layout ) { + add_filter( + 'astra_get_content_layout', + function( $layout ) use ( $content_layout ) { + return $content_layout; + } + ); + } + + // Override! Footer Bar. + $footer_layout = get_post_meta( $post_id, 'footer-sml-layout', true ); + if ( '' === $footer_layout ) { + $footer_layout = 'default'; + } + + if ( 'disabled' === $footer_layout ) { + add_filter( + 'ast_footer_sml_layout', + function( $is_footer ) { + return 'disabled'; + } + ); + } + + // Override! Footer Widgets. + $footer_widgets = get_post_meta( $post_id, 'footer-adv-display', true ); + if ( '' === $footer_widgets ) { + $footer_widgets = 'default'; + } + + if ( 'disabled' === $footer_widgets ) { + add_filter( + 'astra_advanced_footer_disable', + function() { + return true; + } + ); + } + + // Override! Header. + $main_header_display = get_post_meta( $post_id, 'ast-main-header-display', true ); + if ( '' === $main_header_display ) { + $main_header_display = 'default'; + } + + if ( 'disabled' === $main_header_display ) { + remove_action( 'astra_masthead', 'astra_masthead_primary_template' ); + add_filter( + 'ast_main_header_display', + function( $display_header ) { + return 'disabled'; + } + ); + } + // @codingStandardsIgnoreEnd PHPCompatibility.FunctionDeclarations.NewClosure.Found + } + + /** + * Header Support + * + * @since 1.2.7 + * @return void + */ + public function do_header() { + $did_location = Module::instance()->get_locations_manager()->do_location( 'header' ); + if ( $did_location ) { + remove_action( 'astra_header', 'astra_header_markup' ); + } + } + + /** + * Footer Support + * + * @since 1.2.7 + * @return void + */ + public function do_footer() { + $did_location = Module::instance()->get_locations_manager()->do_location( 'footer' ); + if ( $did_location ) { + remove_action( 'astra_footer', 'astra_footer_markup' ); + } + } + + /** + * Remove theme post's default classes when Elementor's template builder is activated. + * + * @param array $classes Post Classes. + * @return array + * @since 1.4.9 + */ + public function render_post_class( $classes ) { + $post_class = array( 'elementor-post elementor-grid-item', 'elementor-portfolio-item' ); + $result = array_intersect( $classes, $post_class ); + + if ( count( $result ) > 0 ) { + $classes = array_diff( + $classes, + array( + // Astra common grid. + 'ast-col-xs-1', + 'ast-col-xs-2', + 'ast-col-xs-3', + 'ast-col-xs-4', + 'ast-col-xs-5', + 'ast-col-xs-6', + 'ast-col-xs-7', + 'ast-col-xs-8', + 'ast-col-xs-9', + 'ast-col-xs-10', + 'ast-col-xs-11', + 'ast-col-xs-12', + 'ast-col-sm-1', + 'ast-col-sm-2', + 'ast-col-sm-3', + 'ast-col-sm-4', + 'ast-col-sm-5', + 'ast-col-sm-6', + 'ast-col-sm-7', + 'ast-col-sm-8', + 'ast-col-sm-9', + 'ast-col-sm-10', + 'ast-col-sm-11', + 'ast-col-sm-12', + 'ast-col-md-1', + 'ast-col-md-2', + 'ast-col-md-3', + 'ast-col-md-4', + 'ast-col-md-5', + 'ast-col-md-6', + 'ast-col-md-7', + 'ast-col-md-8', + 'ast-col-md-9', + 'ast-col-md-10', + 'ast-col-md-11', + 'ast-col-md-12', + 'ast-col-lg-1', + 'ast-col-lg-2', + 'ast-col-lg-3', + 'ast-col-lg-4', + 'ast-col-lg-5', + 'ast-col-lg-6', + 'ast-col-lg-7', + 'ast-col-lg-8', + 'ast-col-lg-9', + 'ast-col-lg-10', + 'ast-col-lg-11', + 'ast-col-lg-12', + 'ast-col-xl-1', + 'ast-col-xl-2', + 'ast-col-xl-3', + 'ast-col-xl-4', + 'ast-col-xl-5', + 'ast-col-xl-6', + 'ast-col-xl-7', + 'ast-col-xl-8', + 'ast-col-xl-9', + 'ast-col-xl-10', + 'ast-col-xl-11', + 'ast-col-xl-12', + + // Astra Blog / Single Post. + 'ast-article-post', + 'ast-article-single', + 'ast-separate-posts', + 'remove-featured-img-padding', + 'ast-featured-post', + + // Astra Woocommerce. + 'ast-product-gallery-layout-vertical', + 'ast-product-gallery-layout-horizontal', + 'ast-product-gallery-with-no-image', + + 'ast-product-tabs-layout-vertical', + 'ast-product-tabs-layout-horizontal', + + 'ast-qv-disabled', + 'ast-qv-on-image', + 'ast-qv-on-image-click', + 'ast-qv-after-summary', + + 'astra-woo-hover-swap', + + 'box-shadow-0', + 'box-shadow-0-hover', + 'box-shadow-1', + 'box-shadow-1-hover', + 'box-shadow-2', + 'box-shadow-2-hover', + 'box-shadow-3', + 'box-shadow-3-hover', + 'box-shadow-4', + 'box-shadow-4-hover', + 'box-shadow-5', + 'box-shadow-5-hover', + ) + ); + } + + return $classes; + } + + } + + /** + * Kicking this off by calling 'get_instance()' method + */ + Astra_Elementor_Pro::get_instance(); + +endif; diff --git a/inc/compatibility/class-astra-elementor.php b/inc/compatibility/class-astra-elementor.php new file mode 100644 index 0000000..9008865 --- /dev/null +++ b/inc/compatibility/class-astra-elementor.php @@ -0,0 +1,254 @@ +is_elementor_activated( $id ) ) { + + $elementor_heading_margin_comp = array( + '.elementor-widget-heading .elementor-heading-title' => array( + 'margin' => '0', + ), + ); + + /* Parse CSS from array() */ + $parse_css = astra_parse_css( $elementor_heading_margin_comp ); + + $elementor_base_css = array( + '.elementor-post.elementor-grid-item.hentry' => array( + 'margin-bottom' => '0', + ), + '.woocommerce div.product .elementor-element.elementor-products-grid .related.products ul.products li.product, .elementor-element .elementor-wc-products .woocommerce[class*=\'columns-\'] ul.products li.product' => array( + 'width' => 'auto', + 'margin' => '0', + 'float' => 'none', + ), + ); + // Load base static CSS when Elmentor is activated. + $parse_css .= astra_parse_css( $elementor_base_css ); + + if ( is_rtl() ) { + $elementor_rtl_support_css = array( + '.ast-left-sidebar .elementor-section.elementor-section-stretched,.ast-right-sidebar .elementor-section.elementor-section-stretched' => array( + 'max-width' => '100%', + 'right' => '0 !important', + ), + ); + } else { + $elementor_rtl_support_css = array( + '.ast-left-sidebar .elementor-section.elementor-section-stretched,.ast-right-sidebar .elementor-section.elementor-section-stretched' => array( + 'max-width' => '100%', + 'left' => '0 !important', + ), + ); + } + $parse_css .= astra_parse_css( $elementor_rtl_support_css ); + + + $dynamic_css .= $parse_css; + } + + $elementor_archive_page_css = array( + '.elementor-template-full-width .ast-container' => array( + 'display' => 'block', + ), + ); + $dynamic_css .= astra_parse_css( $elementor_archive_page_css ); + + return $dynamic_css; + } + + /** + * Elementor Content layout set as Page Builder + * + * @return void + * @since 1.0.2 + */ + public function elementor_default_setting() { + + if ( false === astra_enable_page_builder_compatibility() || 'post' == get_post_type() ) { + return; + } + + // don't modify post meta settings if we are not on Elementor's edit page. + if ( ! $this->is_elementor_editor() ) { + return; + } + + global $post; + $id = astra_get_post_id(); + + $page_builder_flag = get_post_meta( $id, '_astra_content_layout_flag', true ); + if ( isset( $post ) && empty( $page_builder_flag ) && ( is_admin() || is_singular() ) ) { + + if ( empty( $post->post_content ) && $this->is_elementor_activated( $id ) ) { + + update_post_meta( $id, '_astra_content_layout_flag', 'disabled' ); + update_post_meta( $id, 'site-post-title', 'disabled' ); + update_post_meta( $id, 'ast-title-bar-display', 'disabled' ); + update_post_meta( $id, 'ast-featured-img', 'disabled' ); + + $content_layout = get_post_meta( $id, 'site-content-layout', true ); + if ( empty( $content_layout ) || 'default' == $content_layout ) { + update_post_meta( $id, 'site-content-layout', 'page-builder' ); + } + + $sidebar_layout = get_post_meta( $id, 'site-sidebar-layout', true ); + if ( empty( $sidebar_layout ) || 'default' == $sidebar_layout ) { + update_post_meta( $id, 'site-sidebar-layout', 'no-sidebar' ); + } + + // In the preview mode, Apply the layouts using filters for Elementor Template Library. + add_filter( + 'astra_page_layout', + function() { // phpcs:ignore PHPCompatibility.FunctionDeclarations.NewClosure.Found + return 'no-sidebar'; + } + ); + + add_filter( + 'astra_get_content_layout', + function () { // phpcs:ignore PHPCompatibility.FunctionDeclarations.NewClosure.Found + return 'page-builder'; + } + ); + + add_filter( 'astra_the_post_title_enabled', '__return_false' ); + add_filter( 'astra_featured_image_enabled', '__return_false' ); + } + } + } + + /** + * Add z-index CSS for elementor's drag drop + * + * @return void + * @since 1.4.0 + */ + public function elementor_overlay_zindex() { + + // return if we are not on Elementor's edit page. + if ( ! $this->is_elementor_editor() ) { + return; + } + + ?> + + + db->get_edit_mode( $id ) ); + } else { + return Plugin::$instance->db->is_built_with_elementor( $id ); + } + } + + /** + * Check if Elementor Editor is open. + * + * @since 1.2.7 + * + * @return boolean True IF Elementor Editor is loaded, False If Elementor Editor is not loaded. + */ + private function is_elementor_editor() { + if ( ( isset( $_REQUEST['action'] ) && 'elementor' == $_REQUEST['action'] ) || isset( $_REQUEST['elementor-preview'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended + return true; + } + + return false; + } + + } + +endif; + +/** + * Kicking this off by calling 'get_instance()' method + */ +Astra_Elementor::get_instance(); diff --git a/inc/compatibility/class-astra-gravity-forms.php b/inc/compatibility/class-astra-gravity-forms.php new file mode 100644 index 0000000..e89c83e --- /dev/null +++ b/inc/compatibility/class-astra-gravity-forms.php @@ -0,0 +1,74 @@ + 'main', + 'render' => array( $this, 'infinite_scroll_render' ), + 'footer' => 'page', + ) + ); + } // end function jetpack_setup + + /** + * Custom render function for Infinite Scroll. + */ + public function infinite_scroll_render() { + while ( have_posts() ) { + the_post(); + get_template_part( 'template-parts/content', astra_get_post_format() ); + } + } // end function infinite_scroll_render + + } + +endif; + +/** + * Kicking this off by calling 'get_instance()' method + */ +Astra_Jetpack::get_instance(); diff --git a/inc/compatibility/class-astra-site-origin.php b/inc/compatibility/class-astra-site-origin.php new file mode 100644 index 0000000..1edca34 --- /dev/null +++ b/inc/compatibility/class-astra-site-origin.php @@ -0,0 +1,68 @@ + 0 && empty( $post->post_content ) ) { + $this->vc_update_meta_setting( $id ); + } + } + } + + /** + * Set default setting. + * + * @since 1.0.13 + * @return void + */ + public function vc_default_setting() { + + global $post; + $id = astra_get_post_id(); + + $page_builder_flag = get_post_meta( $id, '_astra_content_layout_flag', true ); + + if ( isset( $post ) && empty( $page_builder_flag ) && ( is_admin() || is_singular() ) ) { + $vc_active = get_post_meta( $id, '_wpb_vc_js_status', true ); + if ( 'true' == $vc_active || has_shortcode( $post->post_content, 'vc_row' ) ) { + $this->vc_update_meta_setting( $id ); + } + } + } + + /** + * Add assets in theme + * + * @param array $assets list of theme assets (JS & CSS). + * @return array List of updated assets. + * @since 3.5.0 + */ + public function add_styles( $assets ) { + if ( ! empty( $assets['css'] ) ) { + $assets['css'] = array( 'astra-vc-builder' => 'compatibility/page-builder/vc-plugin' ) + $assets['css']; + } + return $assets; + } + } + +endif; + +/** + * Kicking this off by calling 'get_instance()' method + */ +Astra_Visual_Composer::get_instance(); diff --git a/inc/compatibility/class-astra-web-stories.php b/inc/compatibility/class-astra-web-stories.php new file mode 100644 index 0000000..e0d4b59 --- /dev/null +++ b/inc/compatibility/class-astra-web-stories.php @@ -0,0 +1,97 @@ + array( + 'border-bottom' => '1px solid #ccc', + 'padding' => '15px 0', + 'margin-bottom' => '0', + ), + ); + + $dynamic_css .= astra_parse_css( $stories_css_array ); + + return $dynamic_css; + } + +} + +new Astra_Web_Stories(); diff --git a/inc/compatibility/class-astra-yoast-seo.php b/inc/compatibility/class-astra-yoast-seo.php new file mode 100644 index 0000000..1873f7f --- /dev/null +++ b/inc/compatibility/class-astra-yoast-seo.php @@ -0,0 +1,40 @@ +' . esc_html( $cart_title ) . ''; + + $cart_total_markup = '' . esc_html( edd_currency_filter( edd_format_amount( edd_get_cart_total() ) ) ) . ''; + + // Cart Title & Cart Cart total markup. + $cart_info_markup = sprintf( + ' + %1$s + %2$s + %3$s + ', + ( $cart_title_display ) ? $cart_title_markup : '', + ( $cart_total_display && $cart_title_display ) ? '/' : '', + ( $cart_total_display ) ? $cart_total_markup : '' + ); + + $cart_items = count( edd_get_cart_contents() ); + $cart_contents_count = $cart_items; + + $cart_icon = sprintf( + '%4$s', + ( $icon ) ? $icon : '', + ( $cart_count_display ) ? '' : 'no-cart-total', + ( $cart_count_display ) ? 'data-cart-total="' . $cart_contents_count . '"' : '', + ( $icon ) ? ( ( false !== Astra_Icons::is_svg_icons() ) ? Astra_Icons::get_icons( $icon ) : '' ) : '' + ); + + // Theme's default icon with cart title and cart total. + if ( 'default' == $icon || ! defined( 'ASTRA_EXT_VER' ) || ( defined( 'ASTRA_EXT_VER' ) && ! Astra_Ext_Extension::is_active( 'edd' ) ) ) { + // Cart Total or Cart Title enable then only add markup. + if ( $cart_title_display || $cart_total_display ) { + echo $cart_info_markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + } + } else { + + // Remove Default cart icon added by theme. + add_filter( 'astra_edd_default_header_cart_icon', '__return_false' ); + + /* translators: 1: Cart Title Markup, 2: Cart Icon Markup */ + printf( + '
+ %1$s + %2$s +
', + ( $cart_title_display || $cart_total_display ) ? $cart_info_markup : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + ( $cart_icon ) ? $cart_icon : '' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + ); + } + } + + /** + * Header Cart Icon Class + * + * @param array $classes Default argument array. + * + * @return array; + */ + public function header_cart_icon_class( $classes ) { + + if ( false === Astra_Builder_Helper::$is_header_footer_builder_active && ! defined( 'ASTRA_EXT_VER' ) ) { + return; + } + + $header_cart_icon_style = astra_get_option( 'edd-header-cart-icon-style' ); + + $classes[] = 'ast-edd-menu-cart-' . $header_cart_icon_style; + $header_cart_icon_has_color = astra_get_option( 'edd-header-cart-icon-color' ); + if ( ! empty( $header_cart_icon_has_color ) && ( 'none' !== $header_cart_icon_style ) ) { + $classes[] = 'ast-menu-cart-has-color'; + } + + return $classes; + } + + /** + * Disable EDD style only for the first time + * + * @return void + */ + public function edd_set_defaults_initialization() { + + $astra_theme_options = get_option( 'astra-settings' ); + $edd_settings = get_option( 'edd_settings' ); + + // Set flag to set the EDD style disable only once for the very first time. + if ( ! isset( $astra_theme_options['ast-edd-disable-styles'] ) ) { + $astra_theme_options['ast-edd-disable-styles'] = true; + $edd_settings['disable_styles'] = true; + update_option( 'astra-settings', $astra_theme_options ); + update_option( 'edd_settings', $edd_settings ); + } + + } + + /** + * Single Product Navigation + * + * @param array $args single products navigation arguments. + * + * @return array $args single products navigation arguments. + */ + public function edd_single_post_navigation( $args ) { + $is_edd_single_product_page = astra_is_edd_single_product_page(); + $disable_single_product_navigation = astra_get_option( 'disable-edd-single-product-nav' ); + if ( $is_edd_single_product_page && ! $disable_single_product_navigation ) { + $next_post = get_next_post(); + $prev_post = get_previous_post(); + + $next_text = false; + if ( $next_post ) { + $next_text = sprintf( + '%s ', + $next_post->post_title + ); + } + + $prev_text = false; + if ( $prev_post ) { + $prev_text = sprintf( + ' %s', + $prev_post->post_title + ); + } + + $args['prev_text'] = $prev_text; + $args['next_text'] = $next_text; + } elseif ( $is_edd_single_product_page && $disable_single_product_navigation ) { + $args['prev_text'] = false; + $args['next_text'] = false; + } + + return $args; + } + + /** + * EDD Initialization + * + * @return void + */ + public function edd_initialization() { + $is_edd_archive_page = astra_is_edd_archive_page(); + $is_edd_single_product_page = astra_is_edd_single_product_page(); + + if ( $is_edd_archive_page ) { + add_action( 'astra_template_parts_content', array( $this, 'edd_content_loop' ) ); + remove_action( 'astra_template_parts_content', array( Astra_Loop::get_instance(), 'template_parts_default' ) ); + + // Add edd wrapper. + add_action( 'astra_template_parts_content_top', array( $this, 'astra_edd_templat_part_wrap_open' ), 25 ); + add_action( 'astra_template_parts_content_bottom', array( $this, 'astra_edd_templat_part_wrap_close' ), 5 ); + + // Remove closing and ending div 'ast-row'. + remove_action( 'astra_template_parts_content_top', array( Astra_Loop::get_instance(), 'astra_templat_part_wrap_open' ), 25 ); + remove_action( 'astra_template_parts_content_bottom', array( Astra_Loop::get_instance(), 'astra_templat_part_wrap_close' ), 5 ); + } + if ( $is_edd_single_product_page ) { + remove_action( 'astra_template_parts_content', array( Astra_Loop::get_instance(), 'template_parts_post' ) ); + + add_action( 'astra_template_parts_content', array( $this, 'edd_single_template' ) ); + + } + } + + + /** + * Add wrapper for edd archive pages + * + * @return void + */ + public function astra_edd_templat_part_wrap_open() { + ?> +
+ +
+ + +
> + + + + + + + +
+ + +
> + +
+ 0 ) { + $classes = array_diff( + $classes, + array( + // Astra common grid. + 'ast-col-sm-12', + 'ast-col-md-8', + 'ast-col-md-6', + 'ast-col-md-12', + + // Astra Blog / Single Post. + 'ast-article-post', + 'ast-article-single', + 'ast-separate-posts', + 'remove-featured-img-padding', + 'ast-featured-post', + ) + ); + } + return $classes; + } + + /** + * Add Cart icon markup + * + * @param String $output Markup. + * @param String $section Section name. + * @param String $section_type Section selected option. + * @return Markup String. + * + * @since 1.5.5 + */ + public function astra_header_cart( $output, $section, $section_type ) { + + if ( 'edd' === $section_type && apply_filters( 'astra_edd_header_cart_icon', true ) ) { + + $output = $this->edd_mini_cart_markup(); + } + + return $output; + } + + /** + * Easy Digital DOwnloads mini cart markup markup + * + * @since 1.5.5 + * @return html + */ + public function edd_mini_cart_markup() { + $class = ''; + if ( edd_is_checkout() ) { + $class = 'current-menu-item'; + } + + $cart_menu_classes = apply_filters( 'astra_edd_cart_in_menu_class', array( 'ast-menu-cart-with-border' ) ); + + ob_start(); + if ( is_customize_preview() && ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ) { + Astra_Builder_UI_Controller::render_customizer_edit_button(); + } + ?> +
+
+ astra_get_edd_cart(); ?> +
+ +
+ +
+ +
+ + + + +
+ + + +
+ +
+ array( + 'width' => '100%', + ), + '.tablet-columns-2 .ast-edd-archive-article' => array( + 'width' => '47.6%', + 'width' => 'calc(50% - 10px)', + ), + '.tablet-columns-3 .ast-edd-archive-article, .edd_downloads_list[class*="edd_download_columns_"] .edd_download' => array( + 'width' => '30.2%', + 'width' => 'calc(33.33% - 14px)', + ), + '.tablet-columns-4 .ast-edd-archive-article' => array( + 'width' => '21.5%', + 'width' => 'calc(25% - 15px)', + ), + '.tablet-columns-5 .ast-edd-archive-article' => array( + 'width' => '16.2%', + 'width' => 'calc(20% - 16px)', + ), + '.tablet-columns-6 .ast-edd-archive-article' => array( + 'width' => '12.7%', + 'width' => 'calc(16.66% - 16.66px)', + ), + ); + } else { + $max_tablet_edd_css = array( + '.tablet-columns-1 .ast-edd-container' => array( + 'grid-template-columns' => 'repeat(1, 1fr)', + ), + '.tablet-columns-2 .ast-edd-container' => array( + 'grid-template-columns' => 'repeat(2, 1fr)', + ), + '.tablet-columns-3 .ast-edd-container, .edd_downloads_list[class*="edd_download_columns_"] .edd_download' => array( + 'grid-template-columns' => 'repeat(3, 1fr)', + ), + '.tablet-columns-4 .ast-edd-container' => array( + 'grid-template-columns' => 'repeat(4, 1fr)', + ), + '.tablet-columns-5 .ast-edd-container' => array( + 'grid-template-columns' => 'repeat(5, 1fr)', + ), + '.tablet-columns-6 .ast-edd-container' => array( + 'grid-template-columns' => 'repeat(6, 1fr)', + ), + ); + } + + /* Parse CSS from array() -> max-width: (tablet-breakpoint) px & min-width: (mobile-breakpoint + 1) px */ + $edd_css_output = astra_parse_css( $max_tablet_edd_css, astra_get_mobile_breakpoint( '', 1 ), astra_get_tablet_breakpoint() ); + + if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { + if ( $is_site_rtl ) { + $max_tablet_edd_lang_direction_css = array( + '[class*="columns-"] .ast-edd-archive-article:nth-child(n)' => array( + 'margin-left' => '20px', + 'clear' => 'none', + ), + '.tablet-columns-2 .ast-edd-archive-article:nth-child(2n), .tablet-columns-3 .ast-edd-archive-article:nth-child(3n), .tablet-columns-4 .ast-edd-archive-article:nth-child(4n), .tablet-columns-5 .ast-edd-archive-article:nth-child(5n), .tablet-columns-6 .ast-edd-archive-article:nth-child(6n), .edd_downloads_list[class*="edd_download_columns_"] .edd_download:nth-child(3n)' => array( + 'margin-left' => '0', + 'clear' => 'left', + ), + '.tablet-columns-2 .ast-edd-archive-article:nth-child(2n+1), .tablet-columns-3 .ast-edd-archive-article:nth-child(3n+1), .tablet-columns-4 .ast-edd-archive-article:nth-child(4n+1), .tablet-columns-5 .ast-edd-archive-article:nth-child(5n+1), .tablet-columns-6 .ast-edd-archive-article:nth-child(6n+1), .edd_downloads_list[class*="edd_download_columns_"] .edd_download:nth-child(3n+1)' => array( + 'clear' => 'right', + ), + ); + } else { + $max_tablet_edd_lang_direction_css = array( + '[class*="columns-"] .ast-edd-archive-article:nth-child(n)' => array( + 'margin-right' => '20px', + 'clear' => 'none', + ), + '.tablet-columns-2 .ast-edd-archive-article:nth-child(2n), .tablet-columns-3 .ast-edd-archive-article:nth-child(3n), .tablet-columns-4 .ast-edd-archive-article:nth-child(4n), .tablet-columns-5 .ast-edd-archive-article:nth-child(5n), .tablet-columns-6 .ast-edd-archive-article:nth-child(6n), .edd_downloads_list[class*="edd_download_columns_"] .edd_download:nth-child(3n)' => array( + 'margin-right' => '0', + 'clear' => 'right', + ), + '.tablet-columns-2 .ast-edd-archive-article:nth-child(2n+1), .tablet-columns-3 .ast-edd-archive-article:nth-child(3n+1), .tablet-columns-4 .ast-edd-archive-article:nth-child(4n+1), .tablet-columns-5 .ast-edd-archive-article:nth-child(5n+1), .tablet-columns-6 .ast-edd-archive-article:nth-child(6n+1), .edd_downloads_list[class*="edd_download_columns_"] .edd_download:nth-child(3n+1)' => array( + 'clear' => 'left', + ), + ); + } + /* Parse CSS from array() -> max-width: (tablet-breakpoint) px & min-width: (mobile-breakpoint + 1) px */ + $edd_css_output .= astra_parse_css( $max_tablet_edd_lang_direction_css, astra_get_mobile_breakpoint( '', 1 ), astra_get_tablet_breakpoint() ); + } + + if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { + $mobile_edd_css = array( + '.mobile-columns-1 .ast-edd-archive-article' => array( + 'width' => '100%', + ), + '.mobile-columns-3 .ast-edd-archive-article' => array( + 'width' => '28.2%', + 'width' => 'calc(33.33% - 14px)', + ), + '.mobile-columns-4 .ast-edd-archive-article' => array( + 'width' => '19%', + 'width' => 'calc(25% - 15px)', + ), + '.mobile-columns-5 .ast-edd-archive-article' => array( + 'width' => '13%', + 'width' => 'calc(20% - 16px)', + ), + '.mobile-columns-6 .ast-edd-archive-article' => array( + 'width' => '10.2%', + 'width' => 'calc(16.66% - 16.66px)', + ), + '.edd_downloads_list[class*="edd_download_columns_"] .edd_download, .edd_downloads_list[class*="edd_download_columns_"] .edd_download:nth-child(2n+1), .mobile-columns-2 .ast-edd-archive-article' => array( + 'width' => '46.1%', + 'width' => 'calc(50% - 10px)', + ), + ); + } else { + $mobile_edd_css = array( + '.mobile-columns-1 .ast-edd-container' => array( + 'grid-template-columns' => 'repeat(1, 1fr)', + ), + '.mobile-columns-3 .ast-edd-container' => array( + 'grid-template-columns' => 'repeat(3, 1fr)', + ), + '.mobile-columns-4 .ast-edd-container' => array( + 'grid-template-columns' => 'repeat(4, 1fr)', + ), + '.mobile-columns-5 .ast-edd-container' => array( + 'grid-template-columns' => 'repeat(5, 1fr)', + ), + '.mobile-columns-6 .ast-edd-container' => array( + 'grid-template-columns' => 'repeat(6, 1fr)', + ), + '.edd_downloads_list[class*="edd_download_columns_"] .edd_download, .edd_downloads_list[class*="edd_download_columns_"] .edd_download:nth-child(2n+1), .mobile-columns-2 .ast-edd-container' => array( + 'grid-template-columns' => 'repeat(2, 1fr)', + ), + ); + } + + /* Parse CSS from array() -> max-width: (mobile-breakpoint) px */ + $edd_css_output .= astra_parse_css( $mobile_edd_css, '', astra_get_mobile_breakpoint() ); + + if ( $is_site_rtl ) { + $mobile_edd_lang_direction_css = array( + '[class*="columns-"] .ast-edd-archive-article:nth-child(n)' => array( + 'margin-left' => '20px', + 'clear' => 'none', + ), + '.mobile-columns-1 .ast-edd-archive-article:nth-child(n)' => array( + 'margin-left' => '0', + ), + '.edd_downloads_list[class*="edd_download_columns_"] .edd_download:nth-child(2n), .mobile-columns-2 .ast-edd-archive-article:nth-child(2n), .mobile-columns-3 .ast-edd-archive-article:nth-child(3n), .mobile-columns-4 .ast-edd-archive-article:nth-child(4n), .mobile-columns-5 .ast-edd-archive-article:nth-child(5n), .mobile-columns-6 .ast-edd-archive-article:nth-child(6n)' => array( + 'margin-left' => '0', + 'clear' => 'left', + ), + '.mobile-columns-2 .ast-edd-archive-article:nth-child(2n+1), .mobile-columns-3 .ast-edd-archive-article:nth-child(3n+1), .mobile-columns-4 .ast-edd-archive-article:nth-child(4n+1), .mobile-columns-5 .ast-edd-archive-article:nth-child(5n+1), .mobile-columns-6 .ast-edd-archive-article:nth-child(6n+1)' => array( + 'clear' => 'right', + ), + ); + } else { + $mobile_edd_lang_direction_css = array( + '[class*="columns-"] .ast-edd-archive-article:nth-child(n)' => array( + 'margin-right' => '20px', + 'clear' => 'none', + ), + '.mobile-columns-1 .ast-edd-archive-article:nth-child(n)' => array( + 'margin-right' => '0', + ), + '.edd_downloads_list[class*="edd_download_columns_"] .edd_download:nth-child(2n), .mobile-columns-2 .ast-edd-archive-article:nth-child(2n), .mobile-columns-3 .ast-edd-archive-article:nth-child(3n), .mobile-columns-4 .ast-edd-archive-article:nth-child(4n), .mobile-columns-5 .ast-edd-archive-article:nth-child(5n), .mobile-columns-6 .ast-edd-archive-article:nth-child(6n)' => array( + 'margin-right' => '0', + 'clear' => 'right', + ), + '.mobile-columns-2 .ast-edd-archive-article:nth-child(2n+1), .mobile-columns-3 .ast-edd-archive-article:nth-child(3n+1), .mobile-columns-4 .ast-edd-archive-article:nth-child(4n+1), .mobile-columns-5 .ast-edd-archive-article:nth-child(5n+1), .mobile-columns-6 .ast-edd-archive-article:nth-child(6n+1)' => array( + 'clear' => 'left', + ), + ); + } + + /* Parse CSS from array() -> max-width: (mobile-breakpoint) px */ + $edd_css_output .= astra_parse_css( $mobile_edd_lang_direction_css, '', astra_get_mobile_breakpoint() ); + + wp_add_inline_style( 'astra-edd', apply_filters( 'astra_theme_edd_dynamic_css', $edd_css_output ) ); + + // Inline js for EDD Cart updates. + wp_add_inline_script( + 'edd-ajax', + "jQuery( document ).ready( function($) { + /** + * Astra - Easy Digital Downloads Cart Quantity & Total Amount + */ + var cartQuantity = jQuery('.ast-edd-site-header-cart-wrap .count'), + iconQuantity = jQuery('.ast-edd-site-header-cart-wrap .astra-icon'), + cartTotalAmount = jQuery('.ast-edd-site-header-cart-wrap .ast-edd-header-cart-total'); + + jQuery('body').on('edd_cart_item_added', function( event, response ) { + cartQuantity.html( response.cart_quantity ); + iconQuantity.attr('data-cart-total', response.cart_quantity ); + cartTotalAmount.html( response.total ); + }); + + jQuery('body').on('edd_cart_item_removed', function( event, response ) { + cartQuantity.html( response.cart_quantity ); + iconQuantity.attr('data-cart-total', response.cart_quantity ); + cartTotalAmount.html( response.total ); + }); + });" + ); + } + + /** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @since 1.5.5 + * @return string $dynamic_css + */ + public function add_inline_styles( $dynamic_css, $dynamic_css_filtered = '' ) { + + /** + * - Variable Declaration + */ + + $site_content_width = astra_get_option( 'site-content-width', 1200 ); + $edd_archive_width = astra_get_option( 'edd-archive-width' ); + $edd_archive_max_width = astra_get_option( 'edd-archive-max-width' ); + $css_output = ''; + + $theme_color = astra_get_option( 'theme-color' ); + $link_color = astra_get_option( 'link-color', $theme_color ); + $text_color = astra_get_option( 'text-color' ); + $link_h_color = astra_get_option( 'link-h-color' ); + + $btn_color = astra_get_option( 'button-color' ); + if ( empty( $btn_color ) ) { + $btn_color = astra_get_foreground_color( $theme_color ); + } + + $btn_h_color = astra_get_option( 'button-h-color' ); + if ( empty( $btn_h_color ) ) { + $btn_h_color = astra_get_foreground_color( $link_h_color ); + } + $btn_bg_h_color = astra_get_option( 'button-bg-h-color', $link_h_color ); + + $btn_border_radius = astra_get_option( 'button-radius' ); + + $cart_h_color = astra_get_foreground_color( $link_h_color ); + + $css_output = array( + // Loading effect color. + 'a.edd-add-to-cart.white .edd-loading, .edd-discount-loader.edd-loading, .edd-loading-ajax.edd-loading' => array( + 'border-left-color' => esc_attr( $cart_h_color ), + ), + ); + + if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) { + + $compat_css_desktop = array( + /** + * Cart in menu + */ + '.ast-edd-site-header-cart a' => array( + 'color' => esc_attr( $text_color ), + ), + + '.ast-edd-site-header-cart a:focus, .ast-edd-site-header-cart a:hover, .ast-edd-site-header-cart .current-menu-item a' => array( + 'color' => esc_attr( $text_color ), + ), + + '.ast-edd-cart-menu-wrap .count, .ast-edd-cart-menu-wrap .count:after' => array( + 'border-color' => esc_attr( $link_color ), + 'color' => esc_attr( $link_color ), + ), + + '.ast-edd-cart-menu-wrap:hover .count' => array( + 'color' => esc_attr( $cart_h_color ), + 'background-color' => esc_attr( $link_color ), + ), + '.ast-edd-site-header-cart .widget_edd_cart_widget .cart-total' => array( + 'color' => esc_attr( $link_color ), + ), + + '.ast-edd-site-header-cart .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a' => array( + 'color' => $btn_h_color, + 'border-color' => $btn_bg_h_color, + 'background-color' => $btn_bg_h_color, + 'border-radius' => astra_get_css_value( $btn_border_radius, 'px' ), + ), + '.site-header .ast-edd-site-header-cart .ast-edd-site-header-cart-widget .edd_checkout a, .site-header .ast-edd-site-header-cart .ast-edd-site-header-cart-widget .edd_checkout a:hover' => array( + 'color' => $btn_color, + ), + '.below-header-user-select .ast-edd-site-header-cart .widget, .ast-above-header-section .ast-edd-site-header-cart .widget a, .below-header-user-select .ast-edd-site-header-cart .widget_edd_cart_widget a' => array( + 'color' => $text_color, + ), + '.below-header-user-select .ast-edd-site-header-cart .widget_edd_cart_widget a:hover, .ast-above-header-section .ast-edd-site-header-cart .widget_edd_cart_widget a:hover, .below-header-user-select .ast-edd-site-header-cart .widget_edd_cart_widget a.remove:hover, .ast-above-header-section .ast-edd-site-header-cart .widget_edd_cart_widget a.remove:hover' => array( + 'color' => esc_attr( $link_color ), + ), + '.widget_edd_cart_widget a.edd-remove-from-cart:hover:after' => array( + 'color' => esc_attr( $link_color ), + 'border-color' => esc_attr( $link_color ), + 'background-color' => esc_attr( '#ffffff' ), + ), + ); + + $css_output = array_merge( $css_output, $compat_css_desktop ); + } + + /* Parse CSS from array() */ + $css_output = astra_parse_css( $css_output ); + + /* Easy Digital DOwnloads Shop Archive width */ + if ( 'custom' === $edd_archive_width ) : + // Easy Digital DOwnloads shop archive custom width. + $site_width = array( + '.ast-edd-archive-page .site-content > .ast-container' => array( + 'max-width' => astra_get_css_value( $edd_archive_max_width, 'px' ), + ), + ); + $css_output .= astra_parse_css( $site_width, astra_get_tablet_breakpoint( '', 1 ) ); + + else : + // Easy Digital DOwnloads shop archive default width. + $site_width = array( + '.ast-edd-archive-page .site-content > .ast-container' => array( + 'max-width' => astra_get_css_value( $site_content_width + 40, 'px' ), + ), + ); + + /* Parse CSS from array()*/ + $css_output .= astra_parse_css( $site_width, astra_get_tablet_breakpoint( '', 1 ) ); + endif; + + $dynamic_css .= apply_filters( 'astra_theme_edd_dynamic_css', $css_output ); + + return $dynamic_css; + } + + /** + * Theme Defaults. + * + * @param array $defaults Array of options value. + * @return array + */ + public function theme_defaults( $defaults ) { + + // Container. + $defaults['edd-content-layout'] = 'plain-container'; + + // // Sidebar. + $defaults['edd-sidebar-layout'] = 'no-sidebar'; + $defaults['edd-single-product-sidebar-layout'] = 'default'; + + // Edd Archive. + $defaults['edd-archive-grids'] = array( + 'desktop' => 4, + 'tablet' => 3, + 'mobile' => 2, + ); + + $defaults['edd-archive-product-structure'] = array( + 'image', + 'category', + 'title', + 'price', + 'add_cart', + ); + + $defaults['edd-archive-add-to-cart-button-text'] = __( 'Add To Cart', 'astra' ); + $defaults['edd-archive-variable-button'] = 'button'; + $defaults['edd-archive-variable-button-text'] = __( 'View Details', 'astra' ); + + $defaults['edd-archive-width'] = 'default'; + $defaults['edd-archive-max-width'] = 1200; + $defaults['disable-edd-single-product-nav'] = false; + + return $defaults; + } + + + /** + * Add products item class to the body + * + * @param Array $classes product classes. + * + * @return array. + */ + public function edd_products_item_class( $classes = '' ) { + + $is_edd_archive_page = astra_is_edd_archive_page(); + + if ( $is_edd_archive_page ) { + $shop_grid = astra_get_option( 'edd-archive-grids' ); + $classes[] = 'columns-' . $shop_grid['desktop']; + $classes[] = 'tablet-columns-' . $shop_grid['tablet']; + $classes[] = 'mobile-columns-' . $shop_grid['mobile']; + + $classes[] = 'ast-edd-archive-page'; + } + + return $classes; + } + + /** + * Add class on single product page + * + * @param Array $classes product classes. + * + * @return array. + */ + public function edd_single_product_class( $classes ) { + + $is_edd_archive_page = astra_is_edd_archive_page(); + + if ( $is_edd_archive_page ) { + $classes[] = 'ast-edd-archive-article'; + } + + return $classes; + } + + /** + * Store widgets init. + */ + public function store_widgets_init() { + register_sidebar( + apply_filters( + 'astra_edd_sidebar_init', + array( + 'name' => esc_html__( 'Easy Digital Downloads Sidebar', 'astra' ), + 'id' => 'astra-edd-sidebar', + 'description' => __( 'This sidebar will be used on Product archive, Cart, Checkout and My Account pages.', 'astra' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) + ) + ); + register_sidebar( + apply_filters( + 'astra_edd_single_product_sidebar_init', + array( + 'name' => esc_html__( 'EDD Single Product Sidebar', 'astra' ), + 'id' => 'astra-edd-single-product-sidebar', + 'description' => __( 'This sidebar will be used on EDD Single Product page.', 'astra' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) + ) + ); + } + + /** + * Assign shop sidebar for store page. + * + * @param String $sidebar Sidebar. + * + * @return String $sidebar Sidebar. + */ + public function replace_store_sidebar( $sidebar ) { + + $is_edd_page = astra_is_edd_page(); + $is_edd_single_product_page = astra_is_edd_single_product_page(); + + if ( $is_edd_page && ! $is_edd_single_product_page ) { + $sidebar = 'astra-edd-sidebar'; + } elseif ( $is_edd_single_product_page ) { + $sidebar = 'astra-edd-single-product-sidebar'; + } + + return $sidebar; + } + + /** + * Easy Digital Downloads Container + * + * @param String $sidebar_layout Layout type. + * + * @return String $sidebar_layout Layout type. + */ + public function store_sidebar_layout( $sidebar_layout ) { + + $is_edd_page = astra_is_edd_page(); + $is_edd_single_product_page = astra_is_edd_single_product_page(); + $is_edd_archive_page = astra_is_edd_archive_page(); + + if ( $is_edd_page ) { + + $edd_sidebar = astra_get_option( 'edd-sidebar-layout' ); + + if ( 'default' !== $edd_sidebar ) { + + $sidebar_layout = $edd_sidebar; + } + + if ( $is_edd_single_product_page ) { + $edd_single_product_sidebar = astra_get_option( 'edd-single-product-sidebar-layout' ); + + if ( 'default' !== $edd_single_product_sidebar ) { + $sidebar_layout = $edd_single_product_sidebar; + } else { + $sidebar_layout = astra_get_option( 'site-sidebar-layout' ); + } + + $page_id = get_the_ID(); + $edd_sidebar_layout = get_post_meta( $page_id, 'site-sidebar-layout', true ); + } elseif ( $is_edd_archive_page ) { + $edd_sidebar_layout = astra_get_option( 'edd-sidebar-layout' ); + } else { + $edd_sidebar_layout = astra_get_option_meta( 'site-sidebar-layout', '', true ); + } + + if ( 'default' !== $edd_sidebar_layout && ! empty( $edd_sidebar_layout ) ) { + $sidebar_layout = $edd_sidebar_layout; + } + } + + return $sidebar_layout; + } + /** + * Easy Digital Downloads Container + * + * @param String $layout Layout type. + * + * @return String $layout Layout type. + */ + public function store_content_layout( $layout ) { + + $is_edd_page = astra_is_edd_page(); + $is_edd_single_page = astra_is_edd_single_page(); + $is_edd_archive_page = astra_is_edd_archive_page(); + + if ( $is_edd_page ) { + + $edd_layout = astra_get_option( 'edd-content-layout' ); + + if ( 'default' !== $edd_layout ) { + + $layout = $edd_layout; + } + + if ( $is_edd_single_page ) { + $page_id = get_the_ID(); + $edd_page_layout = get_post_meta( $page_id, 'site-content-layout', true ); + } elseif ( $is_edd_archive_page ) { + $edd_page_layout = astra_get_option( 'edd-content-layout' ); + } else { + $edd_page_layout = astra_get_option_meta( 'site-content-layout', '', true ); + } + + if ( 'default' !== $edd_page_layout && ! empty( $edd_page_layout ) ) { + $layout = $edd_page_layout; + } + } + + return $layout; + } + + /** + * Register Customizer sections and panel for Easy Digital Downloads. + * + * @since 1.5.5 + * @param WP_Customize_Manager $wp_customize Theme Customizer object. + */ + public function customize_register( $wp_customize ) { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + /** + * Register Sections & Panels + */ + require ASTRA_THEME_DIR . 'inc/compatibility/edd/customizer/class-astra-customizer-register-edd-section.php'; + + /** + * Sections + */ + require ASTRA_THEME_DIR . 'inc/compatibility/edd/customizer/sections/class-astra-edd-container-configs.php'; + require ASTRA_THEME_DIR . 'inc/compatibility/edd/customizer/sections/class-astra-edd-sidebar-configs.php'; + require ASTRA_THEME_DIR . 'inc/compatibility/edd/customizer/sections/layout/class-astra-edd-archive-layout-configs.php'; + require ASTRA_THEME_DIR . 'inc/compatibility/edd/customizer/sections/layout/class-astra-edd-single-product-layout-configs.php'; + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + + } + + } + +endif; + +if ( apply_filters( 'astra_enable_edd_integration', true ) ) { + Astra_Edd::get_instance(); +} diff --git a/inc/compatibility/edd/customizer/class-astra-customizer-register-edd-section.php b/inc/compatibility/edd/customizer/class-astra-customizer-register-edd-section.php new file mode 100644 index 0000000..afdfa36 --- /dev/null +++ b/inc/compatibility/edd/customizer/class-astra-customizer-register-edd-section.php @@ -0,0 +1,67 @@ + 'section-edd-group', + 'type' => 'section', + 'title' => __( 'Easy Digital Downloads', 'astra' ), + 'priority' => 60, + ), + + array( + 'name' => 'section-edd-archive', + 'title' => __( 'Product Archive', 'astra' ), + 'type' => 'section', + 'section' => 'section-edd-group', + 'priority' => 10, + ), + + array( + 'name' => 'section-edd-single', + 'type' => 'section', + 'title' => __( 'Single Product', 'astra' ), + 'section' => 'section-edd-group', + 'priority' => 15, + ), + ); + + return array_merge( $configurations, $configs ); + } + } +} + + +new Astra_Customizer_Register_Edd_Section(); diff --git a/inc/compatibility/edd/customizer/sections/class-astra-edd-container-configs.php b/inc/compatibility/edd/customizer/sections/class-astra-edd-container-configs.php new file mode 100644 index 0000000..45c2cb3 --- /dev/null +++ b/inc/compatibility/edd/customizer/sections/class-astra-edd-container-configs.php @@ -0,0 +1,64 @@ + ASTRA_THEME_SETTINGS . '[edd-content-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'default' => astra_get_option( 'edd-content-layout' ), + 'section' => 'section-container-layout', + 'priority' => 85, + 'title' => __( 'Easy Digital Downloads Layout', 'astra' ), + 'divider' => array( 'ast_class' => 'ast-top-divider' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'boxed-container' => __( 'Boxed', 'astra' ), + 'content-boxed-container' => __( 'Content Boxed', 'astra' ), + 'plain-container' => __( 'Full Width / Contained', 'astra' ), + 'page-builder' => __( 'Full Width / Stretched', 'astra' ), + ), + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Edd_Container_Configs(); + diff --git a/inc/compatibility/edd/customizer/sections/class-astra-edd-sidebar-configs.php b/inc/compatibility/edd/customizer/sections/class-astra-edd-sidebar-configs.php new file mode 100644 index 0000000..eb36e7f --- /dev/null +++ b/inc/compatibility/edd/customizer/sections/class-astra-edd-sidebar-configs.php @@ -0,0 +1,84 @@ + ASTRA_THEME_SETTINGS . '[edd-sidebar-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-sidebars', + 'default' => astra_get_option( 'edd-sidebar-layout' ), + 'priority' => 5, + 'title' => __( 'Easy Digital Downloads', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'no-sidebar' => __( 'No Sidebar', 'astra' ), + 'left-sidebar' => __( 'Left Sidebar', 'astra' ), + 'right-sidebar' => __( 'Right Sidebar', 'astra' ), + ), + ), + + /** + * Option: Single Product + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[edd-single-product-sidebar-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'default' => astra_get_option( 'edd-single-product-sidebar-layout' ), + 'section' => 'section-sidebars', + 'priority' => 5, + 'title' => __( 'EDD Single Product', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'no-sidebar' => __( 'No Sidebar', 'astra' ), + 'left-sidebar' => __( 'Left Sidebar', 'astra' ), + 'right-sidebar' => __( 'Right Sidebar', 'astra' ), + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Edd_Sidebar_Configs(); + + + diff --git a/inc/compatibility/edd/customizer/sections/layout/class-astra-edd-archive-layout-configs.php b/inc/compatibility/edd/customizer/sections/layout/class-astra-edd-archive-layout-configs.php new file mode 100644 index 0000000..bd770a9 --- /dev/null +++ b/inc/compatibility/edd/customizer/sections/layout/class-astra-edd-archive-layout-configs.php @@ -0,0 +1,214 @@ + ASTRA_THEME_SETTINGS . '[edd-archive-grids]', + 'type' => 'control', + 'control' => 'ast-responsive-slider', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), + 'section' => 'section-edd-archive', + 'default' => astra_get_option( + 'edd-archive-grids', + array( + 'desktop' => 4, + 'tablet' => 3, + 'mobile' => 2, + ) + ), + 'priority' => 10, + 'title' => __( 'Archive Columns', 'astra' ), + 'input_attrs' => array( + 'step' => 1, + 'min' => 1, + 'max' => 6, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'transport' => 'postMessage', + ), + + /** + * Option: EDD Archive Post Meta + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[edd-archive-product-structure]', + 'type' => 'control', + 'control' => 'ast-sortable', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ), + 'section' => 'section-edd-archive', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'default' => astra_get_option( 'edd-archive-product-structure' ), + 'priority' => 30, + 'title' => __( 'Product Structure', 'astra' ), + 'description' => __( 'The Image option cannot be sortable if the Product Style is selected to the List Style ', 'astra' ), + 'choices' => array( + 'image' => __( 'Image', 'astra' ), + 'category' => __( 'Category', 'astra' ), + 'title' => __( 'Title', 'astra' ), + 'price' => __( 'Price', 'astra' ), + 'short_desc' => __( 'Short Description', 'astra' ), + 'add_cart' => __( 'Add To Cart', 'astra' ), + ), + ), + + /** + * Option: Add to Cart button text + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[edd-archive-add-to-cart-button-text]', + 'type' => 'control', + 'control' => 'text', + 'section' => 'section-edd-archive', + 'default' => astra_get_option( 'edd-archive-add-to-cart-button-text' ), + 'priority' => 31, + 'title' => __( 'Cart Button Text', 'astra' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[edd-archive-product-structure]', + 'operator' => 'contains', + 'value' => 'add_cart', + ), + ), + ), + + /** + * Option: Variable product button + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[edd-archive-variable-button]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-edd-archive', + 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-top-divider' ), + 'default' => astra_get_option( 'edd-archive-variable-button' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[edd-archive-product-structure]', + 'operator' => 'contains', + 'value' => 'add_cart', + ), + ), + 'priority' => 31, + 'title' => __( 'Variable Product Button', 'astra' ), + 'choices' => array( + 'button' => __( 'Button', 'astra' ), + 'options' => __( 'Options', 'astra' ), + ), + ), + + /** + * Option: Variable product button text + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[edd-archive-variable-button-text]', + 'type' => 'control', + 'control' => 'text', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'section' => 'section-edd-archive', + 'default' => astra_get_option( 'edd-archive-variable-button-text' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[edd-archive-variable-button]', + 'operator' => '==', + 'value' => 'button', + ), + ), + 'priority' => 31, + 'title' => __( 'Variable Product Button Text', 'astra' ), + ), + + /** + * Option: Archive Content Width + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[edd-archive-width]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-edd-archive', + 'default' => astra_get_option( 'edd-archive-width' ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'priority' => 220, + 'title' => __( 'Archive Content Width', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'custom' => __( 'Custom', 'astra' ), + ), + 'transport' => 'postMessage', + ), + + /** + * Option: Enter Width + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[edd-archive-max-width]', + 'type' => 'control', + 'control' => 'ast-slider', + 'section' => 'section-edd-archive', + 'default' => astra_get_option( 'edd-archive-max-width' ), + 'priority' => 225, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[edd-archive-width]', + 'operator' => '===', + 'value' => 'custom', + ), + ), + + 'title' => __( 'Custom Width', 'astra' ), + 'transport' => 'postMessage', + 'suffix' => 'px', + 'input_attrs' => array( + 'min' => 768, + 'step' => 1, + 'max' => 1920, + ), + ), + ); + + $configurations = array_merge( $configurations, $_configs ); + + return $configurations; + + } + } +} + +new Astra_Edd_Archive_Layout_Configs(); + diff --git a/inc/compatibility/edd/customizer/sections/layout/class-astra-edd-single-product-layout-configs.php b/inc/compatibility/edd/customizer/sections/layout/class-astra-edd-single-product-layout-configs.php new file mode 100644 index 0000000..64e163b --- /dev/null +++ b/inc/compatibility/edd/customizer/sections/layout/class-astra-edd-single-product-layout-configs.php @@ -0,0 +1,57 @@ + ASTRA_THEME_SETTINGS . '[disable-edd-single-product-nav]', + 'section' => 'section-edd-single', + 'type' => 'control', + 'control' => 'ast-toggle-control', + 'default' => astra_get_option( 'disable-edd-single-product-nav' ), + 'title' => __( 'Disable Product Navigation', 'astra' ), + 'priority' => 10, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + + ), + ); + + return array_merge( $configurations, $_configs ); + } + } +} + +new Astra_Edd_Single_Product_Layout_Configs(); diff --git a/inc/compatibility/edd/edd-common-functions.php b/inc/compatibility/edd/edd-common-functions.php new file mode 100644 index 0000000..7bcbca6 --- /dev/null +++ b/inc/compatibility/edd/edd-common-functions.php @@ -0,0 +1,324 @@ +'; + do_action( 'astra_edd_archive_block_wrap_top' ); + + foreach ( $edd_structure as $value ) { + + switch ( $value ) { + case 'title': + /** + * Add Product Title on edd page for all products. + */ + do_action( 'astra_edd_archive_title_before' ); + do_action( 'astra_edd_archive_title' ); + do_action( 'astra_edd_archive_title_after' ); + break; + case 'image': + /** + * Add Product Title on edd page for all products. + */ + do_action( 'astra_edd_archive_image_before' ); + do_action( 'astra_edd_archive_image' ); + do_action( 'astra_edd_archive_image_after' ); + break; + case 'price': + /** + * Add Product Price on edd page for all products. + */ + do_action( 'astra_edd_archive_price_before' ); + do_action( 'astra_edd_archive_price' ); + do_action( 'astra_edd_archive_price_after' ); + break; + case 'short_desc': + /** + * Add Product short description on edd page for all products. + */ + do_action( 'astra_edd_archive_short_description_before' ); + do_action( 'astra_edd_archive_short_description' ); + do_action( 'astra_edd_archive_short_description_after' ); + break; + case 'add_cart': + /** + * Add to cart on edd page for all products. + */ + do_action( 'astra_edd_archive_add_to_cart_before' ); + do_action( 'astra_edd_archive_add_to_cart' ); + do_action( 'astra_edd_archive_add_to_cart_after' ); + + break; + case 'category': + /** + * Add and/or Remove Categories from edd archive page. + */ + do_action( 'astra_edd_archive_category_before' ); + do_action( 'astra_edd_archive_category' ); + do_action( 'astra_edd_archive_category_after' ); + break; + default: + break; + } + } + + do_action( 'astra_edd_archive_block_wrap_bottom' ); + echo ''; + do_action( 'astra_edd_archive_after_block_wrap' ); + } + } + + add_action( 'astra_edd_archive_product_content', 'astra_edd_archive_product_structure' ); +} + +/** + * Returns list of Easy Digital Downloads Terms + */ +if ( ! function_exists( 'astra_edd_terms_list' ) ) { + /** + * Show EDD product terms + * + * @param string $taxonomy_name Taxonomy name. + * @return void + */ + function astra_edd_terms_list( $taxonomy_name ) { + $terms = get_terms( $taxonomy_name ); + ?> +
+ + name ); ?> + +
+ '; + $output .= '' . esc_html( $variable_button_text ) . ''; + $output .= ''; + } else { + if ( ! empty( $add_to_cart_text ) ) { + $output = edd_get_purchase_link( + array( + 'price' => false, + 'text' => esc_html( $add_to_cart_text ), + ) + ); + } + } + + return $output; +} diff --git a/inc/compatibility/index.php b/inc/compatibility/index.php new file mode 100644 index 0000000..8b96815 --- /dev/null +++ b/inc/compatibility/index.php @@ -0,0 +1,9 @@ + span, body #learndash_lesson_topics_list span a, body #learndash_profile a, body #learndash_profile a span' => array( + 'font-family' => astra_get_font_family( $body_font_family ), + ), + 'body #ld_course_list .btn, body a.btn-blue, body a.btn-blue:visited, body a#quiz_continue_link, body .btn-join, body .learndash_checkout_buttons input.btn-join[type="button"], body #btn-join, body .learndash_checkout_buttons input.btn-join[type="submit"], body .wpProQuiz_content .wpProQuiz_button2' => array( + 'color' => $btn_color, + 'border-color' => $btn_bg_color, + 'background-color' => $btn_bg_color, + 'border-radius' => astra_get_css_value( $btn_border_radius, 'px' ), + ), + 'body #ld_course_list .btn:hover, body #ld_course_list .btn:focus, body a.btn-blue:hover, body a.btn-blue:focus, body a#quiz_continue_link:hover, body a#quiz_continue_link:focus, body .btn-join:hover, body .learndash_checkout_buttons input.btn-join[type="button"]:hover, body .btn-join:focus, body .learndash_checkout_buttons input.btn-join[type="button"]:focus, .wpProQuiz_content .wpProQuiz_button2:hover, .wpProQuiz_content .wpProQuiz_button2:focus, body #btn-join:hover, body .learndash_checkout_buttons input.btn-join[type="submit"]:hover, body #btn-join:focus, body .learndash_checkout_buttons input.btn-join[type="submit"]:focus' => array( + 'color' => $btn_h_color, + 'border-color' => $btn_bg_h_color, + 'background-color' => $btn_bg_h_color, + ), + 'body dd.course_progress div.course_progress_blue, body .wpProQuiz_content .wpProQuiz_time_limit .wpProQuiz_progress' => array( + 'background-color' => $theme_color, + ), + 'body #learndash_lessons a, body #learndash_quizzes a, body .expand_collapse a, body .learndash_topic_dots a, body .learndash_topic_dots a > span, body #learndash_lesson_topics_list span a, body #learndash_profile a, #learndash_profile .profile_edit_profile a, body #learndash_profile .expand_collapse a, body #learndash_profile a span, #lessons_list .list-count, #quiz_list .list-count' => array( + 'color' => $link_color, + ), + '.learndash .notcompleted:before, #learndash_profile .notcompleted:before, .learndash_topic_dots ul .topic-notcompleted span:before, .learndash_navigation_lesson_topics_list .topic-notcompleted span:before, .learndash_navigation_lesson_topics_list ul .topic-notcompleted span:before, .learndash .topic-notcompleted span:before' => array( + 'color' => astra_hex_to_rgba( $text_color, .5 ), + ), + 'body .thumbnail.course .ld_course_grid_price, body .thumbnail.course .ld_course_grid_price.ribbon-enrolled, body #learndash_lessons #lesson_heading, body #learndash_profile .learndash_profile_heading, body #learndash_quizzes #quiz_heading, body #learndash_lesson_topics_list div > strong, body .learndash-pager span a, body #learndash_profile .learndash_profile_quiz_heading' => array( + 'background-color' => $theme_color, + 'color' => $theme_forground_color, + ), + '.learndash .completed:before, #learndash_profile .completed:before, .learndash_topic_dots ul .topic-completed span:before, .learndash_navigation_lesson_topics_list .topic-completed span:before, .learndash_navigation_lesson_topics_list ul .topic-completed span:before, .learndash .topic-completed span:before, body .list_arrow.lesson_completed:before' => array( + 'color' => $theme_color, + ), + 'body .thumbnail.course .ld_course_grid_price:before' => array( + 'border-top-color' => astra_hex_to_rgba( $theme_color, .75 ), + 'border-right-color' => astra_hex_to_rgba( $theme_color, .75 ), + ), + 'body .wpProQuiz_loadQuiz, body .wpProQuiz_lock' => array( + 'border-color' => astra_hex_to_rgba( $link_color, .5 ), + 'background-color' => astra_hex_to_rgba( $link_color, .1 ), + ), + '#ld_course_list .entry-title' => array( + 'font-size' => astra_responsive_font( $archive_post_title_font_size, 'desktop' ), + ), + ); + + if ( ! astra_get_option( 'learndash-lesson-serial-number' ) ) { + $css_output['body #course_list .list-count, body #lessons_list .list-count, body #quiz_list .list-count'] = array( + 'display' => 'none', + ); + $css_output['body #course_list > div h4 > a, body #lessons_list > div h4 > a, body #quiz_list > div h4 > a, body #learndash_course_content .learndash_topic_dots ul > li a'] = array( + 'padding-left' => '.75em', + 'margin-left' => 'auto', + ); + } + if ( ! astra_get_option( 'learndash-differentiate-rows' ) ) { + $css_output['body #course_list > div:nth-of-type(odd), body #lessons_list > div:nth-of-type(odd), body #quiz_list > div:nth-of-type(odd), body #learndash_lesson_topics_list .learndash_topic_dots ul > li.nth-of-type-odd'] = array( + 'background' => 'none', + ); + } + + /* Parse CSS from array() */ + $css_output = astra_parse_css( $css_output ); + + $tablet_typography = array( + '#ld_course_list .entry-title' => array( + 'font-size' => astra_responsive_font( $archive_post_title_font_size, 'tablet', 30 ), + ), + ); + /* Parse CSS from array()*/ + $css_output .= astra_parse_css( $tablet_typography, '', astra_get_tablet_breakpoint() ); + + if ( $is_site_rtl ) { + $mobile_min_width_css = array( + 'body #learndash_profile .profile_edit_profile' => array( + 'position' => 'absolute', + 'top' => '15px', + 'left' => '15px', + ), + ); + } else { + $mobile_min_width_css = array( + 'body #learndash_profile .profile_edit_profile' => array( + 'position' => 'absolute', + 'top' => '15px', + 'right' => '15px', + ), + ); + } + + /* Parse CSS from array() -> min-width: (mobile-breakpoint + 1) px */ + $css_output .= astra_parse_css( $mobile_min_width_css, astra_get_mobile_breakpoint( '', 1 ) ); + + $mobile_typography = array( + '#ld_course_list .entry-title' => array( + 'font-size' => astra_responsive_font( $archive_post_title_font_size, 'mobile', 30 ), + ), + '#learndash_next_prev_link a' => array( + 'width' => '100%', + ), + '#learndash_next_prev_link a.prev-link' => array( + 'margin-bottom' => '1em', + ), + '#ld_course_info_mycourses_list .ld-course-info-my-courses .ld-entry-title' => array( + 'margin' => '0 0 20px', + ), + ); + + /* Parse CSS from array() -> max-width: (mobile-breakpoint) px */ + $css_output .= astra_parse_css( $mobile_typography, '', astra_get_mobile_breakpoint() ); + + if ( $is_site_rtl ) { + $mobile_typography_lang_direction_css = array( + '#ld_course_info_mycourses_list .ld-course-info-my-courses img' => array( + 'display' => 'block', + 'margin-right' => 'initial', + 'max-width' => '100%', + 'margin' => '10px 0', + ), + ); + } else { + $mobile_typography_lang_direction_css = array( + '#ld_course_info_mycourses_list .ld-course-info-my-courses img' => array( + 'display' => 'block', + 'margin-left' => 'initial', + 'max-width' => '100%', + 'margin' => '10px 0', + ), + ); + } + + /* Parse CSS from array() -> max-width: (mobile-breakpoint) px */ + $css_output .= astra_parse_css( $mobile_typography_lang_direction_css, '', astra_get_mobile_breakpoint() ); + + $dynamic_css .= apply_filters( 'astra_theme_learndash_dynamic_css', $css_output ); + + return $dynamic_css; + } + + /** + * Register Customizer sections and panel for learndash. + * + * @since 1.3.0 + * @param WP_Customize_Manager $wp_customize Theme Customizer object. + */ + public function customize_register( $wp_customize ) { + + $active_ld_theme = ''; + + if ( is_callable( 'LearnDash_Theme_Register::get_active_theme_key' ) ) { + $active_ld_theme = LearnDash_Theme_Register::get_active_theme_key(); + } + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + /** + * Register Sections & Panels + */ + require ASTRA_THEME_DIR . 'inc/compatibility/learndash/customizer/class-astra-customizer-register-learndash-section.php'; + + /** + * Sections + */ + require ASTRA_THEME_DIR . 'inc/compatibility/learndash/customizer/sections/class-astra-learndash-container-configs.php'; + require ASTRA_THEME_DIR . 'inc/compatibility/learndash/customizer/sections/class-astra-learndash-sidebar-configs.php'; + + if ( 'ld30' !== $active_ld_theme ) { + require ASTRA_THEME_DIR . 'inc/compatibility/learndash/customizer/sections/layout/class-astra-learndash-general-configs.php'; + } + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + + /** + * Theme Defaults. + * + * @since 1.3.0 + * @param array $defaults Array of options value. + * @return array + */ + public function theme_defaults( $defaults ) { + + // General. + $defaults['learndash-lesson-serial-number'] = false; + $defaults['learndash-differentiate-rows'] = true; + + // Container. + $defaults['learndash-content-layout'] = 'plain-container'; + + // Sidebar. + $defaults['learndash-sidebar-layout'] = 'default'; + + return $defaults; + } + + /** + * Add assets in theme + * + * @since 1.3.0 + * @param array $assets list of theme assets (JS & CSS). + * @return array List of updated assets. + */ + public function add_styles( $assets ) { + $assets['css']['astra-learndash'] = 'compatibility/learndash'; + return $assets; + } + + /** + * LeanDash Sidebar + * + * @since 1.3.0 + * @param string $layout Layout type. + * @return string $layout Layout type. + */ + public function sidebar_layout( $layout ) { + + if ( is_singular( 'sfwd-courses' ) || is_singular( 'sfwd-lessons' ) || is_singular( 'sfwd-topic' ) || is_singular( 'sfwd-quiz' ) || is_singular( 'sfwd-certificates' ) || is_singular( 'sfwd-assignment' ) ) { + + $learndash_sidebar = astra_get_option( 'learndash-sidebar-layout' ); + if ( 'default' !== $learndash_sidebar ) { + $layout = $learndash_sidebar; + } + + $sidebar = astra_get_option_meta( 'site-sidebar-layout', '', true ); + + if ( 'default' !== $sidebar && ! empty( $sidebar ) ) { + $layout = $sidebar; + } + } + + // When Learhdash shortoce is used on the Page. + // Applied only to the pages which uses the learndash shortcode. + global $learndash_shortcode_used; + + if ( $learndash_shortcode_used && ! ( is_singular( 'sfwd-courses' ) || is_singular( 'sfwd-lessons' ) || is_singular( 'sfwd-topic' ) || is_singular( 'sfwd-quiz' ) || is_singular( 'sfwd-certificates' ) || is_singular( 'sfwd-assignment' ) ) ) { + // Page Meta Sidebar. + $layout = astra_get_option_meta( 'site-sidebar-layout', '', true ); + if ( empty( $layout ) ) { + // Page Sidebar. + $layout = astra_get_option( 'single-page-sidebar-layout' ); + // Default Site Sidebar. + if ( 'default' == $layout || empty( $layout ) ) { + // Get the global sidebar value. + // NOTE: Here not used `true` in the below function call. + $layout = astra_get_option( 'site-sidebar-layout' ); + } + } + } + return $layout; + } + + /** + * LeanDash Container + * + * @since 1.3.0 + * @param string $layout Layout type. + * @return string $layout Layout type. + */ + public function content_layout( $layout ) { + + if ( is_singular( 'sfwd-courses' ) || is_singular( 'sfwd-lessons' ) || is_singular( 'sfwd-topic' ) || is_singular( 'sfwd-quiz' ) || is_singular( 'sfwd-certificates' ) || is_singular( 'sfwd-assignment' ) ) { + + $learndash_layout = astra_get_option( 'learndash-content-layout' ); + + if ( 'default' !== $learndash_layout ) { + $layout = $learndash_layout; + } + + $learndash_layout = astra_get_option_meta( 'site-content-layout', '', true ); + + if ( 'default' !== $learndash_layout && ! empty( $learndash_layout ) ) { + $layout = $learndash_layout; + } + } + + return $layout; + } + + /** + * LearnDash Static CSS. + * + * @since 3.3.0 + * @return string + */ + public static function ld_static_css() { + $ld_static_css = ' + .learndash .completed:before, + .learndash .notcompleted:before, + #learndash_profile .completed:before, + #learndash_profile .notcompleted:before { + content: "\e903"; + display: inline-block; + font-family: "Astra"; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + float: left; + text-indent: 0; + font-size: 1.5em; + line-height: 1; + } + + .learndash .completed:before, + #learndash_profile .completed:before { + content: "\e901"; + font-weight: bold; + } + + .learndash .completed:before, + .learndash .notcompleted:before { + position: absolute; + top: 8px; + right: .75em; + width: 1.75em; + text-align: center; + line-height: 1.2; + } + + .learndash .topic-completed span, + .learndash .topic-notcompleted span { + background: none; + padding: 0; + } + + .learndash .topic-completed span:before, + .learndash .topic-notcompleted span:before { + content: "\e903"; + display: inline-block; + font-family: "Astra"; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-size: 1.25em; + } + + .learndash .topic-completed span:before { + content: "\e901"; + font-weight: bold; + } + + body .learndash .completed, + body .learndash .notcompleted, + body #learndash_profile .completed, + body #learndash_profile .notcompleted { + line-height: 1.7; + background: none; + } + + body .learndash_profile_heading, + body #learndash_profile a, + body #learndash_profile div + { + ont-size: 1em; + font-weight: inherit; + } + + body #lessons_list > div h4, + body #course_list > div h4, + body #quiz_list > div h4, + body #learndash_lesson_topics_list ul > li > span.topic_item { + font-size: 1em; + } + + body #learndash_lessons #lesson_heading, + body #learndash_profile .learndash_profile_heading, + body #learndash_quizzes #quiz_heading, + body #learndash_lesson_topics_list div > strong { + padding: 10px .75em; + font-weight: 600; + text-transform: uppercase; + border-radius: 0; + } + + body #learndash_lessons .right, + body #learndash_quizzes .right { + width: auto; + } + + body .expand_collapse .expand_collapse, + body #learndash_profile .expand_collapse { + top: -1em; + } + + body .expand_collapse .expand_collapse a, + body #learndash_profile .expand_collapse a { + font-size: .8em; + } + + body .expand_collapse .list_arrow.collapse, body .expand_collapse .list_arrow.expand, + body #learndash_profile .list_arrow.collapse, + body #learndash_profile .list_arrow.expand { + vertical-align: top; + } + + body .expand_collapse .list_arrow.collapse:before, body .expand_collapse .list_arrow.expand:before, + body #learndash_profile .list_arrow.collapse:before, + body #learndash_profile .list_arrow.expand:before { + content: "\e900"; + transform: rotate(270deg); + font-weight: bold; + } + + body .expand_collapse .list_arrow.expand:before, + body #learndash_profile .list_arrow.expand:before { + transform: rotate(0deg); + } + body #learndash_lessons #lesson_heading, + body #learndash_profile .learndash_profile_heading, + body #learndash_quizzes #quiz_heading, + body #learndash_lesson_topics_list div > strong { + padding: 10px .75em; + font-weight: 600; + text-transform: uppercase; + border-radius: 0; + } + body #learndash_lesson_topics_list ul > li > span.topic_item:hover { + background: none; + } + + body #learndash_lesson_topics_list .learndash_topic_dots { + order: none; + box-shadow: none; + } + + body #learndash_lesson_topics_list .learndash_topic_dots ul { + border: 1px solid #e2e2e2; + border-top: none; + overflow: hidden; + } + + body #learndash_lesson_topics_list .learndash_topic_dots ul > li:last-child a { + border-bottom: none; + } + + body #learndash_lesson_topics_list .learndash_topic_dots ul > li.nth-of-type-odd { + background: #fbfbfb; + } + + body #learndash_lesson_topics_list .learndash_topic_dots .topic-completed, + body #learndash_lesson_topics_list .learndash_topic_dots .topic-notcompleted { + padding: 8px .75em; + border-bottom: 1px solid #ddd; + } + + body #learndash_lesson_topics_list .learndash_topic_dots .topic-completed span, + body #learndash_lesson_topics_list .learndash_topic_dots .topic-notcompleted span { + margin: 0 auto; + display: inline; + } + body #learndash_lesson_topics_list ul > li > span.topic_item { + font-size: 1em; + } + .learndash .completed:before, + .learndash .notcompleted:before { + position: absolute; + top: 8px; + right: .75em; + width: 1.75em; + text-align: center; + line-height: 1.2; + } + .learndash .topic-completed span, + .learndash .topic-notcompleted span { + background: none; + padding: 0; + } + .learndash .topic-completed span:before, + .learndash .topic-notcompleted span:before { + content: "\e903"; + display: inline-block; + font-family: "Astra"; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-size: 1.25em; + } + .learndash .topic-completed span:before { + content: "\e901"; + font-weight: bold; + } + .widget_ldcoursenavigation .learndash_topic_widget_list .topic-completed span:before, + .widget_ldcoursenavigation .learndash_topic_widget_list .topic-notcompleted span:before { + margin-left: 1px; + margin-right: 9px; + } + body .learndash_navigation_lesson_topics_list .topic-notcompleted span, + body .learndash_navigation_lesson_topics_list ul .topic-notcompleted span, + body .learndash_topic_dots .topic-notcompleted span, + body .learndash_topic_dots ul .topic-notcompleted span { + margin: 5px 0; + } + + body .learndash_navigation_lesson_topics_list .topic-completed span, + body .learndash_navigation_lesson_topics_list .topic-notcompleted span, + body .learndash_navigation_lesson_topics_list ul .topic-completed span, + body .learndash_navigation_lesson_topics_list ul .topic-notcompleted span, + body .learndash_topic_dots .topic-completed span, + body .learndash_topic_dots .topic-notcompleted span, + body .learndash_topic_dots ul .topic-completed span, + body .learndash_topic_dots ul .topic-notcompleted span { + padding-left: 0; + background: none; + margin: 5px 0; + } + + body .learndash_navigation_lesson_topics_list .topic-completed span:before, + body .learndash_navigation_lesson_topics_list .topic-notcompleted span:before, + body .learndash_navigation_lesson_topics_list ul .topic-completed span:before, + body .learndash_navigation_lesson_topics_list ul .topic-notcompleted span:before, + body .learndash_topic_dots .topic-completed span:before, + body .learndash_topic_dots .topic-notcompleted span:before, + body .learndash_topic_dots ul .topic-completed span:before, + body .learndash_topic_dots ul .topic-notcompleted span:before { + content: "\e903"; + display: inline-block; + font-family: "Astra"; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-size: 1em; + font-weight: normal; + margin-right: 10px; + } + + body .learndash_navigation_lesson_topics_list .topic-completed span:before, + body .learndash_navigation_lesson_topics_list ul .topic-completed span:before, + body .learndash_topic_dots .topic-completed span:before, + body .learndash_topic_dots ul .topic-completed span:before { + content: "\e901"; + font-weight: bold; + } + .widget_ldcoursenavigation .learndash_topic_widget_list .topic-completed span:before, + .widget_ldcoursenavigation .learndash_topic_widget_list .topic-notcompleted span:before { + margin-left: 1px; + margin-right: 9px; + } + body .learndash .topic-completed span, + body .learndash .topic-notcompleted span { + background: none; + padding: 0; + } + #learndash_next_prev_link { + margin: 0; + padding: 2em 0 0; + border-top: 1px solid #eeeeee; + overflow: hidden; + line-height: 0; + } + + #learndash_next_prev_link a { + margin: 2px; + display: inline-block; + padding: 0 1.5em; + height: 2.33333em; + line-height: 2.33333em; + text-align: center; + font-size: 16px; + font-size: 1.06666rem; + }'; + return Astra_Enqueue_Scripts::trim_css( $ld_static_css ); + } + } + +endif; + +if ( apply_filters( 'astra_enable_learndash_integration', true ) ) { + + /** + * Kicking this off by calling 'get_instance()' method + */ + Astra_LearnDash::get_instance(); +} diff --git a/inc/compatibility/learndash/customizer/class-astra-customizer-register-learndash-section.php b/inc/compatibility/learndash/customizer/class-astra-customizer-register-learndash-section.php new file mode 100644 index 0000000..f9e2370 --- /dev/null +++ b/inc/compatibility/learndash/customizer/class-astra-customizer-register-learndash-section.php @@ -0,0 +1,50 @@ + 'section', + 'name' => 'section-learndash', + 'priority' => 65, + 'title' => __( 'LearnDash', 'astra' ), + ), + ); + + return array_merge( $configurations, $configs ); + } + } +} + + +new Astra_Customizer_Register_Learndash_Section(); diff --git a/inc/compatibility/learndash/customizer/sections/class-astra-learndash-container-configs.php b/inc/compatibility/learndash/customizer/sections/class-astra-learndash-container-configs.php new file mode 100644 index 0000000..9e0d704 --- /dev/null +++ b/inc/compatibility/learndash/customizer/sections/class-astra-learndash-container-configs.php @@ -0,0 +1,63 @@ + ASTRA_THEME_SETTINGS . '[learndash-content-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-container-layout', + 'default' => astra_get_option( 'learndash-content-layout' ), + 'priority' => 68, + 'title' => __( 'LearnDash Layout', 'astra' ), + 'description' => __( 'Will be applied to All Single Courses, Topics, Lessons and Quizzes. Does not work on pages created with LearnDash shortcodes.', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'boxed-container' => __( 'Boxed', 'astra' ), + 'content-boxed-container' => __( 'Content Boxed', 'astra' ), + 'plain-container' => __( 'Full Width / Contained', 'astra' ), + 'page-builder' => __( 'Full Width / Stretched', 'astra' ), + ), + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Learndash_Container_Configs(); diff --git a/inc/compatibility/learndash/customizer/sections/class-astra-learndash-sidebar-configs.php b/inc/compatibility/learndash/customizer/sections/class-astra-learndash-sidebar-configs.php new file mode 100644 index 0000000..336afee --- /dev/null +++ b/inc/compatibility/learndash/customizer/sections/class-astra-learndash-sidebar-configs.php @@ -0,0 +1,62 @@ + ASTRA_THEME_SETTINGS . '[learndash-sidebar-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-sidebars', + 'divider' => array( 'ast_class' => 'ast-top-divider' ), + 'default' => astra_get_option( 'learndash-sidebar-layout' ), + 'priority' => 5, + 'title' => __( 'LearnDash', 'astra' ), + 'description' => __( 'This layout will apply on all single course, lesson, topic and quiz.', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'no-sidebar' => __( 'No Sidebar', 'astra' ), + 'left-sidebar' => __( 'Left Sidebar', 'astra' ), + 'right-sidebar' => __( 'Right Sidebar', 'astra' ), + ), + ), + ); + + return array_merge( $configurations, $_configs ); + } + } +} + +new Astra_Learndash_Sidebar_Configs(); diff --git a/inc/compatibility/learndash/customizer/sections/layout/class-astra-learndash-general-configs.php b/inc/compatibility/learndash/customizer/sections/layout/class-astra-learndash-general-configs.php new file mode 100644 index 0000000..5a3b019 --- /dev/null +++ b/inc/compatibility/learndash/customizer/sections/layout/class-astra-learndash-general-configs.php @@ -0,0 +1,72 @@ + ASTRA_THEME_SETTINGS . '[learndash-lesson-serial-number]', + 'section' => 'section-learndash', + 'type' => 'control', + 'control' => 'ast-toggle-control', + 'default' => astra_get_option( 'learndash-lesson-serial-number' ), + 'title' => __( 'Display Serial Number', 'astra' ), + 'priority' => 25, + 'divider' => array( + 'ast_class' => 'ast-top-divider', + 'ast_title' => __( 'Course Content Table', 'astra' ), + ), + ), + + /** + * Option: Differentiate Rows + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[learndash-differentiate-rows]', + 'default' => astra_get_option( 'learndash-differentiate-rows' ), + 'type' => 'control', + 'control' => 'ast-toggle-control', + 'section' => 'section-learndash', + 'title' => __( 'Differentiate Rows', 'astra' ), + 'priority' => 30, + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Learndash_General_Configs(); diff --git a/inc/compatibility/lifterlms/class-astra-lifterlms.php b/inc/compatibility/lifterlms/class-astra-lifterlms.php new file mode 100644 index 0000000..48d6344 --- /dev/null +++ b/inc/compatibility/lifterlms/class-astra-lifterlms.php @@ -0,0 +1,858 @@ + 3, + 'tablet' => 2, + 'mobile' => 1, + ); + $defaults['llms-membership-grid'] = array( + 'desktop' => 3, + 'tablet' => 2, + 'mobile' => 1, + ); + + // Container. + $defaults['lifterlms-content-layout'] = 'plain-container'; + + // Sidebar. + $defaults['lifterlms-sidebar-layout'] = 'no-sidebar'; + $defaults['lifterlms-course-lesson-sidebar-layout'] = 'default'; + + return $defaults; + } + + /** + * This function handles the HTML output of the reviews and review form. + * If the option is enabled, the review form will be output, + * if not, nothing will happen. This function also checks to + * see if a user is allowed to review more than once. + * + * @since 1.2.0 + */ + public function single_reviews() { + + /** + * Check to see if we are supposed to output the code at all + */ + if ( get_post_meta( get_the_ID(), '_llms_display_reviews', true ) ) { + ?> +
+

+ get_post_meta( get_the_ID(), '_llms_num_reviews', true ), // phpcs:ignore WPThemeReview.CoreFunctionality.PostsPerPage.posts_per_page_posts_per_page, WordPress.WP.PostsPerPage.posts_per_page_posts_per_page + 'post_type' => 'llms_review', + 'post_status' => 'publish', + 'post_parent' => get_the_ID(), + 'suppress_filters' => true, + ); + $posts_array = get_posts( $args ); + + $styles = array( + 'background-color' => '#EFEFEF', + 'title-color' => 'inherit', + 'text-color' => 'inherit', + 'custom-css' => '', + ); + + if ( has_filter( 'llms_review_custom_styles' ) ) { + $styles = apply_filters( 'llms_review_custom_styles', $styles ); + } + + foreach ( $posts_array as $post ) { + echo $styles['custom-css']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + + ?> +
+
ID ) ); ?>
+ +
ID ) ) ) ); ?>
+

ID ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>

+
+ +
+
+ 1, + 'post_type' => 'llms_review', + 'post_status' => 'publish', + 'post_parent' => get_the_ID(), + 'author' => get_current_user_id(), + 'suppress_filters' => true, + ); + $posts_array = get_posts( $args ); + + /** + * Check to see if we are allowed to write more than one review. + * If we are not, check to see if we have written a review already. + */ + if ( get_post_meta( get_the_ID(), '_llms_multiple_reviews_disabled', true ) && $posts_array ) { + ?> +
+

+
+ +
+

+ + + + + + + + +
+ + = 0 ) { + unset( $classes[ $index ] ); + } + } + $classes[] = 'cols-' . $llms_grid['desktop']; + } + } + + if ( ! empty( $llms_grid['tablet'] ) ) { + $classes[] = 'llms-tablet-cols-' . $llms_grid['tablet']; + } + if ( ! empty( $llms_grid['mobile'] ) ) { + $classes[] = 'llms-mobile-cols-' . $llms_grid['mobile']; + } + + return $classes; + } + + /** + * Enqueue styles + * + * @since 1.2.0 + * @return void + */ + public function add_dynamic_styles() { + + /** + * - Variable Declaration + */ + $theme_color = astra_get_option( 'theme-color' ); + $link_color = astra_get_option( 'link-color', $theme_color ); + $link_h_color = astra_get_option( 'link-h-color' ); + + $theme_forground_color = astra_get_foreground_color( $link_color ); + $btn_color = astra_get_option( 'button-color' ); + if ( empty( $btn_color ) ) { + $btn_color = $theme_forground_color; + } + + $btn_h_color = astra_get_option( 'button-h-color' ); + if ( empty( $btn_h_color ) ) { + $btn_h_color = astra_get_foreground_color( $link_h_color ); + } + $btn_bg_color = astra_get_option( 'button-bg-color', '', $link_color ); + $btn_bg_h_color = astra_get_option( 'button-bg-h-color', '', $link_h_color ); + + $btn_border_radius = astra_get_option( 'button-radius' ); + $theme_btn_padding = astra_get_option( 'theme-button-padding' ); + + $css_output = array( + 'a.llms-button-primary, .llms-button-secondary, .llms-button-action, button.llms-field-button, a.llms-field-button' => array( + 'color' => $btn_color, + 'border-color' => $btn_bg_color, + 'background-color' => $btn_bg_color, + ), + 'a.llms-button-primary, .llms-button-secondary, .llms-button-action, .llms-field-button, .llms-button-action.large' => array( + 'border-radius' => astra_get_css_value( $btn_border_radius, 'px' ), + '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' ), + ), + 'a.llms-button-primary:hover, a.llms-button-primary:focus, .llms-button-secondary:hover, .llms-button-secondary:focus, .llms-button-action:hover, .llms-button-action:focus, button.llms-field-button:hover, button.llms-field-button:focus, a.llms-field-button:hover, a.llms-field-button:focus' => array( + 'color' => $btn_h_color, + 'border-color' => $btn_bg_h_color, + 'background-color' => $btn_bg_h_color, + ), + 'nav.llms-pagination ul li a:focus, nav.llms-pagination ul li a:hover, nav.llms-pagination ul li span.current' => array( + 'background' => $link_color, + 'color' => $btn_color, + ), + 'nav.llms-pagination ul, nav.llms-pagination ul li, .llms-instructor-info .llms-instructors .llms-author, .llms-instructor-info .llms-instructors .llms-author .avatar' => array( + 'border-color' => $link_color, + ), + '.llms-progress .progress-bar-complete, .llms-instructor-info .llms-instructors .llms-author .avatar, h4.llms-access-plan-title, .llms-lesson-preview .llms-icon-free, .llms-access-plan .stamp, .llms-student-dashboard .llms-status.llms-active, .llms-student-dashboard .llms-status.llms-completed, .llms-student-dashboard .llms-status.llms-txn-succeeded, .color-full, body .llms-syllabus-wrapper .llms-section-title' => array( + 'background' => $link_color, + ), + '.llms-lesson-preview.is-complete .llms-lesson-complete, .llms-lesson-preview.is-free .llms-lesson-complete, .llms-widget-syllabus .lesson-complete-placeholder.done, .llms-widget-syllabus .llms-lesson-complete.done, .single-llms_quiz .llms-quiz-results .llms-donut.passing, .llms-quiz-timer' => array( + 'color' => $link_color, + ), + '.llms-quiz-timer' => array( + 'border-color' => $link_color, + ), + '.single-llms_quiz .llms-quiz-results .llms-donut.passing svg path' => array( + 'stroke' => $link_color, + ), + 'h4.llms-access-plan-title, .llms-instructor-info .llms-instructors .llms-author .avatar, h4.llms-access-plan-title, .llms-lesson-preview .llms-icon-free, .llms-access-plan .stamp, .llms-student-dashboard .llms-status.llms-active, .llms-student-dashboard .llms-status.llms-completed, .llms-student-dashboard .llms-status.llms-txn-succeeded, body .llms-syllabus-wrapper .llms-section-title' => array( + 'color' => $theme_forground_color, + ), + 'body .progress-bar-complete:after' => array( + 'color' => $theme_forground_color, + ), + ); + + /* Parse CSS from array() */ + $css_output = astra_parse_css( $css_output ); + + if ( is_lesson() ) { + $css_output .= $this->llms_single_lesson_css(); + } + /** + * Global button CSS - Tablet. + */ + $css_global_button_tablet = array( + 'a.llms-button-primary, .llms-button-secondary, .llms-button-action, .llms-field-button, .llms-button-action.large' => 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' ), + ), + ); + + $css_output .= astra_parse_css( $css_global_button_tablet, '', astra_get_tablet_breakpoint() ); + + /** + * Global button CSS - Mobile. + */ + $css_global_button_mobile = array( + 'a.llms-button-primary, .llms-button-secondary, .llms-button-action, .llms-field-button, .llms-button-action.large' => 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' ), + ), + ); + + $css_output .= astra_parse_css( $css_global_button_mobile, '', astra_get_mobile_breakpoint() ); + + wp_add_inline_style( 'lifterlms-styles', apply_filters( 'astra_theme_lifterlms_dynamic_css', $css_output ) ); + + } + + /** + * Add start of wrapper + * + * @since 1.2.0 + * @return void + */ + public function before_main_content_start() { + $site_sidebar = astra_page_layout(); + if ( 'left-sidebar' == $site_sidebar ) { + get_sidebar(); + } + ?> +
+ + + +
+
+ +
+
+ + + +
+ 'ast-main-header-display', + 'id' => 'ast-main-header-display', + 'label' => esc_html__( 'Disable Primary Header', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + /** + * Above Header + */ + $disable_fields[] = array( + 'attribute' => 'ast-hfb-above-header-display', + 'id' => 'ast-hfb-above-header-display', + 'label' => esc_html__( 'Disable Above Header', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + /** + * Below Header + */ + $disable_fields[] = array( + 'attribute' => 'ast-hfb-below-header-display', + 'id' => 'ast-hfb-below-header-display', + 'label' => esc_html__( 'Disable Below Header', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + /** + * Mobile Header + */ + $disable_fields[] = array( + 'attribute' => 'ast-hfb-mobile-header-display', + 'id' => 'ast-hfb-mobile-header-display', + 'label' => esc_html__( 'Disable Mobile Header', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + if ( $show_meta_field ) { + $disable_fields[] = array( + 'attribute' => 'site-post-title', + 'id' => 'site-post-title', + 'label' => esc_html__( 'Disable Title', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + } + if ( $show_meta_field && 'disabled' != astra_get_option( 'footer-adv' ) ) { + $disable_fields[] = array( + 'attribute' => 'footer-adv-display', + 'id' => 'footer-adv-display', + 'label' => esc_html__( 'Disable Footer Widgets', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + } + if ( 'disabled' != astra_get_option( 'footer-sml-layout' ) ) { + $disable_fields[] = array( + 'attribute' => 'footer-sml-layout', + 'id' => 'footer-sml-layout', + 'label' => esc_html__( 'Disable Footer', 'astra' ), + 'switch_on' => 'disabled', + 'type' => 'switch', + ); + } + $fields['astra_theme_settings'] = array( + 'title' => __( 'Astra Settings', 'astra' ), + 'toggleable' => true, + 'fields' => apply_filters( + 'astra_theme_lifterlms_settings', + array( + array( + array( + 'attribute' => 'site-sidebar-layout', + 'id' => 'site-sidebar-layout', + 'label' => esc_html__( 'Sidebar', 'astra' ), + 'type' => 'ast-select', + 'options' => array( + 'default' => esc_html__( 'Customizer Setting', 'astra' ), + 'left-sidebar' => esc_html__( 'Left Sidebar', 'astra' ), + 'right-sidebar' => esc_html__( 'Right Sidebar', 'astra' ), + 'no-sidebar' => esc_html__( 'No Sidebar', 'astra' ), + ), + ), + array( + 'attribute' => 'site-content-layout', + 'id' => 'site-content-layout', + 'label' => esc_html__( 'Content Layout', 'astra' ), + 'type' => 'ast-select', + 'options' => array( + 'default' => esc_html__( 'Customizer Setting', 'astra' ), + 'boxed-container' => esc_html__( 'Boxed', 'astra' ), + 'content-boxed-container' => esc_html__( 'Content Boxed', 'astra' ), + 'plain-container' => esc_html__( 'Full Width / Contained', 'astra' ), + 'page-builder' => esc_html__( 'Full Width / Stretched', 'astra' ), + ), + ), + ), + $disable_fields, + ) + ), + ); + $default_fields['assignment'] = $fields; + $default_fields['lesson'] = $fields; + $default_fields['quiz'] = $fields; + return $default_fields; + } + + /** + * Llms single lesson static CSS move to dynamic to load conditionally. + * + * @since 3.3.0 + * @return string + */ + public function llms_single_lesson_css() { + $single_lesson_static_css = ' + .single-lesson.ast-separate-container .llms-lesson-preview .llms-lesson-link { + background: #fff; + } + + .single-lesson.ast-separate-container .llms-lesson-preview .llms-lesson-link:hover { + background: #fafafa; + } + + .single-lesson .ast-article-single .llms-lesson-button-wrapper { + font-weight: 600; + } + + .single-lesson .ast-article-single .llms-lesson-button-wrapper .llms-complete-lesson-form .llms-field-button:before { + content: "\2714"; + margin-right: .5em; + } + + .single-lesson .llms-course-navigation { + padding: 2em 0 0; + border-top: 1px solid #eeeeee; + } + + .single-lesson .llms-course-navigation .llms-lesson-preview { + vertical-align: top; + margin-top: 0; + } + + .single-lesson .llms-course-navigation .llms-lesson-preview .llms-lesson-link { + padding-left: 20px; + padding-right: 20px; + } + + .single-lesson .llms-course-navigation .llms-prev-lesson h6.llms-pre-text:before { + content: "\2190"; + margin-right: .5em; + } + + .single-lesson .llms-course-navigation .llms-back-to-course:first-child h6.llms-pre-text:before { + content: "\2190"; + margin-right: .5em; + } + + .single-lesson .llms-course-navigation .llms-prev-lesson ~ .llms-back-to-course h6.llms-pre-text:after, + .single-lesson .llms-course-navigation .llms-next-lesson h6.llms-pre-text:after { + content: "\2192"; + margin-left: 5px; + } + + .single-lesson .llms-course-navigation .llms-prev-lesson ~ .llms-back-to-course .llms-lesson-title, + .single-lesson .llms-course-navigation .llms-prev-lesson ~ .llms-back-to-course .llms-lesson-excerpt, + .single-lesson .llms-course-navigation .llms-prev-lesson ~ .llms-back-to-course h6.llms-pre-text, + .single-lesson .llms-course-navigation .llms-next-lesson .llms-lesson-title, + .single-lesson .llms-course-navigation .llms-next-lesson .llms-lesson-excerpt, + .single-lesson .llms-course-navigation .llms-next-lesson h6.llms-pre-text { + text-align: right; + } + + @media (max-width: 544px) { + .single-lesson .llms-course-navigation { + padding-top: 1.5em; + } + .single-lesson .llms-course-navigation .llms-course-nav { + width: 100%; + margin: 0; + } + .single-lesson .llms-course-navigation .llms-course-nav:first-child { + margin-bottom: 1.5em; + } + }'; + return Astra_Enqueue_Scripts::trim_css( $single_lesson_static_css ); + } + } + +endif; + +/** + * Kicking this off by calling 'get_instance()' method + */ +if ( apply_filters( 'astra_enable_lifterlms_integration', true ) ) { + Astra_LifterLMS::get_instance(); +} diff --git a/inc/compatibility/lifterlms/customizer/class-astra-liferlms-section-configs.php b/inc/compatibility/lifterlms/customizer/class-astra-liferlms-section-configs.php new file mode 100644 index 0000000..e6e6956 --- /dev/null +++ b/inc/compatibility/lifterlms/customizer/class-astra-liferlms-section-configs.php @@ -0,0 +1,60 @@ + 'section-lifterlms', + 'type' => 'section', + 'priority' => 65, + 'title' => __( 'LifterLMS', 'astra' ), + ), + + /** + * General Section + */ + array( + 'name' => 'section-lifterlms-general', + 'type' => 'section', + 'title' => __( 'General', 'astra' ), + 'section' => 'section-lifterlms', + 'priority' => 0, + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Liferlms_Section_Configs(); diff --git a/inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-container-configs.php b/inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-container-configs.php new file mode 100644 index 0000000..c74af6f --- /dev/null +++ b/inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-container-configs.php @@ -0,0 +1,66 @@ + ASTRA_THEME_SETTINGS . '[lifterlms-content-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-container-layout', + 'default' => astra_get_option( 'lifterlms-content-layout' ), + 'priority' => 66, + 'title' => __( 'LifterLMS Layout', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'boxed-container' => __( 'Boxed', 'astra' ), + 'content-boxed-container' => __( 'Content Boxed', 'astra' ), + 'plain-container' => __( 'Full Width / Contained', 'astra' ), + 'page-builder' => __( 'Full Width / Stretched', 'astra' ), + ), + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Lifter_Container_Configs(); + + diff --git a/inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-sidebar-configs.php b/inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-sidebar-configs.php new file mode 100644 index 0000000..787d385 --- /dev/null +++ b/inc/compatibility/lifterlms/customizer/sections/class-astra-lifter-sidebar-configs.php @@ -0,0 +1,80 @@ + ASTRA_THEME_SETTINGS . '[lifterlms-sidebar-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-sidebars', + 'priority' => 5, + 'default' => astra_get_option( 'lifterlms-sidebar-layout' ), + 'title' => __( 'LifterLMS', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'no-sidebar' => __( 'No Sidebar', 'astra' ), + 'left-sidebar' => __( 'Left Sidebar', 'astra' ), + 'right-sidebar' => __( 'Right Sidebar', 'astra' ), + ), + ), + + /** + * Option: LifterLMS Course/Lesson + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[lifterlms-course-lesson-sidebar-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-sidebars', + 'default' => astra_get_option( 'lifterlms-course-lesson-sidebar-layout' ), + 'priority' => 5, + 'title' => __( 'LifterLMS Course/Lesson', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'no-sidebar' => __( 'No Sidebar', 'astra' ), + 'left-sidebar' => __( 'Left Sidebar', 'astra' ), + 'right-sidebar' => __( 'Right Sidebar', 'astra' ), + ), + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Lifter_Sidebar_Configs(); diff --git a/inc/compatibility/lifterlms/customizer/sections/layout/class-astra-lifter-general-configs.php b/inc/compatibility/lifterlms/customizer/sections/layout/class-astra-lifter-general-configs.php new file mode 100644 index 0000000..392e28b --- /dev/null +++ b/inc/compatibility/lifterlms/customizer/sections/layout/class-astra-lifter-general-configs.php @@ -0,0 +1,104 @@ + 'ast-bottom-divider' ); + $section = 'section-lifterlms-general'; + } else { + $divider_array = array(); + $section = 'section-lifterlms'; + } + + $_configs = array( + + /** + * Option: Course Columns + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[llms-course-grid]', + 'type' => 'control', + 'control' => 'ast-responsive-slider', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), + 'section' => $section, + 'default' => astra_get_option( + 'llms-course-grid', + array( + 'desktop' => 3, + 'tablet' => 2, + 'mobile' => 1, + ) + ), + 'title' => __( 'Course Columns', 'astra' ), + 'priority' => 0, + 'input_attrs' => array( + 'step' => 1, + 'min' => 1, + 'max' => 6, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Membership Columns + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[llms-membership-grid]', + 'type' => 'control', + 'control' => 'ast-responsive-slider', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), + 'section' => $section, + 'default' => astra_get_option( + 'llms-membership-grid', + array( + 'desktop' => 3, + 'tablet' => 2, + 'mobile' => 1, + ) + ), + 'title' => __( 'Membership Columns', 'astra' ), + 'priority' => 0, + 'input_attrs' => array( + 'step' => 1, + 'min' => 1, + 'max' => 6, + ), + 'divider' => $divider_array, + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Lifter_General_Configs(); diff --git a/inc/compatibility/woocommerce/class-astra-woocommerce.php b/inc/compatibility/woocommerce/class-astra-woocommerce.php new file mode 100644 index 0000000..91cd6ef --- /dev/null +++ b/inc/compatibility/woocommerce/class-astra-woocommerce.php @@ -0,0 +1,1819 @@ +=' ) ) { + add_filter( 'woocommerce_add_to_cart_fragments', array( $this, 'cart_link_fragment' ) ); + } else { + add_filter( 'add_to_cart_fragments', array( $this, 'cart_link_fragment' ) ); + } + + add_action( 'woocommerce_before_shop_loop_item_title', array( $this, 'product_flip_image' ), 10 ); + add_filter( 'woocommerce_subcategory_count_html', array( $this, 'subcategory_count_markup' ), 10, 2 ); + + add_action( 'customize_register', array( $this, 'customize_register' ), 2 ); + + add_filter( 'woocommerce_get_stock_html', 'astra_woo_product_in_stock', 10, 2 ); + + add_filter( 'astra_schema_body', array( $this, 'remove_body_schema' ) ); + + // Header Cart Icon. + add_action( 'astra_woo_header_cart_icons_before', array( $this, 'header_cart_icon_markup' ) ); + + add_action( 'astra_cart_in_menu_class', array( $this, 'header_cart_icon_class' ), 99 ); + + } + + /** + * Header Cart Extra Icons markup + * + * @return void; + */ + public function header_cart_icon_markup() { + + if ( false === Astra_Builder_Helper::$is_header_footer_builder_active && ! defined( 'ASTRA_EXT_VER' ) ) { + return; + } + + $icon = astra_get_option( 'woo-header-cart-icon' ); + $cart_total_display = astra_get_option( 'woo-header-cart-total-display' ); + $cart_count_display = apply_filters( 'astra_header_cart_count', true ); + $cart_title_display = astra_get_option( 'woo-header-cart-title-display' ); + $cart_title = apply_filters( 'astra_header_cart_title', __( 'Cart', 'astra' ) ); + + $cart_title_markup = '' . esc_html( $cart_title ) . ''; + $cart_total_markup = ''; + if ( null !== WC()->cart ) { + $cart_total_markup = '' . WC()->cart->get_cart_subtotal() . ''; + } + + // Cart Title & Cart Cart total markup. + $cart_info_markup = sprintf( + ' + %1$s + %2$s + %3$s + ', + ( $cart_title_display ) ? $cart_title_markup : '', + ( $cart_total_display && $cart_title_display ) ? '/' : '', + ( $cart_total_display ) ? $cart_total_markup : '' + ); + + $cart_contents_count = 0; + if ( null !== WC()->cart ) { + $cart_contents_count = WC()->cart->get_cart_contents_count(); + } + + // Cart Icon markup with total number of items. + $cart_icon = sprintf( + '%4$s', + ( $icon ) ? $icon : '', + ( $cart_count_display ) ? '' : 'no-cart-total', + ( $cart_count_display ) ? 'data-cart-total="' . $cart_contents_count . '"' : '', + ( $icon ) ? ( ( false !== Astra_Icons::is_svg_icons() ) ? Astra_Icons::get_icons( $icon ) : '' ) : '' + ); + + // Theme's default icon with cart title and cart total. + if ( 'default' == $icon || ! defined( 'ASTRA_EXT_VER' ) || ( defined( 'ASTRA_EXT_VER' ) && ! Astra_Ext_Extension::is_active( 'woocommerce' ) ) ) { + // Cart Total or Cart Title enable then only add markup. + if ( $cart_title_display || $cart_total_display ) { + echo $cart_info_markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + } + } else { + + // Remove Default cart icon added by theme. + add_filter( 'astra_woo_default_header_cart_icon', '__return_false' ); + + /* translators: 1: Cart Title Markup, 2: Cart Icon Markup */ + printf( + '
+ %1$s + %2$s +
', + ( $cart_title_display || $cart_total_display ) ? $cart_info_markup : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + ( $cart_icon ) ? $cart_icon : '' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + ); + } + } + + /** + * Header Cart Icon Class + * + * @param array $classes Default argument array. + * + * @return array; + */ + public function header_cart_icon_class( $classes ) { + + if ( false === Astra_Builder_Helper::$is_header_footer_builder_active && ! defined( 'ASTRA_EXT_VER' ) ) { + return $classes; + } + + $header_cart_icon_style = astra_get_option( 'woo-header-cart-icon-style' ); + + $classes[] = 'ast-menu-cart-' . $header_cart_icon_style; + $header_cart_icon_has_color = astra_get_option( 'woo-header-cart-icon-color' ); + if ( ! empty( $header_cart_icon_has_color ) && ( 'none' !== $header_cart_icon_style ) ) { + $classes[] = 'ast-menu-cart-has-color'; + } + + return $classes; + } + + /** + * Remove body schema when using WooCommerce template. + * WooCommerce adds it's own product schema hence schema data from Astra should be disabled here. + * + * @since 1.8.0 + * @param String $schema Schema markup. + * @return String + */ + public function remove_body_schema( $schema ) { + if ( is_woocommerce() ) { + $schema = ''; + } + + return $schema; + } + + /** + * Rating Markup + * + * @since 1.2.2 + * @param string $html Rating Markup. + * @param float $rating Rating being shown. + * @param int $count Total number of ratings. + * @return string + */ + public function rating_markup( $html, $rating, $count ) { + + if ( 0 == $rating ) { + $html = '
'; + $html .= wc_get_star_rating_html( $rating, $count ); + $html .= '
'; + } + return $html; + } + + /** + * Cart Page Upselles products. + * + * @return void + */ + public function cart_page_upselles() { + + $upselles_enabled = astra_get_option( 'enable-cart-upsells' ); + if ( ! $upselles_enabled ) { + remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' ); + } + } + + /** + * Subcategory Count Markup + * + * @param array $styles Css files. + * + * @return array + */ + public function woo_filter_style( $styles ) { + + /* Directory and Extension */ + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + + $css_uri = ASTRA_THEME_URI . 'assets/css/' . $dir_name . '/compatibility/woocommerce/'; + + // Register & Enqueue Styles. + // Generate CSS URL. + + if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { + $styles = array( + 'woocommerce-layout' => array( + 'src' => $css_uri . 'woocommerce-layout' . $file_prefix . '.css', + 'deps' => '', + 'version' => ASTRA_THEME_VERSION, + 'media' => 'all', + 'has_rtl' => true, + ), + 'woocommerce-smallscreen' => array( + 'src' => $css_uri . 'woocommerce-smallscreen' . $file_prefix . '.css', + 'deps' => 'woocommerce-layout', + 'version' => ASTRA_THEME_VERSION, + 'media' => 'only screen and (max-width: ' . apply_filters( 'woocommerce_style_smallscreen_breakpoint', astra_get_tablet_breakpoint() . 'px' ) . ')', + 'has_rtl' => true, + ), + 'woocommerce-general' => array( + 'src' => $css_uri . 'woocommerce' . $file_prefix . '.css', + 'deps' => '', + 'version' => ASTRA_THEME_VERSION, + 'media' => 'all', + 'has_rtl' => true, + ), + ); + } else { + $styles = array( + 'woocommerce-layout' => array( + 'src' => $css_uri . 'woocommerce-layout-grid' . $file_prefix . '.css', + 'deps' => '', + 'version' => ASTRA_THEME_VERSION, + 'media' => 'all', + 'has_rtl' => true, + ), + 'woocommerce-smallscreen' => array( + 'src' => $css_uri . 'woocommerce-smallscreen-grid' . $file_prefix . '.css', + 'deps' => 'woocommerce-layout', + 'version' => ASTRA_THEME_VERSION, + 'media' => 'only screen and (max-width: ' . apply_filters( 'woocommerce_style_smallscreen_breakpoint', astra_get_tablet_breakpoint() . 'px' ) . ')', + 'has_rtl' => true, + ), + 'woocommerce-general' => array( + 'src' => $css_uri . 'woocommerce-grid' . $file_prefix . '.css', + 'deps' => '', + 'version' => ASTRA_THEME_VERSION, + 'media' => 'all', + 'has_rtl' => true, + ), + ); + } + + return $styles; + } + + /** + * Subcategory Count Markup + * + * @param mixed $content Count Markup. + * @param object $category Object of Category. + * @return mixed + */ + public function subcategory_count_markup( $content, $category ) { + + $content = sprintf( // WPCS: XSS OK. + /* translators: 1: number of products */ + _nx( '%1$s Product', '%1$s Products', $category->count, 'product categories', 'astra' ), + number_format_i18n( $category->count ) + ); + + return '' . $content . ''; + } + + /** + * Product Flip Image + */ + public function product_flip_image() { + + global $product; + + $hover_style = astra_get_option( 'shop-hover-style' ); + + if ( 'swap' === $hover_style ) { + + $attachment_ids = $product->get_gallery_image_ids(); + + if ( $attachment_ids ) { + + $image_size = apply_filters( 'single_product_archive_thumbnail_size', 'shop_catalog' ); + + echo apply_filters( 'astra_woocommerce_product_flip_image', wp_get_attachment_image( reset( $attachment_ids ), $image_size, false, array( 'class' => 'show-on-hover' ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + } + } + } + + /** + * Theme Defaults. + * + * @param array $defaults Array of options value. + * @return array + */ + public function theme_defaults( $defaults ) { + + // Container. + $defaults['woocommerce-content-layout'] = 'plain-container'; + + // Sidebar. + $defaults['woocommerce-sidebar-layout'] = 'no-sidebar'; + $defaults['single-product-sidebar-layout'] = 'default'; + + /* Shop */ + $defaults['shop-grids'] = array( + 'desktop' => 4, + 'tablet' => 3, + 'mobile' => 2, + ); + $defaults['shop-no-of-products'] = '12'; + $defaults['shop-product-structure'] = array( + 'category', + 'title', + 'ratings', + 'price', + 'add_cart', + ); + $defaults['shop-hover-style'] = ''; + + /* Single */ + $defaults['single-product-breadcrumb-disable'] = false; + + /* Cart */ + $defaults['enable-cart-upsells'] = true; + + $defaults['shop-archive-width'] = 'default'; + $defaults['shop-archive-max-width'] = 1200; + + return $defaults; + } + + /** + * Update Shop page grid + * + * @param int $col Shop Column. + * @return int + */ + public function shop_columns( $col ) { + + $col = astra_get_option( 'shop-grids' ); + return $col['desktop']; + } + + /** + * Check if the current page is a Product Subcategory page or not. + * + * @param integer $category_id Current page Category ID. + * @return boolean + */ + public function astra_woo_is_subcategory( $category_id = null ) { + if ( is_tax( 'product_cat' ) ) { + if ( empty( $category_id ) ) { + $category_id = get_queried_object_id(); + } + $category = get_term( get_queried_object_id(), 'product_cat' ); + if ( empty( $category->parent ) ) { + return false; + } + return true; + } + return false; + } + + /** + * Update Shop page grid + * + * @return int + */ + public function shop_no_of_products() { + $taxonomy_page_display = get_option( 'woocommerce_category_archive_display', false ); + if ( is_product_taxonomy() && 'subcategories' === $taxonomy_page_display ) { + if ( $this->astra_woo_is_subcategory() ) { + $products = astra_get_option( 'shop-no-of-products' ); + return $products; + } + $products = wp_count_posts( 'product' )->publish; + } else { + $products = astra_get_option( 'shop-no-of-products' ); + } + return $products; + } + + /** + * Add products item class on shop page + * + * @param Array $classes product classes. + * + * @return array. + */ + public function shop_page_products_item_class( $classes = '' ) { + + if ( is_shop() || is_product_taxonomy() ) { + $shop_grid = astra_get_option( 'shop-grids' ); + $classes[] = 'columns-' . $shop_grid['desktop']; + $classes[] = 'tablet-columns-' . $shop_grid['tablet']; + $classes[] = 'mobile-columns-' . $shop_grid['mobile']; + + $classes[] = 'ast-woo-shop-archive'; + } + // Cart menu is emabled. + $rt_section = astra_get_option( 'header-main-rt-section' ); + + if ( 'woocommerce' === $rt_section ) { + $classes[] = 'ast-woocommerce-cart-menu'; + } + + return $classes; + } + + /** + * Get grid columns for either Archive|Single product. + * Introducing this function to reduce lot of CSS we write for 'grid-template-columns' for every count (till 6). + * + * @param string $type - WooCommerce page type Archive/Single. + * @param string $device - Device specific grid option. + * @param int $default - Default grid count (fallback basically). + * + * @return int grid count. + * @since 3.4.3 + */ + public function get_grid_column_count( $type = 'archive', $device = 'desktop', $default = 2 ) { + + if ( 'archive' === $type ) { + $products_grid = astra_get_option( 'shop-grids' ); + } else { + $products_grid = astra_get_option( 'single-product-related-upsell-grid' ); + } + + return isset( $products_grid[ $device ] ) ? absint( $products_grid[ $device ] ) : $default; + } + + /** + * Add class on single product page + * + * @param Array $classes product classes. + * + * @return array. + */ + public function single_product_class( $classes ) { + + if ( is_product() && 0 == get_post_meta( get_the_ID(), '_wc_review_count', true ) ) { + $classes[] = 'ast-woo-product-no-review'; + } + + if ( is_shop() || is_product_taxonomy() ) { + $hover_style = astra_get_option( 'shop-hover-style' ); + + if ( '' !== $hover_style ) { + $classes[] = 'astra-woo-hover-' . $hover_style; + } + } + + return $classes; + } + + /** + * Update woocommerce related product numbers + * + * @param array $args Related products array. + * @return array + */ + public function related_products_args( $args ) { + + $col = astra_get_option( 'shop-grids' ); + $args['posts_per_page'] = $col['desktop']; + return $args; + } + + /** + * Setup theme + * + * @since 1.0.3 + */ + public function setup_theme() { + + // WooCommerce. + add_theme_support( 'wc-product-gallery-zoom' ); + add_theme_support( 'wc-product-gallery-lightbox' ); + add_theme_support( 'wc-product-gallery-slider' ); + } + + /** + * Store widgets init. + */ + public function store_widgets_init() { + register_sidebar( + apply_filters( + 'astra_woocommerce_shop_sidebar_init', + array( + 'name' => esc_html__( 'WooCommerce Sidebar', 'astra' ), + 'id' => 'astra-woo-shop-sidebar', + 'description' => __( 'This sidebar will be used on Product archive, Cart, Checkout and My Account pages.', 'astra' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) + ) + ); + register_sidebar( + apply_filters( + 'astra_woocommerce_single_sidebar_init', + array( + 'name' => esc_html__( 'Product Sidebar', 'astra' ), + 'id' => 'astra-woo-single-sidebar', + 'description' => __( 'This sidebar will be used on Single Product page.', 'astra' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) + ) + ); + } + + /** + * Assign shop sidebar for store page. + * + * @param String $sidebar Sidebar. + * + * @return String $sidebar Sidebar. + */ + public function replace_store_sidebar( $sidebar ) { + + if ( is_shop() || is_product_taxonomy() || is_checkout() || is_cart() || is_account_page() ) { + $sidebar = 'astra-woo-shop-sidebar'; + } elseif ( is_product() ) { + $sidebar = 'astra-woo-single-sidebar'; + } + + return $sidebar; + } + + /** + * WooCommerce Container + * + * @param String $sidebar_layout Layout type. + * + * @return String $sidebar_layout Layout type. + */ + public function store_sidebar_layout( $sidebar_layout ) { + + if ( is_shop() || is_product_taxonomy() || is_checkout() || is_cart() || is_account_page() ) { + + $woo_sidebar = astra_get_option( 'woocommerce-sidebar-layout' ); + + if ( 'default' !== $woo_sidebar ) { + + $sidebar_layout = $woo_sidebar; + } + + if ( is_shop() ) { + $shop_page_id = get_option( 'woocommerce_shop_page_id' ); + $shop_sidebar = get_post_meta( $shop_page_id, 'site-sidebar-layout', true ); + } elseif ( is_product_taxonomy() ) { + $shop_sidebar = 'default'; + } else { + $shop_sidebar = astra_get_option_meta( 'site-sidebar-layout', '', true ); + } + + if ( 'default' !== $shop_sidebar && ! empty( $shop_sidebar ) ) { + $sidebar_layout = $shop_sidebar; + } + } + + return $sidebar_layout; + } + /** + * WooCommerce Container + * + * @param String $layout Layout type. + * + * @return String $layout Layout type. + */ + public function store_content_layout( $layout ) { + + if ( is_woocommerce() || is_checkout() || is_cart() || is_account_page() ) { + + $woo_layout = astra_get_option( 'woocommerce-content-layout' ); + + if ( 'default' !== $woo_layout ) { + + $layout = $woo_layout; + } + + if ( is_shop() ) { + $shop_page_id = get_option( 'woocommerce_shop_page_id' ); + $shop_layout = get_post_meta( $shop_page_id, 'site-content-layout', true ); + } elseif ( is_product_taxonomy() ) { + $shop_layout = 'default'; + } else { + $shop_layout = astra_get_option_meta( 'site-content-layout', '', true ); + } + + if ( 'default' !== $shop_layout && ! empty( $shop_layout ) ) { + $layout = $shop_layout; + } + } + + return apply_filters( 'astra_get_store_content_layout', $layout ); + } + + /** + * Shop Page Meta + * + * @return void + */ + public function shop_meta_option() { + + // Page Title. + if ( is_shop() ) { + + $shop_page_id = get_option( 'woocommerce_shop_page_id' ); + $shop_title = get_post_meta( $shop_page_id, 'site-post-title', true ); + $main_header_display = get_post_meta( $shop_page_id, 'ast-main-header-display', true ); + $footer_layout = get_post_meta( $shop_page_id, 'footer-sml-layout', true ); + + if ( 'disabled' === $shop_title ) { + add_filter( 'woocommerce_show_page_title', '__return_false' ); + } + + if ( 'disabled' === $main_header_display ) { + remove_action( 'astra_masthead', 'astra_masthead_primary_template' ); + } + + if ( 'disabled' === $footer_layout ) { + remove_action( 'astra_footer_content', 'astra_footer_small_footer_template', 5 ); + } + } + } + + + /** + * Shop customization. + * + * @return void + */ + public function shop_customization() { + + if ( ! apply_filters( 'astra_woo_shop_product_structure_override', false ) ) { + + add_action( 'woocommerce_before_shop_loop_item', 'astra_woo_shop_thumbnail_wrap_start', 6 ); + /** + * Add sale flash before shop loop. + */ + add_action( 'woocommerce_before_shop_loop_item', 'woocommerce_show_product_loop_sale_flash', 9 ); + + add_action( 'woocommerce_after_shop_loop_item', 'astra_woo_shop_thumbnail_wrap_end', 8 ); + /** + * Add Out of Stock to the Shop page + */ + add_action( 'woocommerce_shop_loop_item_title', 'astra_woo_shop_out_of_stock', 8 ); + + remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); + + /** + * Shop Page Product Content Sorting + */ + add_action( 'woocommerce_after_shop_loop_item', 'astra_woo_woocommerce_shop_product_content' ); + } + } + + /** + * Checkout customization. + * + * @return void + */ + public function woocommerce_checkout() { + + if ( is_admin() ) { + return; + } + + if ( ! apply_filters( 'astra_woo_shop_product_structure_override', false ) ) { + + /** + * Checkout Page + */ + add_action( 'woocommerce_checkout_billing', array( WC()->checkout(), 'checkout_form_shipping' ) ); + } + + // Checkout Page. + remove_action( 'woocommerce_checkout_shipping', array( WC()->checkout(), 'checkout_form_shipping' ) ); + } + + /** + * Single product customization. + * + * @return void + */ + public function single_product_customization() { + + if ( ! is_product() ) { + return; + } + + add_filter( 'woocommerce_product_description_heading', '__return_false' ); + add_filter( 'woocommerce_product_additional_information_heading', '__return_false' ); + + // Breadcrumb. + remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); + if ( ! astra_get_option( 'single-product-breadcrumb-disable' ) ) { + add_action( 'woocommerce_single_product_summary', 'woocommerce_breadcrumb', 2 ); + } + } + + /** + * Remove Woo-Commerce Default actions + */ + public function woocommerce_init() { + remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); + remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); + remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 ); + remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 ); + remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 ); + remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); + remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 ); + } + + /** + * Add start of wrapper + */ + public function before_main_content_start() { + $site_sidebar = astra_page_layout(); + if ( 'left-sidebar' == $site_sidebar ) { + get_sidebar(); + } + ?> +
+ + + +
+
+ +
+
+ + + +
+ array( + 'background-color' => $theme_color, + 'color' => astra_get_foreground_color( $theme_color ), + ), + '.woocommerce a.button, .woocommerce button.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.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' => array( + 'color' => $btn_color, + 'border-color' => $btn_bg_color, + 'background-color' => $btn_bg_color, + ), + '.woocommerce 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 a.button.alt:hover, .woocommerce button.button.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' => array( + 'color' => $btn_h_color, + 'border-color' => $btn_bg_h_color, + 'background-color' => $btn_bg_h_color, + ), + '.woocommerce-message, .woocommerce-info' => array( + 'border-top-color' => $link_color, + ), + '.woocommerce-message::before,.woocommerce-info::before' => array( + 'color' => $link_color, + ), + '.woocommerce ul.products li.product .price, .woocommerce div.product p.price, .woocommerce div.product span.price, .widget_layered_nav_filters ul li.chosen a, .woocommerce-page ul.products li.product .ast-woo-product-category, .wc-layered-nav-rating a' => array( + 'color' => $text_color, + ), + // Form Fields, Pagination border Color. + '.woocommerce nav.woocommerce-pagination ul,.woocommerce nav.woocommerce-pagination ul li' => array( + 'border-color' => $link_color, + ), + '.woocommerce nav.woocommerce-pagination ul li a:focus, .woocommerce nav.woocommerce-pagination ul li a:hover, .woocommerce nav.woocommerce-pagination ul li span.current' => array( + 'background' => $link_color, + 'color' => $btn_color, + ), + '.woocommerce-MyAccount-navigation-link.is-active a' => array( + 'color' => $link_h_color, + ), + '.woocommerce .widget_price_filter .ui-slider .ui-slider-range, .woocommerce .widget_price_filter .ui-slider .ui-slider-handle' => array( + 'background-color' => $link_color, + ), + // Button Typography. + '.woocommerce a.button, .woocommerce button.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce-cart table.cart td.actions .button, .woocommerce form.checkout_coupon .button, .woocommerce #respond input#submit, .wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array( + 'border-radius' => astra_get_css_value( $btn_border_radius, 'px' ), + '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' ), + ), + '.woocommerce .star-rating, .woocommerce .comment-form-rating .stars a, .woocommerce .star-rating::before' => array( + 'color' => $link_color, + ), + '.woocommerce div.product .woocommerce-tabs ul.tabs li.active:before' => array( + 'background' => $link_color, + ), + '.woocommerce a.remove:hover' => array( + 'color' => esc_attr( $link_color ), + 'border-color' => esc_attr( $link_color ), + 'background-color' => esc_attr( '#ffffff' ), + ), + ); + + if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) { + + $compat_css_desktop = array( + /** + * Cart in menu + */ + '.ast-site-header-cart a' => array( + 'color' => esc_attr( $text_color ), + ), + + '.ast-site-header-cart a:focus, .ast-site-header-cart a:hover, .ast-site-header-cart .current-menu-item a' => array( + 'color' => esc_attr( $link_color ), + ), + + '.ast-cart-menu-wrap .count, .ast-cart-menu-wrap .count:after' => array( + 'border-color' => esc_attr( $link_color ), + 'color' => esc_attr( $link_color ), + ), + + '.ast-cart-menu-wrap:hover .count' => array( + 'color' => esc_attr( $cart_h_color ), + 'background-color' => esc_attr( $link_color ), + ), + + '.ast-site-header-cart .widget_shopping_cart .total .woocommerce-Price-amount' => array( + 'color' => esc_attr( $link_color ), + ), + + '.woocommerce a.remove:hover, .ast-woocommerce-cart-menu .main-header-menu .woocommerce-custom-menu-item .menu-item:hover > .menu-link.remove:hover' => array( + 'color' => esc_attr( $link_color ), + 'border-color' => esc_attr( $link_color ), + 'background-color' => esc_attr( '#ffffff' ), + ), + + /** + * Checkout button color for widget + */ + '.ast-site-header-cart .widget_shopping_cart .buttons .button.checkout, .woocommerce .widget_shopping_cart .woocommerce-mini-cart__buttons .checkout.wc-forward' => array( + 'color' => $btn_h_color, + 'border-color' => $btn_bg_h_color, + 'background-color' => $btn_bg_h_color, + ), + '.site-header .ast-site-header-cart-data .button.wc-forward, .site-header .ast-site-header-cart-data .button.wc-forward:hover' => array( + 'color' => $btn_color, + ), + '.below-header-user-select .ast-site-header-cart .widget, .ast-above-header-section .ast-site-header-cart .widget a, .below-header-user-select .ast-site-header-cart .widget_shopping_cart a' => array( + 'color' => $text_color, + ), + '.below-header-user-select .ast-site-header-cart .widget_shopping_cart a:hover, .ast-above-header-section .ast-site-header-cart .widget_shopping_cart a:hover, .below-header-user-select .ast-site-header-cart .widget_shopping_cart a.remove:hover, .ast-above-header-section .ast-site-header-cart .widget_shopping_cart a.remove:hover' => array( + 'color' => esc_attr( $link_color ), + ), + ); + + $css_output = array_merge( $css_output, $compat_css_desktop ); + } + + if ( Astra_Builder_Helper::apply_flex_based_css() ) { + $css_output['.woocommerce[class*="rel-up-columns-"] .site-main div.product .related.products ul.products li.product, .woocommerce-page .site-main ul.products li.product'] = array( + 'width' => '100%', + ); + } + + if ( false === Astra_Icons::is_svg_icons() ) { + $css_output['.woocommerce ul.product-categories > li ul li:before'] = array( + 'content' => '"\e900"', + 'padding' => '0 5px 0 5px', + 'display' => 'inline-block', + 'font-family' => 'Astra', + 'transform' => 'rotate(-90deg)', + 'font-size' => '11px', + 'font-size' => '0.7rem', + ); + } else { + $css_output['.woocommerce ul.product-categories > li ul li'] = array( + 'position' => 'relative', + ); + if ( $is_site_rtl ) { + $css_output['.woocommerce ul.product-categories > li ul li:before'] = array( + 'content' => '""', + 'border-width' => '1px 0 0 1px', + 'border-style' => 'solid', + 'display' => 'inline-block', + 'width' => '6px', + 'height' => '6px', + 'position' => 'absolute', + 'top' => '50%', + 'margin-top' => '-2px', + '-webkit-transform' => 'rotate(45deg)', + 'transform' => 'rotate(45deg)', + ); + $css_output['.woocommerce ul.product-categories > li ul li a'] = array( + 'margin-right' => '15px', + ); + } else { + $css_output['.woocommerce ul.product-categories > li ul li:before'] = array( + 'content' => '""', + 'border-width' => '1px 1px 0 0', + 'border-style' => 'solid', + 'display' => 'inline-block', + 'width' => '6px', + 'height' => '6px', + 'position' => 'absolute', + 'top' => '50%', + 'margin-top' => '-2px', + '-webkit-transform' => 'rotate(45deg)', + 'transform' => 'rotate(45deg)', + ); + $css_output['.woocommerce ul.product-categories > li ul li a'] = array( + 'margin-left' => '15px', + ); + } + } + + /* Parse WooCommerce General CSS from array() */ + $css_output = astra_parse_css( $css_output ); + + if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { + $tablet_css_shop_page_grid = array( + '.woocommerce.tablet-columns-6 ul.products li.product, .woocommerce-page.tablet-columns-6 ul.products li.product' => array( + 'width' => '12.7%', + 'width' => 'calc(16.66% - 16.66px)', + ), + '.woocommerce.tablet-columns-5 ul.products li.product, .woocommerce-page.tablet-columns-5 ul.products li.product' => array( + 'width' => '16.2%', + 'width' => 'calc(20% - 16px)', + ), + '.woocommerce.tablet-columns-4 ul.products li.product, .woocommerce-page.tablet-columns-4 ul.products li.product' => array( + 'width' => '21.5%', + 'width' => 'calc(25% - 15px)', + ), + '.woocommerce.tablet-columns-3 ul.products li.product, .woocommerce-page.tablet-columns-3 ul.products li.product' => array( + 'width' => '30.2%', + 'width' => 'calc(33.33% - 14px)', + ), + '.woocommerce.tablet-columns-2 ul.products li.product, .woocommerce-page.tablet-columns-2 ul.products li.product' => array( + 'width' => '47.6%', + 'width' => 'calc(50% - 10px)', + ), + '.woocommerce.tablet-columns-1 ul.products li.product, .woocommerce-page.tablet-columns-1 ul.products li.product' => array( + 'width' => '100%', + ), + '.woocommerce div.product .related.products ul.products li.product' => array( + 'width' => '30.2%', + 'width' => 'calc(33.33% - 14px)', + ), + ); + + } else { + $archive_tablet_grid = $this->get_grid_column_count( 'archive', 'tablet' ); + + $tablet_css_shop_page_grid = array( + '.woocommerce.tablet-columns-' . $archive_tablet_grid . ' ul.products li.product, .woocommerce-page.tablet-columns-' . $archive_tablet_grid . ' ul.products' => array( + 'grid-template-columns' => 'repeat(' . $archive_tablet_grid . ', minmax(0, 1fr))', + ), + ); + } + $css_output .= astra_parse_css( $tablet_css_shop_page_grid, astra_get_mobile_breakpoint( '', 1 ), astra_get_tablet_breakpoint() ); + + if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { + if ( $is_site_rtl ) { + $tablet_shop_page_grid_lang_direction_css = array( + '.woocommerce[class*="columns-"].columns-3 > ul.products li.product, .woocommerce[class*="columns-"].columns-4 > ul.products li.product, .woocommerce[class*="columns-"].columns-5 > ul.products li.product, .woocommerce[class*="columns-"].columns-6 > ul.products li.product' => array( + 'width' => '30.2%', + 'width' => 'calc(33.33% - 14px)', + 'margin-left' => '20px', + ), + '.woocommerce[class*="columns-"].columns-3 > ul.products li.product:nth-child(3n), .woocommerce[class*="columns-"].columns-4 > ul.products li.product:nth-child(3n), .woocommerce[class*="columns-"].columns-5 > ul.products li.product:nth-child(3n), .woocommerce[class*="columns-"].columns-6 > ul.products li.product:nth-child(3n)' => array( + 'margin-left' => 0, + 'clear' => 'left', + ), + '.woocommerce[class*="columns-"].columns-3 > ul.products li.product:nth-child(3n+1), .woocommerce[class*="columns-"].columns-4 > ul.products li.product:nth-child(3n+1), .woocommerce[class*="columns-"].columns-5 > ul.products li.product:nth-child(3n+1), .woocommerce[class*="columns-"].columns-6 > ul.products li.product:nth-child(3n+1)' => array( + 'clear' => 'right', + ), + '.woocommerce[class*="columns-"] ul.products li.product:nth-child(n), .woocommerce-page[class*="columns-"] ul.products li.product:nth-child(n)' => array( + 'margin-left' => '20px', + 'clear' => 'none', + ), + '.woocommerce.tablet-columns-2 ul.products li.product:nth-child(2n), .woocommerce-page.tablet-columns-2 ul.products li.product:nth-child(2n), .woocommerce.tablet-columns-3 ul.products li.product:nth-child(3n), .woocommerce-page.tablet-columns-3 ul.products li.product:nth-child(3n), .woocommerce.tablet-columns-4 ul.products li.product:nth-child(4n), .woocommerce-page.tablet-columns-4 ul.products li.product:nth-child(4n), .woocommerce.tablet-columns-5 ul.products li.product:nth-child(5n), .woocommerce-page.tablet-columns-5 ul.products li.product:nth-child(5n), .woocommerce.tablet-columns-6 ul.products li.product:nth-child(6n), .woocommerce-page.tablet-columns-6 ul.products li.product:nth-child(6n)' => array( + 'margin-left' => '0', + 'clear' => 'left', + ), + '.woocommerce.tablet-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce-page.tablet-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce.tablet-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce-page.tablet-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce.tablet-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce-page.tablet-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce.tablet-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce-page.tablet-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce.tablet-columns-6 ul.products li.product:nth-child(6n+1), .woocommerce-page.tablet-columns-6 ul.products li.product:nth-child(6n+1)' => array( + 'clear' => 'right', + ), + '.woocommerce div.product .related.products ul.products li.product:nth-child(3n), .woocommerce-page.tablet-columns-1 .site-main ul.products li.product' => array( + 'margin-left' => 0, + 'clear' => 'left', + ), + '.woocommerce div.product .related.products ul.products li.product:nth-child(3n+1)' => array( + 'clear' => 'right', + ), + ); + } else { + $tablet_shop_page_grid_lang_direction_css = array( + '.woocommerce[class*="columns-"].columns-3 > ul.products li.product, .woocommerce[class*="columns-"].columns-4 > ul.products li.product, .woocommerce[class*="columns-"].columns-5 > ul.products li.product, .woocommerce[class*="columns-"].columns-6 > ul.products li.product' => array( + 'width' => '30.2%', + 'width' => 'calc(33.33% - 14px)', + 'margin-right' => '20px', + ), + '.woocommerce[class*="columns-"].columns-3 > ul.products li.product:nth-child(3n), .woocommerce[class*="columns-"].columns-4 > ul.products li.product:nth-child(3n), .woocommerce[class*="columns-"].columns-5 > ul.products li.product:nth-child(3n), .woocommerce[class*="columns-"].columns-6 > ul.products li.product:nth-child(3n)' => array( + 'margin-right' => 0, + 'clear' => 'right', + ), + '.woocommerce[class*="columns-"].columns-3 > ul.products li.product:nth-child(3n+1), .woocommerce[class*="columns-"].columns-4 > ul.products li.product:nth-child(3n+1), .woocommerce[class*="columns-"].columns-5 > ul.products li.product:nth-child(3n+1), .woocommerce[class*="columns-"].columns-6 > ul.products li.product:nth-child(3n+1)' => array( + 'clear' => 'left', + ), + '.woocommerce[class*="columns-"] ul.products li.product:nth-child(n), .woocommerce-page[class*="columns-"] ul.products li.product:nth-child(n)' => array( + 'margin-right' => '20px', + 'clear' => 'none', + ), + '.woocommerce.tablet-columns-2 ul.products li.product:nth-child(2n), .woocommerce-page.tablet-columns-2 ul.products li.product:nth-child(2n), .woocommerce.tablet-columns-3 ul.products li.product:nth-child(3n), .woocommerce-page.tablet-columns-3 ul.products li.product:nth-child(3n), .woocommerce.tablet-columns-4 ul.products li.product:nth-child(4n), .woocommerce-page.tablet-columns-4 ul.products li.product:nth-child(4n), .woocommerce.tablet-columns-5 ul.products li.product:nth-child(5n), .woocommerce-page.tablet-columns-5 ul.products li.product:nth-child(5n), .woocommerce.tablet-columns-6 ul.products li.product:nth-child(6n), .woocommerce-page.tablet-columns-6 ul.products li.product:nth-child(6n)' => array( + 'margin-right' => '0', + 'clear' => 'right', + ), + '.woocommerce.tablet-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce-page.tablet-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce.tablet-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce-page.tablet-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce.tablet-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce-page.tablet-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce.tablet-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce-page.tablet-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce.tablet-columns-6 ul.products li.product:nth-child(6n+1), .woocommerce-page.tablet-columns-6 ul.products li.product:nth-child(6n+1)' => array( + 'clear' => 'left', + ), + '.woocommerce div.product .related.products ul.products li.product:nth-child(3n), .woocommerce-page.tablet-columns-1 .site-main ul.products li.product' => array( + 'margin-right' => 0, + 'clear' => 'right', + ), + '.woocommerce div.product .related.products ul.products li.product:nth-child(3n+1)' => array( + 'clear' => 'left', + ), + ); + } + $css_output .= astra_parse_css( $tablet_shop_page_grid_lang_direction_css, astra_get_mobile_breakpoint( '', 1 ), astra_get_tablet_breakpoint() ); + } + + /** + * Global button CSS - Tablet = min-wdth: (tablet + 1)px + */ + if ( $is_site_rtl ) { + $min_tablet_css = array( + '.woocommerce #reviews #comments' => array( + 'width' => '55%', + 'float' => 'right', + ), + '.woocommerce #reviews #review_form_wrapper' => array( + 'width' => '45%', + 'float' => 'left', + 'padding-right' => '2em', + ), + '.woocommerce form.checkout_coupon' => array( + 'width' => '50%', + ), + ); + if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { + $min_tablet_css['.woocommerce #reviews #comments']['float'] = 'right'; + $min_tablet_css['.woocommerce #reviews #review_form_wrapper']['float'] = 'left'; + } + } else { + $min_tablet_css = array( + '.woocommerce #reviews #comments' => array( + 'width' => '55%', + ), + '.woocommerce #reviews #review_form_wrapper' => array( + 'width' => '45%', + 'padding-left' => '2em', + ), + '.woocommerce form.checkout_coupon' => array( + 'width' => '50%', + ), + ); + + if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { + $min_tablet_css['.woocommerce #reviews #comments']['float'] = 'left'; + $min_tablet_css['.woocommerce #reviews #review_form_wrapper']['float'] = 'right'; + } + } + + $css_output .= astra_parse_css( $min_tablet_css, astra_get_tablet_breakpoint( '', 1 ) ); + + /** + * Global button CSS - Tablet = max-width: (tab-breakpoint)px. + */ + $css_global_button_tablet = array( + '.ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack.ast-no-menu-items .ast-site-header-cart, .ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack.ast-no-menu-items .ast-site-header-cart' => array( + 'padding-right' => 0, + 'padding-left' => 0, + ), + '.ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack .main-header-bar' => array( + 'text-align' => 'center', + ), + '.ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack .ast-site-header-cart, .ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack .ast-mobile-menu-buttons' => array( + 'display' => 'inline-block', + ), + '.ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-2.ast-mobile-header-inline .site-branding' => array( + 'flex' => 'auto', + ), + '.ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .site-branding' => array( + 'flex' => '0 0 100%', + ), + '.ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .main-header-container' => array( + 'display' => 'flex', + 'justify-content' => 'center', + ), + '.woocommerce-cart .woocommerce-shipping-calculator .button' => array( + 'width' => '100%', + ), + '.woocommerce a.button, .woocommerce button.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce-cart table.cart td.actions .button, .woocommerce form.checkout_coupon .button, .woocommerce #respond input#submit, .wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => 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' ), + ), + '.woocommerce div.product div.images, .woocommerce div.product div.summary, .woocommerce #content div.product div.images, .woocommerce #content div.product div.summary, .woocommerce-page div.product div.images, .woocommerce-page div.product div.summary, .woocommerce-page #content div.product div.images, .woocommerce-page #content div.product div.summary' => array( + 'float' => 'none', + 'width' => '100%', + ), + '.woocommerce-cart table.cart td.actions .ast-return-to-shop' => array( + 'display' => 'block', + 'text-align' => 'center', + 'margin-top' => '1em', + ), + ); + + if ( Astra_Builder_Helper::apply_flex_based_css() ) { + $css_global_button_tablet['.woocommerce ul.products, .woocommerce-page ul.products'] = array( + 'grid-template-columns' => 'repeat(3, minmax(0, 1fr))', + ); + + if ( is_shop() || is_product_taxonomy() ) { + + $archive_tablet_grid = $this->get_grid_column_count( 'archive', 'tablet' ); + + $css_global_button_tablet[ '.woocommerce.tablet-columns-' . $archive_tablet_grid . ' ul.products' ] = array( + 'grid-template-columns' => 'repeat(' . $archive_tablet_grid . ', minmax(0, 1fr))', + ); + $css_global_button_tablet['.woocommerce[class*="tablet-columns-"] .site-main div.product .related.products ul.products li.product'] = array( + 'width' => '100%', + ); + } + + if ( is_product() ) { + + $single_tablet_grid = $this->get_grid_column_count( 'single', 'tablet' ); + + $css_global_button_tablet[ '.woocommerce.tablet-rel-up-columns-' . $single_tablet_grid . ' ul.products' ] = array( + 'grid-template-columns' => 'repeat(' . $single_tablet_grid . ', minmax(0, 1fr))', + ); + $css_global_button_tablet['.woocommerce[class*="tablet-rel-up-columns-"] .site-main div.product .related.products ul.products li.product'] = array( + 'width' => '100%', + ); + } + } + + $css_output .= astra_parse_css( $css_global_button_tablet, '', astra_get_tablet_breakpoint() ); + + /** + * Global button CSS - Mobile = max-width: (mobile-breakpoint)px. + */ + $css_global_button_mobile = array( + '.ast-separate-container .ast-woocommerce-container' => array( + 'padding' => '.54em 1em 1.33333em', + ), + '.woocommerce a.button, .woocommerce button.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce-cart table.cart td.actions .button, .woocommerce form.checkout_coupon .button, .woocommerce #respond input#submit, .wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => 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' ), + ), + '.woocommerce-message, .woocommerce-error, .woocommerce-info' => array( + 'display' => 'flex', + 'flex-wrap' => 'wrap', + ), + '.woocommerce-message a.button, .woocommerce-error a.button, .woocommerce-info a.button' => array( + 'order' => '1', + 'margin-top' => '.5em', + ), + + '.woocommerce .woocommerce-ordering, .woocommerce-page .woocommerce-ordering' => array( + 'float' => 'none', + 'margin-bottom' => '2em', + 'width' => '100%', + ), + '.woocommerce ul.products a.button, .woocommerce-page ul.products a.button' => array( + 'padding' => '0.5em 0.75em', + ), + '.woocommerce table.cart td.actions .button, .woocommerce #content table.cart td.actions .button, .woocommerce-page table.cart td.actions .button, .woocommerce-page #content table.cart td.actions .button' => array( + 'padding-left' => '1em', + 'padding-right' => '1em', + ), + '.woocommerce #content table.cart .button, .woocommerce-page #content table.cart .button' => array( + 'width' => '100%', + ), + '.woocommerce #content table.cart .product-thumbnail, .woocommerce-page #content table.cart .product-thumbnail' => array( + 'display' => 'block', + 'text-align' => 'center !important', + ), + '.woocommerce #content table.cart .product-thumbnail::before, .woocommerce-page #content table.cart .product-thumbnail::before' => array( + 'display' => 'none', + ), + '.woocommerce #content table.cart td.actions .coupon, .woocommerce-page #content table.cart td.actions .coupon' => array( + 'float' => 'none', + ), + '.woocommerce #content table.cart td.actions .coupon .button, .woocommerce-page #content table.cart td.actions .coupon .button' => array( + 'flex' => '1', + ), + '.woocommerce #content div.product .woocommerce-tabs ul.tabs li a, .woocommerce-page #content div.product .woocommerce-tabs ul.tabs li a' => array( + 'display' => 'block', + ), + ); + + if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { + $css_global_button_mobile['.woocommerce div.product .related.products ul.products li.product, .woocommerce.mobile-columns-2 ul.products li.product, .woocommerce-page.mobile-columns-2 ul.products li.product'] = array( + 'width' => '46.1%', + 'width' => 'calc(50% - 10px)', + ); + $css_global_button_mobile['.woocommerce.mobile-columns-6 ul.products li.product, .woocommerce-page.mobile-columns-6 ul.products li.product'] = array( + 'width' => '10.2%', + 'width' => 'calc(16.66% - 16.66px)', + ); + $css_global_button_mobile['.woocommerce.mobile-columns-5 ul.products li.product, .woocommerce-page.mobile-columns-5 ul.products li.product'] = array( + 'width' => '13%', + 'width' => 'calc(20% - 16px)', + ); + $css_global_button_mobile['.woocommerce.mobile-columns-4 ul.products li.product, .woocommerce-page.mobile-columns-4 ul.products li.product'] = array( + 'width' => '19%', + 'width' => 'calc(25% - 15px)', + ); + $css_global_button_mobile['.woocommerce.mobile-columns-3 ul.products li.product, .woocommerce-page.mobile-columns-3 ul.products li.product'] = array( + 'width' => '28.2%', + 'width' => 'calc(33.33% - 14px)', + ); + $css_global_button_mobile['.woocommerce.mobile-columns-1 ul.products li.product, .woocommerce-page.mobile-columns-1 ul.products li.product'] = array( + 'width' => '100%', + ); + } else { + + $archive_mobile_grid = $this->get_grid_column_count( 'archive', 'mobile' ); + $single_mobile_grid = $this->get_grid_column_count( 'single', 'mobile' ); + + $css_global_button_mobile[ '.woocommerce ul.products, .woocommerce-page ul.products, .woocommerce.mobile-columns-' . $archive_mobile_grid . ' ul.products, .woocommerce-page.mobile-columns-' . $archive_mobile_grid . ' ul.products' ] = array( + 'grid-template-columns' => 'repeat(' . $archive_mobile_grid . ', minmax(0, 1fr))', + ); + $css_global_button_mobile[ '.woocommerce.mobile-rel-up-columns-' . $single_mobile_grid . ' ul.products' ] = array( + 'grid-template-columns' => 'repeat(' . $single_mobile_grid . ', minmax(0, 1fr))', + ); + } + + $css_output .= astra_parse_css( $css_global_button_mobile, '', astra_get_mobile_breakpoint() ); + + if ( $is_site_rtl ) { + $global_button_mobile_lang_direction_css = array( + '.woocommerce[class*="columns-"].columns-3 > ul.products li.product, .woocommerce[class*="columns-"].columns-4 > ul.products li.product, .woocommerce[class*="columns-"].columns-5 > ul.products li.product, .woocommerce[class*="columns-"].columns-6 > ul.products li.product' => array( + 'width' => '46.1%', + 'width' => 'calc(50% - 10px)', + 'margin-left' => '20px', + ), + '.woocommerce ul.products a.button.loading::after, .woocommerce-page ul.products a.button.loading::after' => array( + 'display' => 'inline-block', + 'margin-right' => '5px', + 'position' => 'initial', + ), + '.woocommerce.mobile-columns-1 .site-main ul.products li.product:nth-child(n), .woocommerce-page.mobile-columns-1 .site-main ul.products li.product:nth-child(n)' => array( + 'margin-left' => 0, + ), + '.woocommerce #content div.product .woocommerce-tabs ul.tabs li, .woocommerce-page #content div.product .woocommerce-tabs ul.tabs li' => array( + 'display' => 'block', + 'margin-left' => 0, + ), + ); + + if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { + $global_button_mobile_lang_direction_css['.woocommerce[class*="columns-"] ul.products li.product:nth-child(n), .woocommerce-page[class*="columns-"] ul.products li.product:nth-child(n)'] = array( + 'margin-left' => '20px', + 'clear' => 'none', + ); + $global_button_mobile_lang_direction_css['.woocommerce-page[class*=columns-].columns-3>ul.products li.product:nth-child(2n), .woocommerce-page[class*=columns-].columns-4>ul.products li.product:nth-child(2n), .woocommerce-page[class*=columns-].columns-5>ul.products li.product:nth-child(2n), .woocommerce-page[class*=columns-].columns-6>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-3>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-4>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-5>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-6>ul.products li.product:nth-child(2n)'] = array( + 'margin-left' => 0, + 'clear' => 'left', + ); + $global_button_mobile_lang_direction_css['.woocommerce[class*="columns-"].columns-3 > ul.products li.product:nth-child(2n+1), .woocommerce[class*="columns-"].columns-4 > ul.products li.product:nth-child(2n+1), .woocommerce[class*="columns-"].columns-5 > ul.products li.product:nth-child(2n+1), .woocommerce[class*="columns-"].columns-6 > ul.products li.product:nth-child(2n+1)'] = array( + 'clear' => 'right', + ); + $global_button_mobile_lang_direction_css['.woocommerce-page[class*=columns-] ul.products li.product:nth-child(n), .woocommerce[class*=columns-] ul.products li.product:nth-child(n)'] = array( + 'margin-left' => '20px', + 'clear' => 'none', + ); + $global_button_mobile_lang_direction_css['.woocommerce.mobile-columns-6 ul.products li.product:nth-child(6n), .woocommerce-page.mobile-columns-6 ul.products li.product:nth-child(6n), .woocommerce.mobile-columns-5 ul.products li.product:nth-child(5n), .woocommerce-page.mobile-columns-5 ul.products li.product:nth-child(5n), .woocommerce.mobile-columns-4 ul.products li.product:nth-child(4n), .woocommerce-page.mobile-columns-4 ul.products li.product:nth-child(4n), .woocommerce.mobile-columns-3 ul.products li.product:nth-child(3n), .woocommerce-page.mobile-columns-3 ul.products li.product:nth-child(3n), .woocommerce.mobile-columns-2 ul.products li.product:nth-child(2n), .woocommerce-page.mobile-columns-2 ul.products li.product:nth-child(2n), .woocommerce div.product .related.products ul.products li.product:nth-child(2n)'] = array( + 'margin-left' => 0, + 'clear' => 'left', + ); + $global_button_mobile_lang_direction_css['.woocommerce.mobile-columns-6 ul.products li.product:nth-child(6n+1), .woocommerce-page.mobile-columns-6 ul.products li.product:nth-child(6n+1), .woocommerce.mobile-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce-page.mobile-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce.mobile-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce-page.mobile-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce.mobile-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce-page.mobile-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce.mobile-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce-page.mobile-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce div.product .related.products ul.products li.product:nth-child(2n+1)'] = array( + 'clear' => 'right', + ); + } + } else { + $global_button_mobile_lang_direction_css = array( + '.woocommerce[class*="columns-"].columns-3 > ul.products li.product, .woocommerce[class*="columns-"].columns-4 > ul.products li.product, .woocommerce[class*="columns-"].columns-5 > ul.products li.product, .woocommerce[class*="columns-"].columns-6 > ul.products li.product' => array( + 'width' => '46.1%', + 'width' => 'calc(50% - 10px)', + 'margin-right' => '20px', + ), + '.woocommerce ul.products a.button.loading::after, .woocommerce-page ul.products a.button.loading::after' => array( + 'display' => 'inline-block', + 'margin-left' => '5px', + 'position' => 'initial', + ), + '.woocommerce.mobile-columns-1 .site-main ul.products li.product:nth-child(n), .woocommerce-page.mobile-columns-1 .site-main ul.products li.product:nth-child(n)' => array( + 'margin-right' => 0, + ), + '.woocommerce #content div.product .woocommerce-tabs ul.tabs li, .woocommerce-page #content div.product .woocommerce-tabs ul.tabs li' => array( + 'display' => 'block', + 'margin-right' => 0, + ), + ); + + if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { + $global_button_mobile_lang_direction_css['.woocommerce[class*="columns-"] ul.products li.product:nth-child(n), .woocommerce-page[class*="columns-"] ul.products li.product:nth-child(n)'] = array( + 'margin-right' => '20px', + 'clear' => 'none', + ); + $global_button_mobile_lang_direction_css['.woocommerce-page[class*=columns-].columns-3>ul.products li.product:nth-child(2n), .woocommerce-page[class*=columns-].columns-4>ul.products li.product:nth-child(2n), .woocommerce-page[class*=columns-].columns-5>ul.products li.product:nth-child(2n), .woocommerce-page[class*=columns-].columns-6>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-3>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-4>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-5>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-6>ul.products li.product:nth-child(2n)'] = array( + 'margin-right' => 0, + 'clear' => 'right', + ); + $global_button_mobile_lang_direction_css['.woocommerce[class*="columns-"].columns-3 > ul.products li.product:nth-child(2n+1), .woocommerce[class*="columns-"].columns-4 > ul.products li.product:nth-child(2n+1), .woocommerce[class*="columns-"].columns-5 > ul.products li.product:nth-child(2n+1), .woocommerce[class*="columns-"].columns-6 > ul.products li.product:nth-child(2n+1)'] = array( + 'clear' => 'left', + ); + $global_button_mobile_lang_direction_css['.woocommerce-page[class*=columns-] ul.products li.product:nth-child(n), .woocommerce[class*=columns-] ul.products li.product:nth-child(n)'] = array( + 'margin-right' => '20px', + 'clear' => 'none', + ); + $global_button_mobile_lang_direction_css['.woocommerce.mobile-columns-6 ul.products li.product:nth-child(6n), .woocommerce-page.mobile-columns-6 ul.products li.product:nth-child(6n), .woocommerce.mobile-columns-5 ul.products li.product:nth-child(5n), .woocommerce-page.mobile-columns-5 ul.products li.product:nth-child(5n), .woocommerce.mobile-columns-4 ul.products li.product:nth-child(4n), .woocommerce-page.mobile-columns-4 ul.products li.product:nth-child(4n), .woocommerce.mobile-columns-3 ul.products li.product:nth-child(3n), .woocommerce-page.mobile-columns-3 ul.products li.product:nth-child(3n), .woocommerce.mobile-columns-2 ul.products li.product:nth-child(2n), .woocommerce-page.mobile-columns-2 ul.products li.product:nth-child(2n), .woocommerce div.product .related.products ul.products li.product:nth-child(2n)'] = array( + 'margin-right' => 0, + 'clear' => 'right', + ); + $global_button_mobile_lang_direction_css['.woocommerce.mobile-columns-6 ul.products li.product:nth-child(6n+1), .woocommerce-page.mobile-columns-6 ul.products li.product:nth-child(6n+1), .woocommerce.mobile-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce-page.mobile-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce.mobile-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce-page.mobile-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce.mobile-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce-page.mobile-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce.mobile-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce-page.mobile-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce div.product .related.products ul.products li.product:nth-child(2n+1)'] = array( + 'clear' => 'left', + ); + } + } + + $css_output .= astra_parse_css( $global_button_mobile_lang_direction_css, '', astra_get_mobile_breakpoint() ); + + if ( 'page-builder' !== astra_get_content_layout() ) { + /* Woocommerce Shop Archive width */ + if ( 'custom' === $woo_shop_archive_width ) : + // Woocommerce shop archive custom width. + $site_width = array( + '.ast-woo-shop-archive .site-content > .ast-container' => array( + 'max-width' => astra_get_css_value( $woo_shop_archive_max_width, 'px' ), + ), + ); + $css_output .= astra_parse_css( $site_width, astra_get_tablet_breakpoint( '', 1 ) ); + + else : + // Woocommerce shop archive default width. + $site_width = array( + '.ast-woo-shop-archive .site-content > .ast-container' => array( + 'max-width' => astra_get_css_value( $site_content_width + 40, 'px' ), + ), + ); + + /* Parse CSS from array()*/ + $css_output .= astra_parse_css( $site_width, astra_get_tablet_breakpoint( '', 1 ) ); + endif; + } + + $woo_product_css = array( + '.woocommerce #content .ast-woocommerce-container div.product div.images, .woocommerce .ast-woocommerce-container div.product div.images, .woocommerce-page #content .ast-woocommerce-container div.product div.images, .woocommerce-page .ast-woocommerce-container div.product div.images' => array( + 'width' => '50%', + ), + '.woocommerce #content .ast-woocommerce-container div.product div.summary, .woocommerce .ast-woocommerce-container div.product div.summary, .woocommerce-page #content .ast-woocommerce-container div.product div.summary, .woocommerce-page .ast-woocommerce-container div.product div.summary' => array( + 'width' => '46%', + ), + '.woocommerce.woocommerce-checkout form #customer_details.col2-set .col-1, .woocommerce.woocommerce-checkout form #customer_details.col2-set .col-2, .woocommerce-page.woocommerce-checkout form #customer_details.col2-set .col-1, .woocommerce-page.woocommerce-checkout form #customer_details.col2-set .col-2' => array( + 'float' => 'none', + 'width' => 'auto', + ), + ); + + /* Parse CSS from array()*/ + $css_output .= astra_parse_css( $woo_product_css, astra_get_tablet_breakpoint( '', 1 ) ); + + /* + * global button settings not working for woocommerce button on shop and single page. + * 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::astra_global_btn_woo_comp() ) { + + $woo_global_button_css = array( + '.woocommerce a.button , .woocommerce button.button.alt ,.woocommerce-page table.cart td.actions .button, .woocommerce-page #content table.cart td.actions .button , .woocommerce a.button.alt ,.woocommerce .woocommerce-message a.button , .ast-site-header-cart .widget_shopping_cart .buttons .button.checkout, .woocommerce button.button.alt.disabled , .wc-block-grid__products .wc-block-grid__product .wp-block-button__link ' => array( + 'border' => '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', + 'border-color' => $btn_border_color ? $btn_border_color : $btn_bg_color, + ), + '.woocommerce a.button:hover , .woocommerce button.button.alt:hover , .woocommerce-page table.cart td.actions .button:hover, .woocommerce-page #content table.cart td.actions .button:hover, .woocommerce a.button.alt:hover ,.woocommerce .woocommerce-message a.button:hover , .ast-site-header-cart .widget_shopping_cart .buttons .button.checkout:hover , .woocommerce button.button.alt.disabled:hover , .wc-block-grid__products .wc-block-grid__product .wp-block-button__link:hover' => array( + 'border-color' => $btn_border_h_color ? $btn_border_h_color : $btn_bg_h_color, + ), + ); + + $css_output .= astra_parse_css( $woo_global_button_css ); + } + + if ( ! is_shop() && ! is_product() ) { + + $css_output .= astra_parse_css( + array( + '.widget_product_search button' => array( + 'flex' => '0 0 auto', + 'padding' => '10px 20px;', + ), + ) + ); + } + + if ( $is_site_rtl ) { + $woo_product_lang_direction_css = array( + '.woocommerce.woocommerce-checkout form #customer_details.col2-set, .woocommerce-page.woocommerce-checkout form #customer_details.col2-set' => array( + 'width' => '55%', + 'float' => 'right', + 'margin-left' => '4.347826087%', + ), + '.woocommerce.woocommerce-checkout form #order_review, .woocommerce.woocommerce-checkout form #order_review_heading, .woocommerce-page.woocommerce-checkout form #order_review, .woocommerce-page.woocommerce-checkout form #order_review_heading' => array( + 'width' => '40%', + 'float' => 'left', + 'margin-left' => '0', + 'clear' => 'left', + ), + ); + } else { + $woo_product_lang_direction_css = array( + '.woocommerce.woocommerce-checkout form #customer_details.col2-set, .woocommerce-page.woocommerce-checkout form #customer_details.col2-set' => array( + 'width' => '55%', + 'float' => 'left', + 'margin-right' => '4.347826087%', + ), + '.woocommerce.woocommerce-checkout form #order_review, .woocommerce.woocommerce-checkout form #order_review_heading, .woocommerce-page.woocommerce-checkout form #order_review, .woocommerce-page.woocommerce-checkout form #order_review_heading' => array( + 'width' => '40%', + 'float' => 'right', + 'margin-right' => '0', + 'clear' => 'right', + ), + ); + } + + /* Parse CSS from array()*/ + $css_output .= astra_parse_css( $woo_product_lang_direction_css, astra_get_tablet_breakpoint( '', 1 ) ); + + wp_add_inline_style( 'woocommerce-general', apply_filters( 'astra_theme_woocommerce_dynamic_css', $css_output ) ); + + /** + * YITH WooCommerce Wishlist Style + */ + $yith_wcwl_main_style = array( + '.yes-js.js_active .ast-plain-container.ast-single-post #primary' => array( + 'margin' => esc_attr( '4em 0' ), + ), + '.js_active .ast-plain-container.ast-single-post .entry-header' => array( + 'margin-top' => esc_attr( '0' ), + ), + '.woocommerce table.wishlist_table' => array( + 'font-size' => esc_attr( '100%' ), + ), + '.woocommerce table.wishlist_table tbody td.product-name' => array( + 'font-weight' => esc_attr( '700' ), + ), + '.woocommerce table.wishlist_table thead th' => array( + 'border-top' => esc_attr( '0' ), + ), + '.woocommerce table.wishlist_table tr td.product-remove' => array( + 'padding' => esc_attr( '.7em 1em' ), + ), + '.woocommerce table.wishlist_table tbody td' => array( + 'border-right' => esc_attr( '0' ), + ), + '.woocommerce .wishlist_table td.product-add-to-cart a' => array( + 'display' => esc_attr( 'inherit !important' ), + ), + '.wishlist_table tr td, .wishlist_table tr th.wishlist-delete, .wishlist_table tr th.product-checkbox' => array( + 'text-align' => esc_attr( 'left' ), + ), + '.woocommerce #content table.wishlist_table.cart a.remove' => array( + 'display' => esc_attr( 'inline-block' ), + 'vertical-align' => esc_attr( 'middle' ), + 'font-size' => esc_attr( '18px' ), + 'font-weight' => esc_attr( 'normal' ), + 'width' => esc_attr( '24px' ), + 'height' => esc_attr( '24px' ), + 'line-height' => esc_attr( '21px' ), + 'color' => esc_attr( '#ccc !important' ), + 'text-align' => esc_attr( 'center' ), + 'border' => esc_attr( '1px solid #ccc' ), + ), + '.woocommerce #content table.wishlist_table.cart a.remove:hover' => array( + 'color' => esc_attr( $link_color . '!important' ), + 'border-color' => esc_attr( $link_color ), + 'background-color' => esc_attr( '#ffffff' ), + ), + ); + /* Parse CSS from array() */ + $yith_wcwl_main_style = astra_parse_css( $yith_wcwl_main_style ); + + $yith_wcwl_main_style_small = array( + '.yes-js.js_active .ast-plain-container.ast-single-post #primary' => array( + 'padding' => esc_attr( '1.5em 0' ), + 'margin' => esc_attr( '0' ), + ), + ); + /* Parse CSS from array()*/ + $yith_wcwl_main_style .= astra_parse_css( $yith_wcwl_main_style_small, '', astra_get_tablet_breakpoint() ); + + wp_add_inline_style( 'yith-wcwl-main', $yith_wcwl_main_style ); + } + + /** + * Register Customizer sections and panel for woocommerce + * + * @since 1.0.0 + * @param WP_Customize_Manager $wp_customize Theme Customizer object. + */ + public function customize_register( $wp_customize ) { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + /** + * Register Sections & Panels + */ + require ASTRA_THEME_DIR . 'inc/compatibility/woocommerce/customizer/class-astra-customizer-register-woo-section.php'; + + /** + * Sections + */ + require ASTRA_THEME_DIR . 'inc/compatibility/woocommerce/customizer/sections/class-astra-woo-shop-container-configs.php'; + require ASTRA_THEME_DIR . 'inc/compatibility/woocommerce/customizer/sections/class-astra-woo-shop-sidebar-configs.php'; + require ASTRA_THEME_DIR . 'inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-layout-configs.php'; + require ASTRA_THEME_DIR . 'inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-single-layout-configs.php'; + require ASTRA_THEME_DIR . 'inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-cart-layout-configs.php'; + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + + } + + /** + * Add Cart icon markup + * + * @param String $output Markup. + * @param String $section Section name. + * @param String $section_type Section selected option. + * @return Markup String. + * + * @since 1.0.0 + */ + public function astra_header_cart( $output, $section, $section_type ) { + + if ( 'woocommerce' === $section_type && apply_filters( 'astra_woo_header_cart_icon', true ) ) { + + $output = $this->woo_mini_cart_markup(); + } + + return $output; + } + + /** + * Woocommerce mini cart markup markup + * + * @since 1.2.2 + * @return html + */ + public function woo_mini_cart_markup() { + + if ( is_cart() ) { + $class = 'current-menu-item'; + } else { + $class = ''; + } + + $cart_menu_classes = apply_filters( 'astra_cart_in_menu_class', array( 'ast-menu-cart-with-border' ) ); + + ob_start(); + if ( is_customize_preview() && true === Astra_Builder_Helper::$is_header_footer_builder_active ) { + Astra_Builder_UI_Controller::render_customizer_edit_button(); + } + ?> +
+
+ astra_get_cart_link(); ?> +
+
+ +
+
+ + + + +
+ + cart ) { + echo WC()->cart->get_cart_contents_count(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + } + ?> + +
+ +
+ astra_get_cart_link(); + $fragments['a.cart-container'] = ob_get_clean(); + + return $fragments; + } + + /** + * For existing users, do not load the wide/full width image CSS by default. + * + * @since 2.5.0 + * @return boolean false if it is an existing user , true if not. + */ + public static function astra_global_btn_woo_comp() { + $astra_settings = get_option( ASTRA_THEME_SETTINGS ); + $astra_settings['global-btn-woo-css'] = isset( $astra_settings['global-btn-woo-css'] ) ? false : true; + return apply_filters( 'astra_global_btn_woo_comp', $astra_settings['global-btn-woo-css'] ); + } + } + +endif; + +if ( apply_filters( 'astra_enable_woocommerce_integration', true ) ) { + Astra_Woocommerce::get_instance(); +} diff --git a/inc/compatibility/woocommerce/customizer/class-astra-customizer-register-woo-section.php b/inc/compatibility/woocommerce/customizer/class-astra-customizer-register-woo-section.php new file mode 100644 index 0000000..e075ba1 --- /dev/null +++ b/inc/compatibility/woocommerce/customizer/class-astra-customizer-register-woo-section.php @@ -0,0 +1,74 @@ + 'section-woo-general', + 'title' => __( 'General', 'astra' ), + 'type' => 'section', + 'priority' => 10, + 'panel' => 'woocommerce', + ), + array( + 'name' => 'section-woo-shop', + 'title' => __( 'Shop', 'astra' ), + 'type' => 'section', + 'priority' => 20, + 'panel' => 'woocommerce', + ), + + array( + 'name' => 'section-woo-shop-single', + 'type' => 'section', + 'title' => __( 'Single Product', 'astra' ), + 'priority' => 12, + 'panel' => 'woocommerce', + ), + + array( + 'name' => 'section-woo-shop-cart', + 'type' => 'section', + 'title' => __( 'Cart', 'astra' ), + 'priority' => 20, + 'panel' => 'woocommerce', + ), + ); + + return array_merge( $configurations, $configs ); + } + } +} + + +new Astra_Customizer_Register_Woo_Section(); diff --git a/inc/compatibility/woocommerce/customizer/sections/class-astra-woo-shop-container-configs.php b/inc/compatibility/woocommerce/customizer/sections/class-astra-woo-shop-container-configs.php new file mode 100644 index 0000000..a24d642 --- /dev/null +++ b/inc/compatibility/woocommerce/customizer/sections/class-astra-woo-shop-container-configs.php @@ -0,0 +1,64 @@ + ASTRA_THEME_SETTINGS . '[woocommerce-content-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'default' => astra_get_option( 'woocommerce-content-layout' ), + 'section' => 'section-container-layout', + 'priority' => 85, + 'title' => __( 'WooCommerce Layout', 'astra' ), + 'divider' => array( 'ast_class' => 'ast-top-divider' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'boxed-container' => __( 'Boxed', 'astra' ), + 'content-boxed-container' => __( 'Content Boxed', 'astra' ), + 'plain-container' => __( 'Full Width / Contained', 'astra' ), + 'page-builder' => __( 'Full Width / Stretched', 'astra' ), + ), + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Woo_Shop_Container_Configs(); + diff --git a/inc/compatibility/woocommerce/customizer/sections/class-astra-woo-shop-sidebar-configs.php b/inc/compatibility/woocommerce/customizer/sections/class-astra-woo-shop-sidebar-configs.php new file mode 100644 index 0000000..6534163 --- /dev/null +++ b/inc/compatibility/woocommerce/customizer/sections/class-astra-woo-shop-sidebar-configs.php @@ -0,0 +1,84 @@ + ASTRA_THEME_SETTINGS . '[woocommerce-sidebar-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'section-sidebars', + 'default' => astra_get_option( 'woocommerce-sidebar-layout' ), + 'priority' => 5, + 'title' => __( 'WooCommerce', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'no-sidebar' => __( 'No Sidebar', 'astra' ), + 'left-sidebar' => __( 'Left Sidebar', 'astra' ), + 'right-sidebar' => __( 'Right Sidebar', 'astra' ), + ), + ), + + /** + * Option: Single Product + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[single-product-sidebar-layout]', + 'type' => 'control', + 'control' => 'ast-select', + 'default' => astra_get_option( 'single-product-sidebar-layout' ), + 'section' => 'section-sidebars', + 'priority' => 5, + 'title' => __( 'Single Product', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'no-sidebar' => __( 'No Sidebar', 'astra' ), + 'left-sidebar' => __( 'Left Sidebar', 'astra' ), + 'right-sidebar' => __( 'Right Sidebar', 'astra' ), + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Woo_Shop_Sidebar_Configs(); + + + diff --git a/inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-cart-layout-configs.php b/inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-cart-layout-configs.php new file mode 100644 index 0000000..6c36a4f --- /dev/null +++ b/inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-cart-layout-configs.php @@ -0,0 +1,57 @@ + ASTRA_THEME_SETTINGS . '[enable-cart-upsells]', + 'section' => 'section-woo-shop-cart', + 'type' => 'control', + 'control' => 'ast-toggle-control', + 'default' => astra_get_option( 'enable-cart-upsells' ), + 'title' => __( 'Enable Cross-sells', 'astra' ), + 'priority' => 10, + ), + ); + + return array_merge( $configurations, $_configs ); + } + } +} + +new Astra_Woo_Shop_Cart_Layout_Configs(); diff --git a/inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-layout-configs.php b/inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-layout-configs.php new file mode 100644 index 0000000..77a0981 --- /dev/null +++ b/inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-layout-configs.php @@ -0,0 +1,158 @@ + ASTRA_THEME_SETTINGS . '[shop-grids]', + 'type' => 'control', + 'control' => 'ast-responsive-slider', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), + 'section' => 'woocommerce_product_catalog', + 'default' => astra_get_option( + 'shop-grids', + array( + 'desktop' => 4, + 'tablet' => 3, + 'mobile' => 2, + ) + ), + 'priority' => 11, + 'title' => __( 'Shop Columns', 'astra' ), + 'input_attrs' => array( + 'step' => 1, + 'min' => 1, + 'max' => 6, + ), + ), + + /** + * Option: Products Per Page + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[shop-no-of-products]', + 'type' => 'control', + 'section' => 'woocommerce_product_catalog', + 'title' => __( 'Products Per Page', 'astra' ), + 'default' => astra_get_option( 'shop-no-of-products' ), + 'control' => 'number', + 'priority' => 15, + 'input_attrs' => array( + 'min' => 1, + 'step' => 1, + 'max' => 100, + ), + ), + + /** + * Option: Single Post Meta + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[shop-product-structure]', + 'type' => 'control', + 'control' => 'ast-sortable', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ), + 'section' => 'woocommerce_product_catalog', + 'default' => astra_get_option( 'shop-product-structure' ), + 'priority' => 15, + 'title' => __( 'Shop Product Structure', 'astra' ), + 'choices' => array( + 'title' => __( 'Title', 'astra' ), + 'price' => __( 'Price', 'astra' ), + 'ratings' => __( 'Ratings', 'astra' ), + 'short_desc' => __( 'Short Description', 'astra' ), + 'add_cart' => __( 'Add To Cart', 'astra' ), + 'category' => __( 'Category', 'astra' ), + ), + ), + + /** + * Option: Shop Archive Content Width + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[shop-archive-width]', + 'type' => 'control', + 'control' => 'ast-select', + 'section' => 'woocommerce_product_catalog', + 'default' => astra_get_option( 'shop-archive-width' ), + 'priority' => 10, + 'title' => __( 'Shop Archive Content Width', 'astra' ), + 'choices' => array( + 'default' => __( 'Default', 'astra' ), + 'custom' => __( 'Custom', 'astra' ), + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Enter Width + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[shop-archive-max-width]', + 'type' => 'control', + 'control' => 'ast-slider', + 'section' => 'woocommerce_product_catalog', + 'default' => astra_get_option( 'shop-archive-max-width' ), + 'priority' => 10, + 'title' => __( 'Custom Width', 'astra' ), + 'transport' => 'postMessage', + 'suffix' => 'px', + 'input_attrs' => array( + 'min' => 768, + 'step' => 1, + 'max' => 1920, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[shop-archive-width]', + 'operator' => '===', + 'value' => 'custom', + ), + ), + ), + ); + + $configurations = array_merge( $configurations, $_configs ); + + return $configurations; + + } + } +} + +new Astra_Woo_Shop_Layout_Configs(); + diff --git a/inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-single-layout-configs.php b/inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-single-layout-configs.php new file mode 100644 index 0000000..5a02370 --- /dev/null +++ b/inc/compatibility/woocommerce/customizer/sections/layout/class-astra-woo-shop-single-layout-configs.php @@ -0,0 +1,80 @@ + ASTRA_THEME_SETTINGS . '[single-product-breadcrumb-disable]', + 'section' => 'section-woo-shop-single', + 'type' => 'control', + 'control' => 'ast-toggle-control', + 'default' => astra_get_option( 'single-product-breadcrumb-disable' ), + 'title' => __( 'Disable Breadcrumb', 'astra' ), + 'priority' => 16, + ), + + /** + * Option: Disable Transparent Header on WooCommerce Product pages + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-disable-woo-products]', + 'default' => astra_get_option( 'transparent-header-disable-woo-products' ), + 'type' => 'control', + 'section' => 'section-transparent-header', + 'title' => __( 'Disable on WooCommerce Product Pages?', 'astra' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]', + 'operator' => '==', + 'value' => '1', + ), + ), + 'priority' => 26, + 'control' => 'ast-toggle-control', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Woo_Shop_Single_Layout_Configs(); + + diff --git a/inc/compatibility/woocommerce/woocommerce-common-functions.php b/inc/compatibility/woocommerce/woocommerce-common-functions.php new file mode 100644 index 0000000..4921337 --- /dev/null +++ b/inc/compatibility/woocommerce/woocommerce-common-functions.php @@ -0,0 +1,299 @@ +'; + + echo '

' . esc_html( get_the_title() ) . '

'; + + echo ''; + } + +endif; + +/** + * Shop page - Parent Category + */ +if ( ! function_exists( 'astra_woo_shop_parent_category' ) ) : + /** + * Add and/or Remove Categories from shop archive page. + * + * @hooked woocommerce_after_shop_loop_item - 9 + * + * @since 1.1.0 + */ + function astra_woo_shop_parent_category() { + if ( apply_filters( 'astra_woo_shop_parent_category', true ) ) : ?> + + get_categories( ';', '', '' ); + + $product_categories = htmlspecialchars_decode( wp_strip_all_tags( $product_categories ) ); + if ( $product_categories ) { + list( $parent_cat ) = explode( ';', $product_categories ); + echo apply_filters( 'astra_woo_shop_product_categories', esc_html( $parent_cat ), get_the_ID() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + } + + ?> + + + + + +
+ +
+ + get_availability(); + $stock_quantity = $product->get_stock_quantity(); + $availability = $product_avail['availability']; + $avail_class = $product_avail['class']; + if ( ! empty( $availability ) && $stock_quantity ) { + ob_start(); + ?> +

+ + +

+ '; + woocommerce_template_loop_product_title(); + echo ''; + } +} + +if ( ! function_exists( 'astra_woo_woocommerce_shop_product_content' ) ) { + + /** + * Show the product title in the product loop. By default this is an H2. + */ + function astra_woo_woocommerce_shop_product_content() { + + $shop_structure = apply_filters( 'astra_woo_shop_product_structure', astra_get_option( 'shop-product-structure' ) ); + if ( is_array( $shop_structure ) && ! empty( $shop_structure ) ) { + + do_action( 'astra_woo_shop_before_summary_wrap' ); + echo '
'; + do_action( 'astra_woo_shop_summary_wrap_top' ); + + foreach ( $shop_structure as $value ) { + + switch ( $value ) { + case 'title': + /** + * Add Product Title on shop page for all products. + */ + do_action( 'astra_woo_shop_title_before' ); + astra_woo_woocommerce_template_loop_product_title(); + do_action( 'astra_woo_shop_title_after' ); + break; + case 'price': + /** + * Add Product Price on shop page for all products. + */ + do_action( 'astra_woo_shop_price_before' ); + woocommerce_template_loop_price(); + do_action( 'astra_woo_shop_price_after' ); + break; + case 'ratings': + /** + * Add rating on shop page for all products. + */ + do_action( 'astra_woo_shop_rating_before' ); + woocommerce_template_loop_rating(); + do_action( 'astra_woo_shop_rating_after' ); + break; + case 'short_desc': + do_action( 'astra_woo_shop_short_description_before' ); + astra_woo_shop_product_short_description(); + do_action( 'astra_woo_shop_short_description_after' ); + break; + case 'add_cart': + do_action( 'astra_woo_shop_add_to_cart_before' ); + woocommerce_template_loop_add_to_cart(); + do_action( 'astra_woo_shop_add_to_cart_after' ); + break; + case 'category': + /** + * Add and/or Remove Categories from shop archive page. + */ + do_action( 'astra_woo_shop_category_before' ); + astra_woo_shop_parent_category(); + do_action( 'astra_woo_shop_category_after' ); + break; + default: + break; + } + } + + do_action( 'astra_woo_shop_summary_wrap_bottom' ); + echo '
'; + do_action( 'astra_woo_shop_after_summary_wrap' ); + } + } +} + +if ( ! function_exists( 'astra_woo_shop_thumbnail_wrap_start' ) ) { + + /** + * Thumbnail wrap start. + */ + function astra_woo_shop_thumbnail_wrap_start() { + + echo '
'; + } +} + +if ( ! function_exists( 'astra_woo_shop_thumbnail_wrap_end' ) ) { + + /** + * Thumbnail wrap end. + */ + function astra_woo_shop_thumbnail_wrap_end() { + + echo '
'; + } +} + + +/** + * Woocommerce filter - Widget Products Tags + */ +if ( ! function_exists( 'astra_widget_product_tag_cloud_args' ) ) { + + /** + * Woocommerce filter - Widget Products Tags + * + * @param array $args Tag arguments. + * @return array Modified tag arguments. + */ + function astra_widget_product_tag_cloud_args( $args = array() ) { + + $sidebar_link_font_size = astra_get_option( 'font-size-body' ); + $sidebar_link_font_size['desktop'] = ( '' != $sidebar_link_font_size['desktop'] ) ? $sidebar_link_font_size['desktop'] : 15; + + $args['smallest'] = intval( $sidebar_link_font_size['desktop'] ) - 2; + $args['largest'] = intval( $sidebar_link_font_size['desktop'] ) + 3; + $args['unit'] = 'px'; + + return apply_filters( 'astra_widget_product_tag_cloud_args', $args ); + } + add_filter( 'woocommerce_product_tag_cloud_widget_args', 'astra_widget_product_tag_cloud_args', 90 ); + +} + +/** + * Woocommerce shop/product div close tag. + */ +if ( ! function_exists( 'astra_woocommerce_div_wrapper_close' ) ) : + + /** + * Woocommerce shop/product div close tag. + * + * @return void + */ + function astra_woocommerce_div_wrapper_close() { + + echo ''; + + } + +endif; -- cgit v1.2.3-60-g2f50