Initial commit: Atomaste website

This commit is contained in:
2025-12-10 12:17:30 -05:00
commit 0b9e5d1605
19260 changed files with 5206382 additions and 0 deletions

View File

@@ -0,0 +1 @@
jQuery,astra_css("astra-settings[scroll-to-top-icon-size]","font-size","#ast-scroll-top","px"),astra_css("astra-settings[scroll-to-top-icon-color]","color","#ast-scroll-top"),astra_css("astra-settings[scroll-to-top-icon-bg-color]","background-color","#ast-scroll-top"),astra_css("astra-settings[scroll-to-top-icon-h-color]","color","#ast-scroll-top:hover"),astra_css("astra-settings[scroll-to-top-icon-h-bg-color]","background-color","#ast-scroll-top:hover"),wp.customize("astra-settings[scroll-to-top-icon-radius-fields]",function(t){t.bind(function(t){var o=astraBuilderPreview.tablet_break_point||768,s="",s=(s=(s+=" #ast-scroll-top { border-top-left-radius :"+t.desktop.top+t["desktop-unit"]+"; border-bottom-right-radius :"+t.desktop.bottom+t["desktop-unit"]+"; border-bottom-left-radius :"+t.desktop.left+t["desktop-unit"]+"; border-top-right-radius :"+t.desktop.right+t["desktop-unit"]+"; } ")+("@media (max-width: "+o+"px) { #ast-scroll-top { border-top-left-radius :"+t.tablet.top+t["tablet-unit"]+"; border-bottom-right-radius :"+t.tablet.bottom+t["tablet-unit"]+"; border-bottom-left-radius :"+t.tablet.left+t["tablet-unit"]+"; border-top-right-radius :"+t.tablet.right+t["tablet-unit"]+"; } }"))+("@media (max-width: "+(astraBuilderPreview.mobile_break_point||544)+"px) { #ast-scroll-top { border-top-left-radius :"+t.mobile.top+t["mobile-unit"]+"; border-bottom-right-radius :"+t.mobile.bottom+t["mobile-unit"]+"; border-bottom-left-radius :"+t.mobile.left+t["mobile-unit"]+"; border-top-right-radius :"+t.mobile.right+t["mobile-unit"]+"; } }");astra_add_dynamic_css("scroll-to-top-icon-radius-fields",s)})}),wp.customize("astra-settings[scroll-to-top-icon-position]",function(t){t.bind(function(t){jQuery("#ast-scroll-top").removeClass("ast-scroll-to-top-right ast-scroll-to-top-left"),jQuery("#ast-scroll-top").addClass("ast-scroll-to-top-"+t)})});

View File

@@ -0,0 +1,50 @@
/**
* This file adds some LIVE to the Customizer live preview. To leverage
* this, set your custom settings to 'postMessage' and then add your handling
* here. Your javascript should grab settings from customizer controls, and
* then make any necessary changes to the page using jQuery.
*
* @package Astra
* @since x.x.x
*/
( function( $ ) {
astra_css(
'astra-settings[scroll-to-top-icon-size]',
'font-size',
'#ast-scroll-top',
'px'
);
astra_css( 'astra-settings[scroll-to-top-icon-color]', 'color', '#ast-scroll-top' );
astra_css( 'astra-settings[scroll-to-top-icon-bg-color]', 'background-color', '#ast-scroll-top' );
astra_css( 'astra-settings[scroll-to-top-icon-h-color]', 'color', '#ast-scroll-top:hover' );
astra_css( 'astra-settings[scroll-to-top-icon-h-bg-color]', 'background-color', '#ast-scroll-top:hover' );
// Border Radius Fields for Button.
wp.customize( 'astra-settings[scroll-to-top-icon-radius-fields]', function( value ) {
value.bind( function( border ) {
let tablet_break_point = astraBuilderPreview.tablet_break_point || 768,
mobile_break_point = astraBuilderPreview.mobile_break_point || 544;
let dynamicStyle = '';
dynamicStyle += ' #ast-scroll-top { border-top-left-radius :' + border['desktop']['top'] + border['desktop-unit']
+ '; border-bottom-right-radius :' + border['desktop']['bottom'] + border['desktop-unit'] + '; border-bottom-left-radius :'
+ border['desktop']['left'] + border['desktop-unit'] + '; border-top-right-radius :' + border['desktop']['right'] + border['desktop-unit'] + '; } ';
dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) { #ast-scroll-top { border-top-left-radius :' + border['tablet']['top'] + border['tablet-unit']
+ '; border-bottom-right-radius :' + border['tablet']['bottom'] + border['tablet-unit'] + '; border-bottom-left-radius :'
+ border['tablet']['left'] + border['tablet-unit'] + '; border-top-right-radius :' + border['tablet']['right'] + border['tablet-unit'] + '; } }';
dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) { #ast-scroll-top { border-top-left-radius :' + border['mobile']['top'] + border['mobile-unit']
+ '; border-bottom-right-radius :' + border['mobile']['bottom'] + border['mobile-unit'] + '; border-bottom-left-radius :'
+ border['mobile']['left'] + border['mobile-unit'] + '; border-top-right-radius :' + border['mobile']['right'] + border['mobile-unit'] + '; } }';
astra_add_dynamic_css( 'scroll-to-top-icon-radius-fields', dynamicStyle );
} );
} );
// Scroll to top position.
wp.customize( 'astra-settings[scroll-to-top-icon-position]', function( value ) {
value.bind( function( position ) {
jQuery("#ast-scroll-top").removeClass("ast-scroll-to-top-right ast-scroll-to-top-left");
jQuery("#ast-scroll-top").addClass("ast-scroll-to-top-"+position);
} );
} );
} )( jQuery );

View File

@@ -0,0 +1,59 @@
/**
* Scroll To Top
*
* @package Astra
* @since 1.0.0
*/
document.addEventListener("DOMContentLoaded", function() {
var masthead = document.querySelector( '#page header' );
var astScrollTop = document.getElementById( 'ast-scroll-top' );
if ( astScrollTop ) {
astScrollToTop = function () {
var content = getComputedStyle(astScrollTop).content,
device = astScrollTop.dataset.onDevices;
content = content.replace( /[^0-9]/g, '' );
if( 'both' == device || ( 'desktop' == device && '769' == content ) || ( 'mobile' == device && '' == content ) ) {
// Get current window / document scroll.
var scrollTop = window.pageYOffset || document.body.scrollTop;
// If masthead found.
if( masthead && masthead.length ){
if (scrollTop > masthead.offsetHeight + 100) {
astScrollTop.style.display = "block";
} else {
astScrollTop.style.display = "none";
}
}
else{
// If there is no masthead set default start scroll
if ( window.pageYOffset > 300 ) {
astScrollTop.style.display = "block";
} else {
astScrollTop.style.display = "none";
}
}
} else {
astScrollTop.style.display = "none";
}
};
astScrollToTop();
window.addEventListener('scroll', function () {
astScrollToTop();
});
astScrollTop.onclick = function(e){
e.preventDefault();
window.scrollTo({
top: 0,
left: 0,
behavior: 'smooth'
});
};
}
});

View File

@@ -0,0 +1,56 @@
<?php
/**
* Scroll To Top Addon
*
* @since 4.0.0
* @package Astra
*/
define( 'ASTRA_SCROLL_TO_TOP_DIR', ASTRA_THEME_DIR . 'inc/addons/scroll-to-top/' );
define( 'ASTRA_SCROLL_TO_TOP_URL', ASTRA_THEME_URI . 'inc/addons/scroll-to-top/' );
/**
* Scroll To Top Initial Setup
*
* @since 4.0.0
*/
class Astra_Scroll_To_Top {
/**
* Member Variable
*
* @var null $instance
*/
private static $instance;
/**
* Initiator
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
/** @psalm-suppress InvalidPropertyAssignmentValue */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
self::$instance = new self();
/** @psalm-suppress InvalidPropertyAssignmentValue */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
}
return self::$instance;
}
/**
* Constructor function that initializes required actions and hooks
*/
public function __construct() {
require_once ASTRA_SCROLL_TO_TOP_DIR . 'classes/class-astra-scroll-to-top-loader.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound -- Not a template file so loading in a normal way.
// Include front end files.
if ( ! is_admin() ) {
require_once ASTRA_SCROLL_TO_TOP_DIR . 'css/static-css.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound -- Not a template file so loading in a normal way.
require_once ASTRA_SCROLL_TO_TOP_DIR . 'css/dynamic-css.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound -- Not a template file so loading in a normal way.
}
}
}
/**
* Kicking this off by calling 'get_instance()' method.
*/
Astra_Scroll_To_Top::get_instance();

View File

@@ -0,0 +1,134 @@
<?php
/**
* Scroll to Top - Customizer.
*
* @package Astra
* @since 4.0.0
*/
/**
* Customizer Initialization
*
* @since 4.0.0
*/
class Astra_Scroll_To_Top_Loader {
/**
* Member Variable
*
* @var null $instance
*/
private static $instance;
/**
* Initiator
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
/** @psalm-suppress InvalidPropertyAssignmentValue */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
self::$instance = new self();
/** @psalm-suppress InvalidPropertyAssignmentValue */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
}
return self::$instance;
}
/**
* Constructor
*
* @since 4.0.0
*/
public function __construct() {
add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) );
add_action( 'customize_register', array( $this, 'new_customize_register' ), 2 );
add_action( 'customize_preview_init', array( $this, 'preview_scripts' ) );
add_action( 'wp_footer', array( $this, 'html_markup_loader' ) );
}
/**
* Set Options Default Values
*
* @param array $defaults Astra options default value array.
* @return array
* @since 4.0.0
*/
public function theme_defaults( $defaults ) {
$astra_options = Astra_Theme_Options::get_astra_options();
$defaults['scroll-to-top-enable'] = true;
$defaults['scroll-to-top-icon-size'] = 15;
$defaults['scroll-to-top-icon-position'] = 'right';
$defaults['scroll-to-top-on-devices'] = 'both';
$defaults['scroll-to-top-icon-radius-fields'] = array(
'desktop' => array(
'top' => ! isset( $astra_options['scroll-to-top-icon-radius'] ) ? '' : $astra_options['scroll-to-top-icon-radius'],
'right' => ! isset( $astra_options['scroll-to-top-icon-radius'] ) ? '' : $astra_options['scroll-to-top-icon-radius'],
'bottom' => ! isset( $astra_options['scroll-to-top-icon-radius'] ) ? '' : $astra_options['scroll-to-top-icon-radius'],
'left' => ! isset( $astra_options['scroll-to-top-icon-radius'] ) ? '' : $astra_options['scroll-to-top-icon-radius'],
),
'tablet' => array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
),
'mobile' => array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
),
'desktop-unit' => 'px',
'tablet-unit' => 'px',
'mobile-unit' => 'px',
);
$defaults['scroll-to-top-icon-color'] = '';
$defaults['scroll-to-top-icon-h-color'] = '';
$defaults['scroll-to-top-icon-bg-color'] = '';
$defaults['scroll-to-top-icon-h-bg-color'] = '';
return $defaults;
}
/**
* Add customizer configs for scroll to top in the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
* @since 4.0.0
*/
public function new_customize_register( $wp_customize ) {
require_once ASTRA_SCROLL_TO_TOP_DIR . 'classes/customizer/class-astra-scroll-to-top-configs.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound -- Not a template file so loading in a normal way.
}
/**
* Customizer Preview
*
* @since 4.0.0
*/
public function preview_scripts() {
/** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( SCRIPT_DEBUG ) {
/** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
wp_enqueue_script( 'astra-scroll-to-top-customize-preview-js', ASTRA_SCROLL_TO_TOP_URL . 'assets/js/unminified/customizer-preview.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true );
} else {
wp_enqueue_script( 'astra-scroll-to-top-customize-preview-js', ASTRA_SCROLL_TO_TOP_URL . 'assets/js/minified/customizer-preview.min.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true );
}
}
/**
* Scroll to Top addon markup loader
*
* Loads appropriate template file based on the style option selected in options panel.
*
* @since 4.0.0
*/
public function html_markup_loader() {
if ( true === astra_get_option( 'scroll-to-top-enable', true ) ) {
get_template_part( 'template-parts/scroll-to-top' );
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Scroll_To_Top_Loader::get_instance();

View File

@@ -0,0 +1,310 @@
<?php
/**
* Scroll To Top Options for our theme.
*
* @package Astra
* @link https://www.brainstormforce.com
* @since 4.0.0
*/
// Block direct access to the file.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Bail if Customizer config base class does not exist.
if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) {
return;
}
/**
* Register Scroll To Top Customizer Configurations.
*/
class Astra_Scroll_To_Top_Configs extends Astra_Customizer_Config_Base {
/**
* Register Scroll To Top Customizer Configurations.
*
* @param Array $configurations Astra Customizer Configurations.
* @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
* @since 4.0.0
* @return Array Astra Customizer Configurations with updated configurations.
*/
public function register_configuration( $configurations, $wp_customize ) {
$_configs = array(
/**
* Option: Enable Scroll To Top
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[scroll-to-top-enable]',
'default' => astra_get_option( 'scroll-to-top-enable' ),
'type' => 'control',
'section' => 'section-scroll-to-top',
'title' => __( 'Enable Scroll to Top', 'astra' ),
'priority' => 1,
'control' => 'ast-toggle-control',
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
/**
* Option: Scroll to Top Display On
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[scroll-to-top-on-devices]',
'default' => astra_get_option( 'scroll-to-top-on-devices' ),
'type' => 'control',
'control' => 'ast-selector',
'section' => 'section-scroll-to-top',
'priority' => 10,
'title' => __( 'Display On', 'astra' ),
'choices' => array(
'desktop' => __( 'Desktop', 'astra' ),
'mobile' => __( 'Mobile', 'astra' ),
'both' => __( 'Desktop + Mobile', 'astra' ),
),
'renderAs' => 'text',
'responsive' => false,
'divider' => array( 'ast_class' => 'ast-top-section-divider ast-bottom-section-divider' ),
'context' => array(
'relation' => 'AND',
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[scroll-to-top-enable]',
'operator' => '==',
'value' => true,
),
),
),
/**
* Option: Scroll to Top Position
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[scroll-to-top-icon-position]',
'default' => astra_get_option( 'scroll-to-top-icon-position' ),
'type' => 'control',
'control' => 'ast-selector',
'transport' => 'postMessage',
'section' => 'section-scroll-to-top',
'title' => __( 'Position', 'astra' ),
'choices' => array(
'left' => __( 'Left', 'astra' ),
'right' => __( 'Right', 'astra' ),
),
'priority' => 11,
'responsive' => false,
'renderAs' => 'text',
'divider' => array( 'ast_class' => 'ast-bottom-section-divider' ),
'context' => array(
'relation' => 'AND',
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[scroll-to-top-enable]',
'operator' => '==',
'value' => true,
),
),
),
/**
* Option: Scroll To Top Icon Size
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[scroll-to-top-icon-size]',
'default' => astra_get_option( 'scroll-to-top-icon-size' ),
'type' => 'control',
'control' => 'ast-slider',
'transport' => 'postMessage',
'section' => 'section-scroll-to-top',
'title' => __( 'Icon Size', 'astra' ),
'suffix' => 'px',
'priority' => 12,
'context' => array(
'relation' => 'AND',
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[scroll-to-top-enable]',
'operator' => '==',
'value' => true,
),
),
),
array(
'name' => ASTRA_THEME_SETTINGS . '[scroll-on-top-color-group]',
'default' => astra_get_option( 'scroll-on-top-color-group' ),
'type' => 'control',
'control' => 'ast-color-group',
'title' => __( 'Icon Color', 'astra' ),
'section' => 'section-scroll-to-top',
'context' => array(
'relation' => 'AND',
( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[scroll-to-top-enable]',
'operator' => '==',
'value' => true,
),
),
'priority' => 1,
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
array(
'name' => ASTRA_THEME_SETTINGS . '[scroll-on-top-bg-color-group]',
'default' => astra_get_option( 'scroll-on-top-bg-color-group' ),
'type' => 'control',
'control' => 'ast-color-group',
'title' => __( 'Background Color', 'astra' ),
'section' => 'section-scroll-to-top',
'transport' => 'postMessage',
'context' => array(
'relation' => 'AND',
( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[scroll-to-top-enable]',
'operator' => '==',
'value' => true,
),
),
'priority' => 1,
),
/**
* Option: Scroll To Top Radius
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[scroll-to-top-icon-radius-fields]',
'default' => astra_get_option( 'scroll-to-top-icon-radius-fields' ),
'type' => 'control',
'control' => 'ast-responsive-spacing',
'transport' => 'postMessage',
'section' => 'section-scroll-to-top',
'title' => __( 'Border Radius', 'astra' ),
'suffix' => 'px',
'priority' => 1,
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
'context' => array(
'relation' => 'AND',
( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[scroll-to-top-enable]',
'operator' => '==',
'value' => true,
),
),
'linked_choices' => true,
'unit_choices' => array( 'px', 'em', '%' ),
'choices' => array(
'top' => __( 'Top', 'astra' ),
'right' => __( 'Right', 'astra' ),
'bottom' => __( 'Bottom', 'astra' ),
'left' => __( 'Left', 'astra' ),
),
'connected' => false,
),
/**
* Option: Icon Color
*/
array(
'name' => 'scroll-to-top-icon-color',
'default' => astra_get_option( 'scroll-to-top-icon-color' ),
'type' => 'sub-control',
'priority' => 1,
'parent' => ASTRA_THEME_SETTINGS . '[scroll-on-top-color-group]',
'section' => 'section-scroll-to-top',
'control' => 'ast-color',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
'transport' => 'postMessage',
'title' => __( 'Color', 'astra' ),
),
/**
* Option: Icon Background Color
*/
array(
'name' => 'scroll-to-top-icon-bg-color',
'default' => astra_get_option( 'scroll-to-top-icon-bg-color' ),
'type' => 'sub-control',
'priority' => 1,
'parent' => ASTRA_THEME_SETTINGS . '[scroll-on-top-bg-color-group]',
'section' => 'section-scroll-to-top',
'transport' => 'postMessage',
'control' => 'ast-color',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
'title' => __( 'Color', 'astra' ),
),
/**
* Option: Icon Hover Color
*/
array(
'name' => 'scroll-to-top-icon-h-color',
'default' => astra_get_option( 'scroll-to-top-icon-h-color' ),
'type' => 'sub-control',
'priority' => 1,
'parent' => ASTRA_THEME_SETTINGS . '[scroll-on-top-color-group]',
'section' => 'section-scroll-to-top',
'control' => 'ast-color',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
'transport' => 'postMessage',
'title' => __( 'Hover Color', 'astra' ),
),
/**
* Option: Link Hover Background Color
*/
array(
'name' => 'scroll-to-top-icon-h-bg-color',
'default' => astra_get_option( 'scroll-to-top-icon-h-bg-color' ),
'type' => 'sub-control',
'priority' => 1,
'parent' => ASTRA_THEME_SETTINGS . '[scroll-on-top-bg-color-group]',
'section' => 'section-scroll-to-top',
'control' => 'ast-color',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
'transport' => 'postMessage',
'title' => __( 'Hover Color', 'astra' ),
),
);
if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
$_configs[] = array(
'name' => 'section-scroll-to-top-ast-context-tabs',
'section' => 'section-scroll-to-top',
'type' => 'control',
'control' => 'ast-builder-header-control',
'priority' => 0,
'description' => '',
);
$_configs[] = array(
'name' => ASTRA_THEME_SETTINGS . '[enable-scroll-to-top-notice]',
'type' => 'control',
'control' => 'ast-description',
'section' => 'section-scroll-to-top',
'priority' => 1,
'label' => '',
'help' => __( 'Note: To get design settings in action make sure to enable Scroll to Top.', 'astra' ),
'context' => array(
'relation' => 'AND',
Astra_Builder_Helper::$design_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[scroll-to-top-enable]',
'operator' => '!=',
'value' => true,
),
),
);
}
$configurations = array_merge( $configurations, $_configs );
return $configurations;
}
}
/** Creating instance for getting customizer configs. */
new Astra_Scroll_To_Top_Configs();

View File

@@ -0,0 +1,110 @@
<?php
/**
* Scroll To Top - Dynamic CSS
*
* @package Astra
*/
add_filter( 'astra_dynamic_theme_css', 'astra_scroll_to_top_dynamic_css', 11 );
/**
* Dynamic CSS
*
* @param string $dynamic_css Astra Dynamic CSS.
* @param string $dynamic_css_filtered Astra Dynamic CSS Filters.
* @return string
*/
function astra_scroll_to_top_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) {
if ( true !== astra_get_option( 'scroll-to-top-enable', true ) ) {
return $dynamic_css;
}
$link_color = astra_get_option( 'link-color' );
$scroll_to_top_icon_size = astra_get_option( 'scroll-to-top-icon-size', 15 );
$scroll_to_top_icon_radius_fields = astra_get_option( 'scroll-to-top-icon-radius-fields' );
$scroll_to_top_icon_color = astra_get_option( 'scroll-to-top-icon-color' );
$scroll_to_top_icon_h_color = astra_get_option( 'scroll-to-top-icon-h-color' );
$scroll_to_top_icon_bg_color = astra_get_option( 'scroll-to-top-icon-bg-color', $link_color );
$scroll_to_top_icon_h_bg_color = astra_get_option( 'scroll-to-top-icon-h-bg-color' );
$scroll_to_top = array(
'#ast-scroll-top' => array(
'color' => $scroll_to_top_icon_color,
'background-color' => $scroll_to_top_icon_bg_color,
'font-size' => astra_get_css_value( $scroll_to_top_icon_size, 'px' ),
'border-top-left-radius' => astra_responsive_spacing( $scroll_to_top_icon_radius_fields, 'top', 'desktop' ),
'border-top-right-radius' => astra_responsive_spacing( $scroll_to_top_icon_radius_fields, 'right', 'desktop' ),
'border-bottom-right-radius' => astra_responsive_spacing( $scroll_to_top_icon_radius_fields, 'bottom', 'desktop' ),
'border-bottom-left-radius' => astra_responsive_spacing( $scroll_to_top_icon_radius_fields, 'left', 'desktop' ),
),
'#ast-scroll-top:hover' => array(
'color' => $scroll_to_top_icon_h_color,
'background-color' => $scroll_to_top_icon_h_bg_color,
),
);
$scroll_css = astra_parse_css( $scroll_to_top );
$scroll_to_top_tablet = array(
'#ast-scroll-top' => array(
'border-top-left-radius' => astra_responsive_spacing( $scroll_to_top_icon_radius_fields, 'top', 'tablet' ),
'border-top-right-radius' => astra_responsive_spacing( $scroll_to_top_icon_radius_fields, 'right', 'tablet' ),
'border-bottom-right-radius' => astra_responsive_spacing( $scroll_to_top_icon_radius_fields, 'bottom', 'tablet' ),
'border-bottom-left-radius' => astra_responsive_spacing( $scroll_to_top_icon_radius_fields, 'left', 'tablet' ),
),
);
/* Parse CSS from array() -> max-width: (tablet-breakpoint) px CSS */
$scroll_css .= astra_parse_css( $scroll_to_top_tablet, '', astra_get_tablet_breakpoint() );
$scroll_to_top_mobile = array(
'#ast-scroll-top' => array(
'border-top-left-radius' => astra_responsive_spacing( $scroll_to_top_icon_radius_fields, 'top', 'mobile' ),
'border-top-right-radius' => astra_responsive_spacing( $scroll_to_top_icon_radius_fields, 'right', 'mobile' ),
'border-bottom-right-radius' => astra_responsive_spacing( $scroll_to_top_icon_radius_fields, 'bottom', 'mobile' ),
'border-bottom-left-radius' => astra_responsive_spacing( $scroll_to_top_icon_radius_fields, 'left', 'mobile' ),
),
);
/* Parse CSS from array() -> max-width: (mobile-breakpoint) px CSS */
$scroll_css .= astra_parse_css( $scroll_to_top_mobile, '', astra_get_mobile_breakpoint() );
if ( is_rtl() ) {
$scroll_to_top_rtl = array(
'#ast-scroll-top .ast-icon.icon-arrow svg' => array(
'margin-right' => '0px',
),
);
$scroll_css .= astra_parse_css( $scroll_to_top_rtl );
}
if ( false === Astra_Icons::is_svg_icons() ) {
$scroll_to_top_icon = array(
'.ast-scroll-top-icon::before' => array(
'content' => '"\e900"',
'font-family' => 'Astra',
'text-decoration' => 'inherit',
),
'.ast-scroll-top-icon' => array(
'transform' => 'rotate(180deg)',
),
);
$scroll_css .= astra_parse_css( $scroll_to_top_icon );
}
// Only if responsive devices is selected.
$svg_width = array(
/**
* Add spacing based on padded layout spacing
*/
'#ast-scroll-top .ast-icon.icon-arrow svg' => array(
'width' => '1em',
),
);
$scroll_css .= astra_parse_css( $svg_width, '', astra_get_tablet_breakpoint() );
return $dynamic_css . $scroll_css;
}

View File

@@ -0,0 +1,71 @@
<?php
/**
* Scroll to Top - Static CSS
*
* @package Astra
*
* @since 4.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
add_filter( 'astra_dynamic_theme_css', 'astra_scroll_to_top_static_css', 11 );
/**
* Scroll to Top - Static CSS
*
* @param string $dynamic_css Astra Dynamic CSS.
* @return String Generated dynamic CSS for Scroll to Top.
*
* @since 4.0.0
*/
function astra_scroll_to_top_static_css( $dynamic_css ) {
if ( true !== astra_get_option( 'scroll-to-top-enable', true ) ) {
return $dynamic_css;
}
$is_site_rtl = is_rtl() ? true : false;
$ltr_left = $is_site_rtl ? 'right' : 'left';
$ltr_right = $is_site_rtl ? 'left' : 'right';
$dynamic_css .= '
#ast-scroll-top {
display: none;
position: fixed;
text-align: center;
cursor: pointer;
z-index: 99;
width: 2.1em;
height: 2.1em;
line-height: 2.1;
color: #ffffff;
border-radius: 2px;
content: "";
outline: inherit;
}
@media (min-width: 769px) {
#ast-scroll-top {
content: "769";
}
}
#ast-scroll-top .ast-icon.icon-arrow svg {
margin-' . esc_attr( $ltr_left ) . ': 0px;
vertical-align: middle;
transform: translate(0, -20%) rotate(180deg);
width: 1.6em;
}
.ast-scroll-to-top-right {
' . esc_attr( $ltr_right ) . ': 30px;
bottom: 30px;
}
.ast-scroll-to-top-left {
' . esc_attr( $ltr_left ) . ': 30px;
bottom: 30px;
}
';
return $dynamic_css;
}