summaryrefslogtreecommitdiff
path: root/inc/core
diff options
context:
space:
mode:
authorZach van Rijn <me@zv.io>2021-07-21 16:19:29 -0500
committerZach van Rijn <me@zv.io>2021-07-21 16:19:29 -0500
commit69c17f9c1942fd0d6a5ea941636e87723b8a6fe2 (patch)
treee1d0212147048204b0eede0aa6ff79849ed479da /inc/core
parent74a7109a2a5ab0d191f26c917ae69e46f0d83b32 (diff)
downloadblog-ng-69c17f9c1942fd0d6a5ea941636e87723b8a6fe2.tar.gz
blog-ng-69c17f9c1942fd0d6a5ea941636e87723b8a6fe2.tar.bz2
blog-ng-69c17f9c1942fd0d6a5ea941636e87723b8a6fe2.tar.xz
blog-ng-69c17f9c1942fd0d6a5ea941636e87723b8a6fe2.zip
dos2unix on all .php files, begin paring down admin page and site branding.
Diffstat (limited to 'inc/core')
-rw-r--r--inc/core/builder/class-astra-builder-options.php4
-rw-r--r--inc/core/class-astra-admin-helper.php174
-rw-r--r--inc/core/class-astra-admin-settings.php2385
-rw-r--r--inc/core/class-astra-attr.php230
-rw-r--r--inc/core/class-astra-enqueue-scripts.php778
-rw-r--r--inc/core/class-astra-theme-options.php1060
-rw-r--r--inc/core/class-astra-walker-page.php274
-rw-r--r--inc/core/class-gutenberg-editor-css.php2232
-rw-r--r--inc/core/class-theme-strings.php216
-rw-r--r--inc/core/common-functions.php3052
-rw-r--r--inc/core/deprecated/deprecated-filters.php174
-rw-r--r--inc/core/deprecated/deprecated-functions.php290
-rw-r--r--inc/core/deprecated/deprecated-hooks.php68
-rw-r--r--inc/core/index.php18
-rw-r--r--inc/core/sidebar-manager.php164
-rw-r--r--inc/core/theme-hooks.php998
-rw-r--r--inc/core/view-general.php90
17 files changed, 5829 insertions, 6378 deletions
diff --git a/inc/core/builder/class-astra-builder-options.php b/inc/core/builder/class-astra-builder-options.php
index 4046448..f0cfc32 100644
--- a/inc/core/builder/class-astra-builder-options.php
+++ b/inc/core/builder/class-astra-builder-options.php
@@ -1045,7 +1045,7 @@ function prepare_button_defaults( $defaults, $index ) {
$defaults[ 'header-' . $_prefix . '-text' ] = __( 'Button', 'astra' );
$defaults[ 'header-' . $_prefix . '-link-option' ] = array(
- 'url' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ),
+ 'url' => apply_filters( 'astra_site_url', 'https://www.adelielinux.org/' ),
'new_tab' => false,
'link_rel' => '',
);
@@ -1126,7 +1126,7 @@ function prepare_button_defaults( $defaults, $index ) {
$defaults[ 'footer-' . $_prefix . '-text' ] = __( 'Button', 'astra' );
$defaults[ 'footer-' . $_prefix . '-link-option' ] = array(
- 'url' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ),
+ 'url' => apply_filters( 'astra_site_url', 'https://www.adelielinux.org/' ),
'new_tab' => false,
'link_rel' => '',
);
diff --git a/inc/core/class-astra-admin-helper.php b/inc/core/class-astra-admin-helper.php
index ea35e7d..1763fff 100644
--- a/inc/core/class-astra-admin-helper.php
+++ b/inc/core/class-astra-admin-helper.php
@@ -1,87 +1,87 @@
-<?php
-/**
- * Admin settings helper
- *
- * @link https://developer.wordpress.org/themes/basics/theme-functions/
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-if ( ! class_exists( 'Astra_Admin_Helper' ) ) :
-
- /**
- * Admin Helper
- */
- final class Astra_Admin_Helper {
-
- /**
- * Returns an option from the database for
- * the admin settings page.
- *
- * @param string $key The option key.
- * @param boolean $network Whether to allow the network admin setting to be overridden on subsites.
- * @return string Return the option value
- */
- public static function get_admin_settings_option( $key, $network = false ) {
-
- // Get the site-wide option if we're in the network admin.
- if ( $network && is_multisite() ) {
- $value = get_site_option( $key );
- } else {
- $value = get_option( $key );
- }
-
- return $value;
- }
-
- /**
- * Updates an option from the admin settings page.
- *
- * @param string $key The option key.
- * @param mixed $value The value to update.
- * @param bool $network Whether to allow the network admin setting to be overridden on subsites.
- * @return mixed
- */
- public static function update_admin_settings_option( $key, $value, $network = false ) {
-
- // Update the site-wide option since we're in the network admin.
- if ( $network && is_multisite() ) {
- update_site_option( $key, $value );
- } else {
- update_option( $key, $value );
- }
-
- }
-
- /**
- * Returns an option from the database for
- * the admin settings page.
- *
- * @param string $key The option key.
- * @param bool $network Whether to allow the network admin setting to be overridden on subsites.
- * @return mixed
- */
- public static function delete_admin_settings_option( $key, $network = false ) {
-
- // Get the site-wide option if we're in the network admin.
- if ( $network && is_multisite() ) {
- $value = delete_site_option( $key );
- } else {
- $value = delete_option( $key );
- }
-
- return $value;
- }
-
- }
-
-
-endif;
+<?php
+/**
+ * Admin settings helper
+ *
+ * @link https://developer.wordpress.org/themes/basics/theme-functions/
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+if ( ! class_exists( 'Astra_Admin_Helper' ) ) :
+
+ /**
+ * Admin Helper
+ */
+ final class Astra_Admin_Helper {
+
+ /**
+ * Returns an option from the database for
+ * the admin settings page.
+ *
+ * @param string $key The option key.
+ * @param boolean $network Whether to allow the network admin setting to be overridden on subsites.
+ * @return string Return the option value
+ */
+ public static function get_admin_settings_option( $key, $network = false ) {
+
+ // Get the site-wide option if we're in the network admin.
+ if ( $network && is_multisite() ) {
+ $value = get_site_option( $key );
+ } else {
+ $value = get_option( $key );
+ }
+
+ return $value;
+ }
+
+ /**
+ * Updates an option from the admin settings page.
+ *
+ * @param string $key The option key.
+ * @param mixed $value The value to update.
+ * @param bool $network Whether to allow the network admin setting to be overridden on subsites.
+ * @return mixed
+ */
+ public static function update_admin_settings_option( $key, $value, $network = false ) {
+
+ // Update the site-wide option since we're in the network admin.
+ if ( $network && is_multisite() ) {
+ update_site_option( $key, $value );
+ } else {
+ update_option( $key, $value );
+ }
+
+ }
+
+ /**
+ * Returns an option from the database for
+ * the admin settings page.
+ *
+ * @param string $key The option key.
+ * @param bool $network Whether to allow the network admin setting to be overridden on subsites.
+ * @return mixed
+ */
+ public static function delete_admin_settings_option( $key, $network = false ) {
+
+ // Get the site-wide option if we're in the network admin.
+ if ( $network && is_multisite() ) {
+ $value = delete_site_option( $key );
+ } else {
+ $value = delete_option( $key );
+ }
+
+ return $value;
+ }
+
+ }
+
+
+endif;
diff --git a/inc/core/class-astra-admin-settings.php b/inc/core/class-astra-admin-settings.php
index bcdab75..c966042 100644
--- a/inc/core/class-astra-admin-settings.php
+++ b/inc/core/class-astra-admin-settings.php
@@ -1,1467 +1,918 @@
-<?php
-/**
- * Admin settings helper
- *
- * @link https://developer.wordpress.org/themes/basics/theme-functions/
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-if ( ! class_exists( 'Astra_Admin_Settings' ) ) {
-
- /**
- * Astra Admin Settings
- */
- class Astra_Admin_Settings {
-
- /**
- * Menu page title
- *
- * @since 1.0
- * @var array $menu_page_title
- */
- public static $menu_page_title;
-
- /**
- * Page title
- *
- * @since 1.0
- * @var array $page_title
- */
- public static $page_title = 'Astra';
-
- /**
- * Plugin slug
- *
- * @since 1.0
- * @var array $plugin_slug
- */
- public static $plugin_slug = 'astra';
-
- /**
- * Default Menu position
- *
- * @since 1.0
- * @var array $default_menu_position
- */
- public static $default_menu_position = 'themes.php';
-
- /**
- * Parent Page Slug
- *
- * @since 1.0
- * @var array $parent_page_slug
- */
- public static $parent_page_slug = 'general';
-
- /**
- * Current Slug
- *
- * @since 1.0
- * @var array $current_slug
- */
- public static $current_slug = 'general';
-
- /**
- * Starter Templates Slug
- *
- * @since 2.3.2
- * @var array $starter_templates_slug
- */
- public static $starter_templates_slug = 'astra-sites';
-
- /**
- * Constructor
- */
- public function __construct() {
-
- if ( ! is_admin() ) {
- return;
- }
-
- self::get_starter_templates_slug();
-
- add_action( 'after_setup_theme', __CLASS__ . '::init_admin_settings', 99 );
- }
-
- /**
- * Admin settings init
- */
- public static function init_admin_settings() {
- self::$menu_page_title = apply_filters( 'astra_menu_page_title', __( 'Astra Options', 'astra' ) );
- self::$page_title = apply_filters( 'astra_page_title', __( 'Astra', 'astra' ) );
- self::$plugin_slug = self::get_theme_page_slug();
-
- add_action( 'admin_enqueue_scripts', __CLASS__ . '::register_scripts' );
-
- if ( ! is_customize_preview() ) {
- // add css on the admin init action to resolve the error in the PWA service worker js.
- add_action( 'admin_head', __CLASS__ . '::admin_submenu_css' );
- }
-
- $requested_page = isset( $_REQUEST['page'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) : '';// phpcs:ignore WordPress.Security.NonceVerification.Recommended
-
- if ( strpos( $requested_page, self::$plugin_slug ) !== false ) {
-
- add_action( 'admin_enqueue_scripts', __CLASS__ . '::styles_scripts' );
-
- // Let extensions hook into saving.
- do_action( 'astra_admin_settings_scripts' );
-
- if ( defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, '2.5.0', '<' ) ) {
- self::save_settings();
- }
- }
-
- add_action( 'customize_controls_enqueue_scripts', __CLASS__ . '::customizer_scripts' );
-
- add_action( 'admin_menu', __CLASS__ . '::add_admin_menu', 99 );
-
- add_action( 'astra_menu_general_action', __CLASS__ . '::general_page' );
-
- add_action( 'astra_header_right_section', __CLASS__ . '::top_header_right_section' );
-
- add_action( 'astra_welcome_page_right_sidebar_content', __CLASS__ . '::astra_welcome_page_starter_sites_section', 10 );
- add_action( 'astra_welcome_page_right_sidebar_content', __CLASS__ . '::external_important_links_section', 11 );
-
- add_action( 'astra_welcome_page_content', __CLASS__ . '::astra_welcome_page_content' );
- add_action( 'astra_welcome_page_content', __class__ . '::astra_available_plugins', 30 );
-
- // AJAX.
- add_action( 'wp_ajax_astra-sites-plugin-activate', __CLASS__ . '::required_plugin_activate' );
- add_action( 'wp_ajax_astra-sites-plugin-deactivate', __CLASS__ . '::required_plugin_deactivate' );
-
- add_action( 'admin_init', __CLASS__ . '::register_notices' );
- add_action( 'astra_notice_before_markup', __CLASS__ . '::notice_assets' );
-
- add_action( 'admin_init', __CLASS__ . '::minimum_addon_version_notice' );
- }
-
- /**
- * Save All admin settings here
- */
- public static function save_settings() {
-
- // Only admins can save settings.
- if ( ! current_user_can( 'manage_options' ) ) {
- return;
- }
-
- // Let extensions hook into saving.
- do_action( 'astra_admin_settings_save' );
- }
-
- /**
- * Theme options page Slug getter including White Label string.
- *
- * @since 2.1.0
- * @return string Theme Options Page Slug.
- */
- public static function get_theme_page_slug() {
- return apply_filters( 'astra_theme_page_slug', self::$plugin_slug );
- }
-
- /**
- * Ask Theme Rating
- *
- * @since 1.4.0
- */
- public static function register_notices() {
- // Return if white labeled.
- if ( astra_is_white_labelled() ) {
- return;
- }
-
- // Force Astra welcome notice on theme activation.
- if ( current_user_can( 'install_plugins' ) && ! defined( 'ASTRA_SITES_NAME' ) && '1' == get_option( 'fresh_site' ) ) {
-
- wp_enqueue_script( 'astra-admin-settings' );
- $image_path = ASTRA_THEME_URI . 'inc/assets/images/astra-logo.svg';
- $ast_sites_notice_btn = self::astra_sites_notice_button();
-
- if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
- $ast_sites_notice_btn['button_text'] = __( 'Get Started', 'astra' );
- $ast_sites_notice_btn['class'] .= ' button button-primary button-hero';
- } elseif ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
- $ast_sites_notice_btn['button_text'] = __( 'Get Started', 'astra' );
- $ast_sites_notice_btn['class'] .= ' button button-primary button-hero';
- // Astra Premium Sites - Active.
- } else {
- $ast_sites_notice_btn['class'] = ' button button-primary button-hero astra-notice-close';
- }
-
- $astra_sites_notice_args = array(
- 'id' => 'astra-sites-on-active',
- 'type' => 'info',
- 'message' => sprintf(
- '<div class="notice-image">
- <img src="%1$s" class="custom-logo" alt="Astra" itemprop="logo"></div>
- <div class="notice-content">
- <h2 class="notice-heading">
- %2$s
- </h2>
- <p>%3$s</p>
- <div class="astra-review-notice-container">
- <a class="%4$s" %5$s %6$s %7$s %8$s %9$s %10$s> %11$s </a>
- </div>
- </div>',
- $image_path,
- __( 'Thank you for installing Astra!', 'astra' ),
- __( 'Did you know Astra comes with dozens of ready-to-use <a href="https://wpastra.com/starter-templates/?utm_source=install-notice">starter templates</a>? Install the Starter Templates plugin to get started.', 'astra' ),
- esc_attr( $ast_sites_notice_btn['class'] ),
- 'href="' . astra_get_prop( $ast_sites_notice_btn, 'link', '' ) . '"',
- 'data-slug="' . astra_get_prop( $ast_sites_notice_btn, 'data_slug', '' ) . '"',
- 'data-init="' . astra_get_prop( $ast_sites_notice_btn, 'data_init', '' ) . '"',
- 'data-settings-link-text="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link_text', '' ) . '"',
- 'data-settings-link="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link', '' ) . '"',
- 'data-activating-text="' . astra_get_prop( $ast_sites_notice_btn, 'activating_text', '' ) . '"',
- esc_html( $ast_sites_notice_btn['button_text'] )
- ),
- 'priority' => 5,
- 'display-with-other-notices' => false,
- 'show_if' => class_exists( 'Astra_Ext_White_Label_Markup' ) ? Astra_Ext_White_Label_Markup::show_branding() : true,
- );
-
- Astra_Notices::add_notice(
- $astra_sites_notice_args
- );
- }
- }
-
- /**
- * Display notice for minimun version for Astra addon.
- *
- * @since 2.0.0
- */
- public static function minimum_addon_version_notice() {
-
- if ( ! defined( 'ASTRA_EXT_VER' ) ) {
- return;
- }
-
- if ( version_compare( ASTRA_EXT_VER, ASTRA_EXT_MIN_VER ) < 0 ) {
-
- $message = sprintf(
- /* translators: %1$1s: Theme Name, %2$2s: Minimum Required version of the addon */
- __( 'Please update the %1$1s to version %2$2s or higher. Ignore if already updated.', 'astra' ),
- astra_get_addon_name(),
- ASTRA_EXT_MIN_VER
- );
-
- $min_version = get_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', true );
-
- if ( ! $min_version ) {
- update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER );
- }
-
- if ( version_compare( $min_version, ASTRA_EXT_MIN_VER, '!=' ) ) {
- delete_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice' );
- update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER );
- }
-
- $notice_args = array(
- 'id' => 'ast-minimum-addon-version-notice',
- 'type' => 'warning',
- 'message' => $message,
- 'show_if' => true,
- 'repeat-notice-after' => false,
- 'priority' => 18,
- 'display-with-other-notices' => true,
- );
-
- Astra_Notices::add_notice( $notice_args );
- }
- }
-
- /**
- * Enqueue Astra Notices CSS.
- *
- * @since 2.0.0
- *
- * @return void
- */
- public static function notice_assets() {
- if ( is_rtl() ) {
- wp_enqueue_style( 'astra-notices-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-notices-rtl.css', array(), ASTRA_THEME_VERSION );
- } else {
- wp_enqueue_style( 'astra-notices', ASTRA_THEME_URI . 'inc/assets/css/astra-notices.css', array(), ASTRA_THEME_VERSION );
- }
- }
-
- /**
- * Render button for Astra Site notices
- *
- * @since 1.6.5
- * @return array $ast_sites_notice_btn Rendered button
- */
- public static function astra_sites_notice_button() {
-
- $ast_sites_notice_btn = array();
-
- // Any of the Starter Templtes plugin - Active.
- if ( is_plugin_active( 'astra-pro-sites/astra-pro-sites.php' ) || is_plugin_active( 'astra-sites/astra-sites.php' ) ) {
- $ast_sites_notice_btn['class'] = 'active';
- $ast_sites_notice_btn['button_text'] = __( 'See Library &#187;', 'astra' );
- $ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
-
- return $ast_sites_notice_btn;
- }
-
- // Starter Templates PRO Plugin - Installed but Inactive.
- if ( file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
- $ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin';
- $ast_sites_notice_btn['button_text'] = __( 'Activate Importer Plugin', 'astra' );
- $ast_sites_notice_btn['data_slug'] = 'astra-pro-sites';
- $ast_sites_notice_btn['data_init'] = '/astra-pro-sites/astra-pro-sites.php';
- $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
- $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library &#187;', 'astra' );
- $ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '&hellip;';
-
- return $ast_sites_notice_btn;
- }
-
- // Starter Templates FREE Plugin - Installed but Inactive.
- if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-sites.php' ) ) {
- $ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin';
- $ast_sites_notice_btn['button_text'] = __( 'Activate Importer Plugin', 'astra' );
- $ast_sites_notice_btn['data_slug'] = 'astra-sites';
- $ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php';
- $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
- $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library &#187;', 'astra' );
- $ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '&hellip;';
-
- return $ast_sites_notice_btn;
- }
-
- // Any of the Starter Templates plugin not available.
- if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) || ! file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) ) {
- $ast_sites_notice_btn['class'] = 'astra-install-recommended-plugin';
- $ast_sites_notice_btn['button_text'] = __( 'Install Importer Plugin', 'astra' );
- $ast_sites_notice_btn['data_slug'] = 'astra-sites';
- $ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php';
- $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
- $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library &#187;', 'astra' );
- $ast_sites_notice_btn['detail_link_class'] = 'plugin-detail thickbox open-plugin-details-modal astra-starter-sites-detail-link';
- $ast_sites_notice_btn['detail_link'] = network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=astra-sites&TB_iframe=true&width=772&height=400' );
- $ast_sites_notice_btn['detail_link_text'] = __( 'Details &#187;', 'astra' );
-
- return $ast_sites_notice_btn;
- }
-
- $ast_sites_notice_btn['class'] = 'active';
- $ast_sites_notice_btn['button_text'] = __( 'See Library &#187;', 'astra' );
- $ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
-
- return $ast_sites_notice_btn;
- }
-
- /**
- * Check if installed Starter Sites plugin is new.
- *
- * @since 2.3.2
- */
- public static function get_starter_templates_slug() {
-
- if ( defined( 'ASTRA_PRO_SITES_VER' ) && version_compare( ASTRA_PRO_SITES_VER, '2.0.0', '>=' ) ) {
- self::$starter_templates_slug = 'starter-templates';
- }
-
- if ( defined( 'ASTRA_SITES_VER' ) && version_compare( ASTRA_SITES_VER, '2.0.0', '>=' ) ) {
- self::$starter_templates_slug = 'starter-templates';
- }
- }
-
- /**
- * Load the scripts and styles in the customizer controls.
- *
- * @since 1.2.1
- */
- public static function customizer_scripts() {
- $color_palettes = wp_json_encode( astra_color_palette() );
- wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $color_palettes . ';' );
- }
-
- /**
- * Register admin scripts.
- *
- * @param String $hook Screen name where the hook is fired.
- * @return void
- */
- public static function register_scripts( $hook ) {
-
- if ( in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) {
- $post_types = get_post_types( array( 'public' => true ) );
- $screen = get_current_screen();
- $post_type = $screen->id;
-
- if ( in_array( $post_type, (array) $post_types ) ) {
-
- echo '<style class="astra-meta-box-style">
- .block-editor-page #side-sortables #astra_settings_meta_box select { min-width: 84%; padding: 3px 24px 3px 8px; height: 20px; }
- .block-editor-page #normal-sortables #astra_settings_meta_box select { min-width: 200px; }
- .block-editor-page .edit-post-meta-boxes-area #poststuff #astra_settings_meta_box h2.hndle { border-bottom: 0; }
- .block-editor-page #astra_settings_meta_box .components-base-control__field, .block-editor-page #astra_settings_meta_box .block-editor-page .transparent-header-wrapper, .block-editor-page #astra_settings_meta_box .adv-header-wrapper, .block-editor-page #astra_settings_meta_box .stick-header-wrapper, .block-editor-page #astra_settings_meta_box .disable-section-meta div { margin-bottom: 8px; }
- .block-editor-page #astra_settings_meta_box .disable-section-meta div label { vertical-align: inherit; }
- .block-editor-page #astra_settings_meta_box .post-attributes-label-wrapper { margin-bottom: 4px; }
- #side-sortables #astra_settings_meta_box select { min-width: 100%; }
- #normal-sortables #astra_settings_meta_box select { min-width: 200px; }
- </style>';
- }
- }
- /* Add CSS for the Submenu for BSF plugins added in Appearance Menu */
-
- if ( ! is_customize_preview() ) {
-
- if ( ! current_user_can( 'manage_options' ) ) {
- return;
- }
-
- wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false );
-
- $localize = array(
- 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
- 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '&hellip;',
- 'astraSitesLink' => admin_url( 'themes.php?page=' ),
- 'astraSitesLinkTitle' => __( 'See Library &#187;', 'astra' ),
- 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '&hellip;',
- 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '&hellip;',
- 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ),
- 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ),
- 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ),
- 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ),
- );
-
- wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) );
- }
- }
-
- /**
- * Enqueues the needed CSS/JS for the builder's admin settings page.
- *
- * @since 1.0
- */
- public static function styles_scripts() {
-
- // Styles.
- if ( is_rtl() ) {
- wp_enqueue_style( 'astra-admin-settings-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings-rtl.css', array(), ASTRA_THEME_VERSION );
- } else {
- wp_enqueue_style( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings.css', array(), ASTRA_THEME_VERSION );
- }
-
- if ( ! current_user_can( 'manage_options' ) ) {
- return;
- }
-
- wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false );
-
- $localize = array(
- 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
- 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '&hellip;',
- 'astraSitesLink' => admin_url( 'themes.php?page=' ),
- 'astraSitesLinkTitle' => __( 'See Library &#187;', 'astra' ),
- 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '&hellip;',
- 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '&hellip;',
- 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ),
- 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ),
- 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ),
- 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ),
- 'ajax_nonce' => wp_create_nonce( 'astra-builder-module-nonce' ),
- 'old_header_footer' => __( 'Use Old Header/Footer', 'astra' ),
- 'migrate_to_builder' => __( 'Use New Header/Footer Builder', 'astra' ),
- );
- wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) );
-
- // Script.
- wp_enqueue_script( 'astra-admin-settings' );
-
- if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
- // For starter site plugin popup detail "Details &#187;" on Astra Options page.
- wp_enqueue_script( 'plugin-install' );
- wp_enqueue_script( 'thickbox' );
- wp_enqueue_style( 'thickbox' );
- }
- }
-
-
- /**
- * Get and return page URL
- *
- * @param string $menu_slug Menu name.
- * @since 1.0
- * @return string page url
- */
- public static function get_page_url( $menu_slug ) {
-
- $parent_page = self::$default_menu_position;
-
- if ( strpos( $parent_page, '?' ) !== false ) {
- $query_var = '&page=' . self::$plugin_slug;
- } else {
- $query_var = '?page=' . self::$plugin_slug;
- }
-
- $parent_page_url = admin_url( $parent_page . $query_var );
-
- $url = $parent_page_url . '&action=' . $menu_slug;
-
- return esc_url( $url );
- }
-
- /**
- * Add main menu
- *
- * @since 1.0
- */
- public static function add_admin_menu() {
-
- $parent_page = self::$default_menu_position;
- $page_title = self::$menu_page_title;
- $capability = 'manage_options';
- $page_menu_slug = self::$plugin_slug;
- $page_menu_func = __CLASS__ . '::menu_callback';
-
- if ( apply_filters( 'astra_dashboard_admin_menu', true ) ) {
- add_theme_page( $page_title, $page_title, $capability, $page_menu_slug, $page_menu_func );
- } else {
- do_action( 'asta_register_admin_menu', $parent_page, $page_title, $capability, $page_menu_slug, $page_menu_func );
- }
- }
-
- /**
- * Menu callback
- *
- * @since 1.0
- */
- public static function menu_callback() {
-
- $current_slug = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : self::$current_slug; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
-
- $current_slug = str_replace( '-', '_', $current_slug );
-
- $ast_icon = apply_filters( 'astra_page_top_icon', true );
- $ast_visit_site_url = apply_filters( 'astra_site_url', 'https://wpastra.com' );
- $ast_wrapper_class = apply_filters( 'astra_welcome_wrapper_class', array( $current_slug ) );
-
- ?>
- <div class="ast-menu-page-wrapper wrap ast-clear <?php echo esc_attr( implode( ' ', $ast_wrapper_class ) ); ?>">
- <div class="ast-theme-page-header">
- <div class="ast-container ast-flex">
- <div class="ast-theme-title">
- <a href="<?php echo esc_url( $ast_visit_site_url ); ?>" target="_blank" rel="noopener" >
- <?php if ( $ast_icon ) { ?>
- <img src="<?php echo esc_url( ASTRA_THEME_URI . 'inc/assets/images/astra.svg' ); ?>" class="ast-theme-icon" alt="<?php echo esc_attr( self::$page_title ); ?> " >
- <span class="astra-theme-version"><?php echo esc_html( ASTRA_THEME_VERSION ); ?></span>
- <?php } ?>
- <?php do_action( 'astra_welcome_page_header_title' ); ?>
- </a>
- </div>
-
- <?php do_action( 'astra_header_right_section' ); ?>
-
- </div>
- </div>
-
- <?php do_action( 'astra_menu_' . esc_attr( $current_slug ) . '_action' ); ?>
- </div>
- <?php
- }
-
- /**
- * Include general page
- *
- * @since 1.0
- */
- public static function general_page() {
- require_once ASTRA_THEME_DIR . 'inc/core/view-general.php';// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
- }
-
- /**
- * External links through Astra Options page.
- *
- * @since 3.4.0
- */
- public static function external_important_links_section() {
-
- if ( astra_is_white_labelled() ) {
- return;
- }
- ?>
-
- <div class="postbox">
- <h2 class="hndle ast-normal-cursor">
- <span><?php echo esc_html( apply_filters( 'astra_other_links_postbox_title', __( 'Important Links', 'astra' ) ) ); ?></span>
- </h2>
- <div class="inside">
- <ul class="ast-other-links-list">
- <li>
- <span class="dashicons dashicons-admin-home"></span>
- <a href="https://wpastra.com/" target="_blank" rel="noopener"> <?php esc_html_e( 'Astra Website', 'astra' ); ?> </a>
- </li>
- <li>
- <span class="dashicons dashicons-book"></span>
- <a href="https://wpastra.com/docs/?utm_campaign=welcome-page" target="_blank" rel="noopener"> <?php esc_html_e( 'Knowledge Base', 'astra' ); ?> </a>
- </li>
- <li>
- <span class="dashicons dashicons-sos"></span>
- <a href="https://wpastra.com/contact/?utm_campaign=welcome-page" target="_blank" rel="noopener"> <?php esc_html_e( 'Five Star Support', 'astra' ); ?> </a>
- </li>
- <li>
- <span class="dashicons dashicons-groups"></span>
- <a href="https://www.facebook.com/groups/wpastra" target="_blank" rel="noopener"> <?php esc_html_e( 'Users Community Group', 'astra' ); ?> </a>
- </li>
- <li>
- <span class="dashicons dashicons-star-filled"></span>
- <a href="https://wordpress.org/support/theme/astra/reviews/?rate=5#new-post" target="_blank" rel="noopener"> <?php esc_html_e( 'Rate Us ★★★★★', 'astra' ); ?> </a>
- </li>
- </ul>
- </div>
- </div>
-
- <?php
- }
-
- /**
- * Starter Templates Post Box Title.
- *
- * @since 3.4.0
- *
- * @return string Starter Templates Plugin name.
- */
- public static function get_starter_templates_title() {
-
- $astra_sites_name = __( '150+ Starter Templates', 'astra' );
-
- if ( method_exists( 'Astra_Ext_White_Label_Markup', 'get_whitelabel_string' ) ) {
- $white_labelled_astra_sites_name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
- if ( ! empty( $white_labelled_astra_sites_name ) ) {
- $astra_sites_name = $white_labelled_astra_sites_name;
- }
- }
-
- return $astra_sites_name;
- }
-
- /**
- * Include Welcome page right starter sites content
- *
- * @since 1.2.4
- */
- public static function astra_welcome_page_starter_sites_section() {
-
- if ( astra_is_white_labelled() ) {
- return;
- }
- ?>
-
- <div class="postbox">
- <h2 class="hndle ast-normal-cursor">
- <span class="dashicons dashicons-admin-customizer"></span>
- <span><?php echo self::get_starter_templates_title(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
- </h2>
- <img class="ast-starter-sites-img" alt="Starter Templates" src="<?php echo esc_url( ASTRA_THEME_URI . 'assets/images/astra-starter-sites.jpg' ); ?>">
- <div class="inside">
- <p>
- <?php
- $astra_starter_sites_doc_link = apply_filters( 'astra_starter_sites_documentation_link', astra_get_pro_url( 'https://wpastra.com/starter-templates', 'astra-dashboard', 'astra-starter-templates', 'astra-options-page' ) );
- $astra_starter_sites_doc_link_text = apply_filters( 'astra_starter_sites_doc_link_text', __( 'Starter Templates?', 'astra' ) );
- printf(
- /* translators: %1$s: Starter site link. */
- esc_html__( 'Did you know %1$s offers a free library of %2$s ', 'astra' ),
- self::$page_title,
- ! empty( $astra_starter_sites_doc_link ) ? '<a href=' . esc_url( $astra_starter_sites_doc_link ) . ' target="_blank" rel="noopener">' . esc_html( $astra_starter_sites_doc_link_text ) . '</a>' :
- esc_html( $astra_starter_sites_doc_link_text )
- );
- ?>
- </p>
- <p>
- <?php
- esc_html_e( 'Choose from over 150 beautiful templates and kickstart your project!', 'astra' );
- ?>
- </p>
- <?php
- $ast_sites_notice_btn = self::astra_sites_notice_button();
-
- printf(
- '<a class="%1$s" %2$s %3$s %4$s %5$s %6$s %7$s> %8$s </a>',
- esc_attr( $ast_sites_notice_btn['class'] ),
- 'href="' . esc_url( astra_get_prop( $ast_sites_notice_btn, 'link', '' ) ) . '"',
- 'data-slug="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_slug', '' ) ) . '"',
- 'data-init="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_init', '' ) ) . '"',
- 'data-settings-link-text="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_settings_link_text', '' ) ) . '"',
- 'data-settings-link="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'data_settings_link', '' ) ) . '"',
- 'data-activating-text="' . esc_attr( astra_get_prop( $ast_sites_notice_btn, 'activating_text', '' ) ) . '"',
- esc_html( $ast_sites_notice_btn['button_text'] )
- );
- printf(
- '<a class="%1$s" %2$s target="_blank" rel="noopener"> %3$s </a>',
- isset( $ast_sites_notice_btn['detail_link_class'] ) ? esc_attr( $ast_sites_notice_btn['detail_link_class'] ) : '',
- isset( $ast_sites_notice_btn['detail_link'] ) ? 'href="' . esc_url( $ast_sites_notice_btn['detail_link'] ) . '"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- isset( $ast_sites_notice_btn['detail_link_class'] ) ? esc_html( $ast_sites_notice_btn['detail_link_text'] ) : '' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- );
- ?>
- <div>
- </div>
- </div>
- </div>
-
- <?php
- }
-
- /**
- * Include Welcome page content
- *
- * @since 1.2.4
- */
- public static function astra_welcome_page_content() {
-
- $astra_addon_tagline = apply_filters( 'astra_addon_list_tagline', __( 'More Options Available with Astra Pro!', 'astra' ) );
-
- // Quick settings.
- $quick_settings = apply_filters(
- 'astra_quick_settings',
- array(
- 'header' => array(
- 'title' => __( 'Header Options', 'astra' ),
- 'dashicon' => 'dashicons-align-center',
- 'quick_url' => admin_url( 'customize.php?autofocus[panel]=panel-header-group' ),
- ),
- 'logo-favicon' => array(
- 'title' => __( 'Upload Logo', 'astra' ),
- 'dashicon' => 'dashicons-format-image',
- 'quick_url' => admin_url( 'customize.php?autofocus[control]=custom_logo' ),
- ),
- 'footer' => array(
- 'title' => __( 'Footer Settings', 'astra' ),
- 'dashicon' => 'dashicons-align-wide',
- 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-footer-group' ),
- ),
- 'colors' => array(
- 'title' => __( 'Set Colors', 'astra' ),
- 'dashicon' => 'dashicons-admin-customizer',
- 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-colors-background' ),
- ),
- 'layout' => array(
- 'title' => __( 'Layout Options', 'astra' ),
- 'dashicon' => 'dashicons-layout',
- 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-container-layout' ),
- ),
- 'typography' => array(
- 'title' => __( 'Customize Fonts', 'astra' ),
- 'dashicon' => 'dashicons-editor-textcolor',
- 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-typography' ),
- ),
- 'blog-layout' => array(
- 'title' => __( 'Blog Layouts', 'astra' ),
- 'dashicon' => 'dashicons-welcome-write-blog',
- 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-blog-group' ),
- ),
- 'sidebars' => array(
- 'title' => __( 'Sidebar Options', 'astra' ),
- 'dashicon' => 'dashicons-align-left',
- 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-sidebars' ),
- ),
- )
- );
-
- $extensions = apply_filters(
- 'astra_addon_list',
- array(
- 'colors-and-background' => array(
- 'title' => __( 'Colors & Background', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/colors-background-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/colors-background-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'typography' => array(
- 'title' => __( 'Typography', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/typography-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/typography-module/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'spacing' => array(
- 'title' => __( 'Spacing', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/spacing-addon-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/spacing-addon-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'blog-pro' => array(
- 'title' => __( 'Blog Pro', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/blog-pro-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/blog-pro-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'mobile-header' => array(
- 'title' => __( 'Mobile Header', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/mobile-header-with-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/mobile-header-with-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'header-sections' => array(
- 'title' => __( 'Header Sections', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/header-sections-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/header-sections-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'nav-menu' => array(
- 'title' => __( 'Nav Menu', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/nav-menu-addon/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/nav-menu-addon/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'sticky-header' => array(
- 'title' => __( 'Sticky Header', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/sticky-header-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/sticky-header-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'advanced-headers' => array(
- 'title' => __( 'Page Headers', 'astra' ),
- 'description' => __( 'Make your header layouts look more appealing and sexy!', 'astra' ),
- 'manage_settings' => true,
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/page-headers-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/page-headers-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'advanced-hooks' => array(
- 'title' => __( 'Custom Layouts', 'astra' ),
- // 'icon' => ASTRA_THEME_URI . 'assets/img/astra-advanced-hooks.png',
- 'description' => __( 'Add content conditionally in the various hook areas of the theme.', 'astra' ),
- 'manage_settings' => true,
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/custom-layouts-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/custom-layouts-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'site-layouts' => array(
- 'title' => __( 'Site Layouts', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/site-layout-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/site-layout-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'advanced-footer' => array(
- 'title' => __( 'Footer Widgets', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/footer-widgets-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/footer-widgets-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'scroll-to-top' => array(
- 'title' => __( 'Scroll To Top', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/scroll-to-top-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/scroll-to-top-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'woocommerce' => array(
- 'title' => __( 'WooCommerce', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/woocommerce-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/woocommerce-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'edd' => array(
- 'title' => __( 'Easy Digital Downloads', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/easy-digital-downloads-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/easy-digital-downloads-module-overview/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'learndash' => array(
- 'title' => __( 'LearnDash', 'astra' ),
- 'description' => __( 'Supercharge your LearnDash website with amazing design features.', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/learndash-integration-in-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/learndash-integration-in-astra-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'lifterlms' => array(
- 'title' => __( 'LifterLMS', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/lifterlms-module-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/lifterlms-module-pro/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- 'white-label' => array(
- 'title' => __( 'White Label', 'astra' ),
- 'class' => 'ast-addon',
- 'title_url' => astra_get_pro_url( 'https://wpastra.com/docs/how-to-white-label-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'links' => array(
- array(
- 'link_class' => 'ast-learn-more',
- 'link_url' => astra_get_pro_url( 'https://wpastra.com/docs/how-to-white-label-astra/', 'astra-dashboard', 'learn-more', 'welcome-page' ),
- 'link_text' => __( 'Learn More &#187;', 'astra' ),
- 'target_blank' => true,
- ),
- ),
- ),
- )
- );
- ?>
- <div class="postbox">
- <h2 class="hndle ast-normal-cursor"><span><?php esc_html_e( 'Links to Customizer Settings:', 'astra' ); ?></span></h2>
- <div class="ast-quick-setting-section">
- <?php
- if ( ! empty( $quick_settings ) ) :
- ?>
- <div class="ast-quick-links">
- <ul class="ast-flex">
- <?php
- foreach ( (array) $quick_settings as $key => $link ) {
- echo '<li class="' . esc_attr( $key ) . '"><span class="dashicons ' . esc_attr( $link['dashicon'] ) . '"></span><a class="ast-quick-setting-title" href="' . esc_url( $link['quick_url'] ) . '" target="_blank" rel="noopener">' . esc_html( $link['title'] ) . '</a></li>';
- }
- ?>
- </ul>
- </div>
- <?php endif; ?>
- </div>
- </div>
-
- <div class="postbox">
- <h2 class="hndle ast-normal-cursor ast-addon-heading ast-flex"><span><?php echo esc_html( $astra_addon_tagline ); ?></span>
- <?php do_action( 'astra_addon_bulk_action' ); ?>
- </h2>
- <div class="ast-addon-list-section">
- <?php
- if ( ! empty( $extensions ) ) :
- ?>
- <div>
- <ul class="ast-addon-list">
- <?php
- foreach ( (array) $extensions as $addon => $info ) {
- $title_url = ( isset( $info['title_url'] ) && ! empty( $info['title_url'] ) ) ? 'href="' . esc_url( $info['title_url'] ) . '"' : '';
- $anchor_target = ( isset( $info['title_url'] ) && ! empty( $info['title_url'] ) ) ? "target='_blank' rel='noopener'" : '';
-
- echo '<li id="' . esc_attr( $addon ) . '" class="' . esc_attr( $info['class'] ) . '"><a class="ast-addon-title"' . $title_url . $anchor_target . ' >' . esc_html( $info['title'] ) . '</a><div class="ast-addon-link-wrapper">'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
-
- foreach ( $info['links'] as $key => $link ) {
- printf(
- '<a class="%1$s" %2$s %3$s> %4$s </a>',
- esc_attr( $link['link_class'] ),
- isset( $link['link_url'] ) ? 'href="' . esc_url( $link['link_url'] ) . '"' : '',
- ( isset( $link['target_blank'] ) && $link['target_blank'] ) ? 'target="_blank" rel="noopener"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- esc_html( $link['link_text'] )
- );
- }
- echo '</div></li>';
- }
- ?>
- </ul>
- </div>
- <?php endif; ?>
- </div>
- </div>
-
- <?php
- }
-
- /**
- * Include Welcome page content
- *
- * @since 1.2.4
- */
- public static function astra_available_plugins() {
-
- // Return if white labeled.
- if ( astra_is_white_labelled() ) {
- return;
- }
-
- $astra_addon_tagline = apply_filters(
- 'astra_available_plugins',
- sprintf(
- /* translators: %1s Astra Theme */
- __( 'Extend %1s with free plugins!', 'astra' ),
- astra_get_theme_name()
- )
- );
-
- $recommended_plugins = apply_filters(
- 'astra_recommended_plugins',
- array(
- 'astra-import-export' =>
- array(
- 'plugin-name' => __( 'Import / Export Customizer Settings', 'astra' ),
- 'plugin-init' => 'astra-import-export/astra-import-export.php',
- 'settings-link' => '',
- 'settings-link-text' => 'Settings',
- ),
- 'reset-astra-customizer' =>
- array(
- 'plugin-name' => __( 'Astra Customizer Reset', 'astra' ),
- 'plugin-init' => 'reset-astra-customizer/class-astra-theme-customizer-reset.php',
- 'settings-link' => admin_url( 'customize.php' ),
- 'settings-link-text' => 'Settings',
- ),
-
- 'customizer-search' =>
- array(
- 'plugin-name' => __( 'Customizer Search', 'astra' ),
- 'plugin-init' => 'customizer-search/customizer-search.php',
- 'settings-link' => admin_url( 'customize.php' ),
- 'settings-link-text' => 'Settings',
- ),
-
- 'astra-bulk-edit' =>
- array(
- 'plugin-name' => __( 'Astra Bulk Edit', 'astra' ),
- 'plugin-init' => 'astra-bulk-edit/astra-bulk-edit.php',
- 'settings-link' => '',
- 'settings-link-text' => 'Settings',
- ),
-
- 'astra-widgets' =>
- array(
- 'plugin-name' => __( 'Astra Widgets', 'astra' ),
- 'plugin-init' => 'astra-widgets/astra-widgets.php',
- 'settings-link' => admin_url( 'widgets.php' ),
- 'settings-link-text' => 'Settings',
- ),
-
- 'custom-fonts' =>
- array(
- 'plugin-name' => __( 'Custom Fonts', 'astra' ),
- 'plugin-init' => 'custom-fonts/custom-fonts.php',
- 'settings-link' => admin_url( 'edit-tags.php?taxonomy=bsf_custom_fonts' ),
- 'settings-link-text' => 'Settings',
- ),
-
- 'custom-typekit-fonts' =>
- array(
- 'plugin-name' => __( 'Custom Typekit Fonts', 'astra' ),
- 'plugin-init' => 'custom-typekit-fonts/custom-typekit-fonts.php',
- 'settings-link' => admin_url( 'themes.php?page=custom-typekit-fonts' ),
- 'settings-link-text' => 'Settings',
- ),
-
- 'sidebar-manager' =>
- array(
- 'plugin-name' => __( 'Sidebar Manager', 'astra' ),
- 'plugin-init' => 'sidebar-manager/sidebar-manager.php',
- 'settings-link' => admin_url( 'edit.php?post_type=bsf-sidebar' ),
- 'settings-link-text' => 'Settings',
- ),
-
- 'ultimate-addons-for-gutenberg' =>
- array(
- 'plugin-name' => __( 'Ultimate Addons for Gutenberg', 'astra' ),
- 'plugin-init' => 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php',
- 'settings-link' => admin_url( 'options-general.php?page=uag' ),
- 'settings-link-text' => 'Settings',
- 'display' => function_exists( 'register_block_type' ),
- ),
- )
- );
-
- if ( apply_filters( 'astra_show_free_extend_plugins', true ) ) {
- ?>
-
- <div class="postbox">
- <h2 class="hndle ast-normal-cursor ast-addon-heading ast-flex"><span><?php echo esc_html( $astra_addon_tagline ); ?></span>
- </h2>
- <div class="ast-addon-list-section">
- <?php
- if ( ! empty( $recommended_plugins ) ) :
- ?>
- <div>
- <ul class="ast-addon-list">
- <?php
- foreach ( $recommended_plugins as $slug => $plugin ) {
-
- // If display condition for the plugin does not meet, skip the plugin from displaying.
- if ( isset( $plugin['display'] ) && false === $plugin['display'] ) {
- continue;
- }
-
- $plugin_active_status = '';
- if ( is_plugin_active( $plugin['plugin-init'] ) ) {
- $plugin_active_status = ' active';
- }
-
- echo '<li ' . astra_attr(
- 'astra-recommended-plugin-' . esc_attr( $slug ),
- array(
- 'id' => esc_attr( $slug ),
- 'class' => 'astra-recommended-plugin' . $plugin_active_status,
- 'data-slug' => $slug,
- )
- ) . '>';
-
- echo '<a href="' . esc_url( self::build_worg_plugin_link( $slug ) ) . '" target="_blank">';
- echo esc_html( $plugin['plugin-name'] );
- echo '</a>';
-
- echo '<div class="ast-addon-link-wrapper">';
-
- if ( ! is_plugin_active( $plugin['plugin-init'] ) ) {
-
- if ( file_exists( WP_CONTENT_DIR . '/plugins/' . $plugin['plugin-init'] ) ) {
- echo '<a ' . astra_attr(
- 'astra-activate-recommended-plugin',
- array(
- 'data-slug' => $slug,
- 'href' => '#',
- 'data-init' => $plugin['plugin-init'],
- 'data-settings-link' => esc_url( $plugin['settings-link'] ),
- 'data-settings-link-text' => $plugin['settings-link-text'],
- )
- ) . '>';
-
- esc_html_e( 'Activate', 'astra' );
-
- echo '</a>';
-
- } else {
-
- echo '<a ' . astra_attr(
- 'astra-install-recommended-plugin',
- array(
- 'data-slug' => $slug,
- 'href' => '#',
- 'data-init' => $plugin['plugin-init'],
- 'data-settings-link' => esc_url( $plugin['settings-link'] ),
- 'data-settings-link-text' => $plugin['settings-link-text'],
- )
- ) . '>';
-
- esc_html_e( 'Activate', 'astra' );
-
- echo '</a>';
- }
- } else {
-
- echo '<a ' . astra_attr(
- 'astra-deactivate-recommended-plugin',
- array(
- 'data-slug' => $slug,
- 'href' => '#',
- 'data-init' => $plugin['plugin-init'],
- 'data-settings-link' => esc_url( $plugin['settings-link'] ),
- 'data-settings-link-text' => $plugin['settings-link-text'],
- )
- ) . '>';
-
- esc_html_e( 'Deactivate', 'astra' );
-
- echo '</a>';
-
- if ( '' !== $plugin['settings-link'] ) {
-
- echo '<a ' . astra_attr(
- 'astra-recommended-plugin-links',
- array(
- 'data-slug' => $slug,
- 'href' => $plugin['settings-link'],
- )
- ) . '>';
-
- echo esc_html( $plugin['settings-link-text'] );
-
- echo '</a>';
- }
- }
-
- echo '</div>';
-
- echo '</li>';
- }
- ?>
- </ul>
- </div>
- <?php endif; ?>
- </div>
- </div>
-
- <?php
- }
-
- }
-
- /**
- * Build plugin's page URL on WordPress.org
- * https://wordpress.org/plugins/{plugin-slug}
- *
- * @since 1.6.9
- * @param String $slug plugin slug.
- * @return String Plugin URL on WordPress.org
- */
- private static function build_worg_plugin_link( $slug ) {
- return esc_url( trailingslashit( 'https://wordpress.org/plugins/' . $slug ) );
- }
-
- /**
- * Required Plugin Activate
- *
- * @since 1.2.4
- */
- public static function required_plugin_activate() {
-
- $nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : '';
-
- if ( false === wp_verify_nonce( $nonce, 'astra-recommended-plugin-nonce' ) ) {
- wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'astra' ) );
- }
-
- if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) {
- wp_send_json_error(
- array(
- 'success' => false,
- 'message' => __( 'No plugin specified', 'astra' ),
- )
- );
- }
-
- $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : '';
-
- $activate = activate_plugin( $plugin_init, '', false, true );
-
- if ( '/astra-pro-sites/astra-pro-sites.php' === $plugin_init || '/astra-sites/astra-sites.php' === $plugin_init ) {
- self::get_starter_templates_slug();
- }
-
- if ( is_wp_error( $activate ) ) {
- wp_send_json_error(
- array(
- 'success' => false,
- 'message' => $activate->get_error_message(),
- 'starter_template_slug' => self::$starter_templates_slug,
- )
- );
- }
-
- wp_send_json_success(
- array(
- 'success' => true,
- 'message' => __( 'Plugin Successfully Activated', 'astra' ),
- 'starter_template_slug' => self::$starter_templates_slug,
- )
- );
- }
-
- /**
- * Required Plugin Activate
- *
- * @since 1.2.4
- */
- public static function required_plugin_deactivate() {
-
- $nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : '';
-
- if ( false === wp_verify_nonce( $nonce, 'astra-recommended-plugin-nonce' ) ) {
- wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'astra' ) );
- }
-
- if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) {
- wp_send_json_error(
- array(
- 'success' => false,
- 'message' => __( 'No plugin specified', 'astra' ),
- )
- );
- }
-
- $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : '';
-
- $deactivate = deactivate_plugins( $plugin_init, '', false );
-
- if ( is_wp_error( $deactivate ) ) {
- wp_send_json_error(
- array(
- 'success' => false,
- 'message' => $deactivate->get_error_message(),
- )
- );
- }
-
- wp_send_json_success(
- array(
- 'success' => true,
- 'message' => __( 'Plugin Successfully Deactivated', 'astra' ),
- )
- );
-
- }
-
- /**
- * Astra Header Right Section Links
- *
- * @since 1.2.4
- */
- public static function top_header_right_section() {
-
- $top_links = apply_filters(
- 'astra_header_top_links',
- array(
- 'astra-theme-info' => array(
- 'title' => '<img src=" ' . ASTRA_THEME_URI . 'inc/assets/images/lightning-speed.svg" class="astra-lightning-icon" alt="Astra Lightning Speed">' . __( ' Lightning Fast & Fully Customizable WordPress theme!', 'astra' ),
- ),
- )
- );
-
- if ( ! empty( $top_links ) ) {
- ?>
- <div class="ast-top-links">
- <ul>
- <?php
- foreach ( (array) $top_links as $key => $info ) {
- /* translators: %1$s: Top Link URL wrapper, %2$s: Top Link URL, %3$s: Top Link URL target attribute */
- printf(
- '<li><%1$s %2$s %3$s > %4$s </%1$s>',
- isset( $info['url'] ) ? 'a' : 'span',
- isset( $info['url'] ) ? 'href="' . esc_url( $info['url'] ) . '"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- isset( $info['url'] ) ? 'target="_blank" rel="noopener"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- $info['title']// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- );
- }
- ?>
- </ul>
- </div>
- <?php
- }
- }
-
- /**
- * Add custom CSS for admin area sub menu icons.
- *
- * @since 2.5.4
- */
- public static function admin_submenu_css() {
-
- echo '<style class="astra-menu-appearance-style">
- #menu-appearance a[href^="edit.php?post_type=astra-"]:before,
- #menu-appearance a[href^="themes.php?page=astra-"]:before,
- #menu-appearance a[href^="edit.php?post_type=astra_"]:before,
- #menu-appearance a[href^="edit-tags.php?taxonomy=bsf_custom_fonts"]:before,
- #menu-appearance a[href^="themes.php?page=custom-typekit-fonts"]:before,
- #menu-appearance a[href^="edit.php?post_type=bsf-sidebar"]:before {
- content: "\21B3";
- margin-right: 0.5em;
- opacity: 0.5;
- }
- </style>';
-
- }
- }
-
- new Astra_Admin_Settings();
-}
+<?php
+/**
+ * Admin settings helper
+ *
+ * @link https://developer.wordpress.org/themes/basics/theme-functions/
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+if ( ! class_exists( 'Astra_Admin_Settings' ) ) {
+
+ /**
+ * Astra Admin Settings
+ */
+ class Astra_Admin_Settings {
+
+ /**
+ * Menu page title
+ *
+ * @since 1.0
+ * @var array $menu_page_title
+ */
+ public static $menu_page_title;
+
+ /**
+ * Page title
+ *
+ * @since 1.0
+ * @var array $page_title
+ */
+ public static $page_title = 'Astra';
+
+ /**
+ * Plugin slug
+ *
+ * @since 1.0
+ * @var array $plugin_slug
+ */
+ public static $plugin_slug = 'astra';
+
+ /**
+ * Default Menu position
+ *
+ * @since 1.0
+ * @var array $default_menu_position
+ */
+ public static $default_menu_position = 'themes.php';
+
+ /**
+ * Parent Page Slug
+ *
+ * @since 1.0
+ * @var array $parent_page_slug
+ */
+ public static $parent_page_slug = 'general';
+
+ /**
+ * Current Slug
+ *
+ * @since 1.0
+ * @var array $current_slug
+ */
+ public static $current_slug = 'general';
+
+ /**
+ * Starter Templates Slug
+ *
+ * @since 2.3.2
+ * @var array $starter_templates_slug
+ */
+ public static $starter_templates_slug = 'astra-sites';
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+
+ if ( ! is_admin() ) {
+ return;
+ }
+
+ self::get_starter_templates_slug();
+
+ add_action( 'after_setup_theme', __CLASS__ . '::init_admin_settings', 99 );
+ }
+
+ /**
+ * Admin settings init
+ */
+ public static function init_admin_settings() {
+ self::$menu_page_title = apply_filters( 'astra_menu_page_title', __( 'Adélie Linux Options', 'astra' ) );
+ self::$page_title = apply_filters( 'astra_page_title', __( 'Astra', 'astra' ) );
+ self::$plugin_slug = self::get_theme_page_slug();
+
+ add_action( 'admin_enqueue_scripts', __CLASS__ . '::register_scripts' );
+
+ if ( ! is_customize_preview() ) {
+ // add css on the admin init action to resolve the error in the PWA service worker js.
+ add_action( 'admin_head', __CLASS__ . '::admin_submenu_css' );
+ }
+
+ $requested_page = isset( $_REQUEST['page'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) : '';// phpcs:ignore WordPress.Security.NonceVerification.Recommended
+
+ if ( strpos( $requested_page, self::$plugin_slug ) !== false ) {
+
+ add_action( 'admin_enqueue_scripts', __CLASS__ . '::styles_scripts' );
+
+ // Let extensions hook into saving.
+ do_action( 'astra_admin_settings_scripts' );
+
+ if ( defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, '2.5.0', '<' ) ) {
+ self::save_settings();
+ }
+ }
+
+ add_action( 'customize_controls_enqueue_scripts', __CLASS__ . '::customizer_scripts' );
+
+ add_action( 'admin_menu', __CLASS__ . '::add_admin_menu', 99 );
+
+ add_action( 'astra_menu_general_action', __CLASS__ . '::general_page' );
+
+ add_action( 'astra_header_right_section', __CLASS__ . '::top_header_right_section' );
+
+ add_action( 'astra_welcome_page_right_sidebar_content', __CLASS__ . '::astra_welcome_page_starter_sites_section', 10 );
+ add_action( 'astra_welcome_page_right_sidebar_content', __CLASS__ . '::external_important_links_section', 11 );
+
+ add_action( 'astra_welcome_page_content', __CLASS__ . '::astra_welcome_page_content' );
+ add_action( 'astra_welcome_page_content', __class__ . '::astra_available_plugins', 30 );
+
+ // AJAX.
+ add_action( 'wp_ajax_astra-sites-plugin-activate', __CLASS__ . '::required_plugin_activate' );
+ add_action( 'wp_ajax_astra-sites-plugin-deactivate', __CLASS__ . '::required_plugin_deactivate' );
+
+ add_action( 'admin_init', __CLASS__ . '::register_notices' );
+ add_action( 'astra_notice_before_markup', __CLASS__ . '::notice_assets' );
+
+ add_action( 'admin_init', __CLASS__ . '::minimum_addon_version_notice' );
+ }
+
+ /**
+ * Save All admin settings here
+ */
+ public static function save_settings() {
+
+ // Only admins can save settings.
+ if ( ! current_user_can( 'manage_options' ) ) {
+ return;
+ }
+
+ // Let extensions hook into saving.
+ do_action( 'astra_admin_settings_save' );
+ }
+
+ /**
+ * Theme options page Slug getter including White Label string.
+ *
+ * @since 2.1.0
+ * @return string Theme Options Page Slug.
+ */
+ public static function get_theme_page_slug() {
+ return apply_filters( 'astra_theme_page_slug', self::$plugin_slug );
+ }
+
+ /**
+ * Ask Theme Rating
+ *
+ * @since 1.4.0
+ */
+ public static function register_notices() {
+ // Return if white labeled.
+ if ( astra_is_white_labelled() ) {
+ return;
+ }
+
+ // Force Astra welcome notice on theme activation.
+ if ( current_user_can( 'install_plugins' ) && ! defined( 'ASTRA_SITES_NAME' ) && '1' == get_option( 'fresh_site' ) ) {
+
+ wp_enqueue_script( 'astra-admin-settings' );
+ $image_path = ASTRA_THEME_URI . 'inc/assets/images/polyguin.svg';
+ $ast_sites_notice_btn = self::astra_sites_notice_button();
+
+ if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
+ $ast_sites_notice_btn['button_text'] = __( 'Get Started', 'astra' );
+ $ast_sites_notice_btn['class'] .= ' button button-primary button-hero';
+ } elseif ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
+ $ast_sites_notice_btn['button_text'] = __( 'Get Started', 'astra' );
+ $ast_sites_notice_btn['class'] .= ' button button-primary button-hero';
+ // Astra Premium Sites - Active.
+ } else {
+ $ast_sites_notice_btn['class'] = ' button button-primary button-hero astra-notice-close';
+ }
+
+ $astra_sites_notice_args = array(
+ 'id' => 'astra-sites-on-active',
+ 'type' => 'info',
+ 'message' => sprintf(
+ '<div class="notice-image">
+ <img src="%1$s" class="custom-logo" alt="Astra" itemprop="logo"></div>
+ <div class="notice-content">
+ <h2 class="notice-heading">
+ %2$s
+ </h2>
+ <p>%3$s</p>
+ <div class="astra-review-notice-container">
+ <a class="%4$s" %5$s %6$s %7$s %8$s %9$s %10$s> %11$s </a>
+ </div>
+ </div>',
+ $image_path,
+ __( 'Thank you for installing Adélie Linux WordPress Theme!', 'astra' ),
+ __( 'Did you know Astra comes with dozens of ready-to-use <a href="https://wpastra.com/starter-templates/?utm_source=install-notice">starter templates</a>? Install the Starter Templates plugin to get started.', 'astra' ),
+ esc_attr( $ast_sites_notice_btn['class'] ),
+ 'href="' . astra_get_prop( $ast_sites_notice_btn, 'link', '' ) . '"',
+ 'data-slug="' . astra_get_prop( $ast_sites_notice_btn, 'data_slug', '' ) . '"',
+ 'data-init="' . astra_get_prop( $ast_sites_notice_btn, 'data_init', '' ) . '"',
+ 'data-settings-link-text="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link_text', '' ) . '"',
+ 'data-settings-link="' . astra_get_prop( $ast_sites_notice_btn, 'data_settings_link', '' ) . '"',
+ 'data-activating-text="' . astra_get_prop( $ast_sites_notice_btn, 'activating_text', '' ) . '"',
+ esc_html( $ast_sites_notice_btn['button_text'] )
+ ),
+ 'priority' => 5,
+ 'display-with-other-notices' => false,
+ 'show_if' => class_exists( 'Astra_Ext_White_Label_Markup' ) ? Astra_Ext_White_Label_Markup::show_branding() : true,
+ );
+
+ Astra_Notices::add_notice(
+ $astra_sites_notice_args
+ );
+ }
+ }
+
+ /**
+ * Display notice for minimun version for Astra addon.
+ *
+ * @since 2.0.0
+ */
+ public static function minimum_addon_version_notice() {
+
+ if ( ! defined( 'ASTRA_EXT_VER' ) ) {
+ return;
+ }
+
+ if ( version_compare( ASTRA_EXT_VER, ASTRA_EXT_MIN_VER ) < 0 ) {
+
+ $message = sprintf(
+ /* translators: %1$1s: Theme Name, %2$2s: Minimum Required version of the addon */
+ __( 'Please update the %1$1s to version %2$2s or higher. Ignore if already updated.', 'astra' ),
+ astra_get_addon_name(),
+ ASTRA_EXT_MIN_VER
+ );
+
+ $min_version = get_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', true );
+
+ if ( ! $min_version ) {
+ update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER );
+ }
+
+ if ( version_compare( $min_version, ASTRA_EXT_MIN_VER, '!=' ) ) {
+ delete_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice' );
+ update_user_meta( get_current_user_id(), 'ast-minimum-addon-version-notice-min-ver', ASTRA_EXT_MIN_VER );
+ }
+
+ $notice_args = array(
+ 'id' => 'ast-minimum-addon-version-notice',
+ 'type' => 'warning',
+ 'message' => $message,
+ 'show_if' => true,
+ 'repeat-notice-after' => false,
+ 'priority' => 18,
+ 'display-with-other-notices' => true,
+ );
+
+ Astra_Notices::add_notice( $notice_args );
+ }
+ }
+
+ /**
+ * Enqueue Astra Notices CSS.
+ *
+ * @since 2.0.0
+ *
+ * @return void
+ */
+ public static function notice_assets() {
+ if ( is_rtl() ) {
+ wp_enqueue_style( 'astra-notices-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-notices-rtl.css', array(), ASTRA_THEME_VERSION );
+ } else {
+ wp_enqueue_style( 'astra-notices', ASTRA_THEME_URI . 'inc/assets/css/astra-notices.css', array(), ASTRA_THEME_VERSION );
+ }
+ }
+
+ /**
+ * Render button for Astra Site notices
+ *
+ * @since 1.6.5
+ * @return array $ast_sites_notice_btn Rendered button
+ */
+ public static function astra_sites_notice_button() {
+
+ $ast_sites_notice_btn = array();
+
+ // Any of the Starter Templtes plugin - Active.
+ if ( is_plugin_active( 'astra-pro-sites/astra-pro-sites.php' ) || is_plugin_active( 'astra-sites/astra-sites.php' ) ) {
+ $ast_sites_notice_btn['class'] = 'active';
+ $ast_sites_notice_btn['button_text'] = __( 'See Library &#187;', 'astra' );
+ $ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
+
+ return $ast_sites_notice_btn;
+ }
+
+ // Starter Templates PRO Plugin - Installed but Inactive.
+ if ( file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
+ $ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin';
+ $ast_sites_notice_btn['button_text'] = __( 'Activate Importer Plugin', 'astra' );
+ $ast_sites_notice_btn['data_slug'] = 'astra-pro-sites';
+ $ast_sites_notice_btn['data_init'] = '/astra-pro-sites/astra-pro-sites.php';
+ $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
+ $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library &#187;', 'astra' );
+ $ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '&hellip;';
+
+ return $ast_sites_notice_btn;
+ }
+
+ // Starter Templates FREE Plugin - Installed but Inactive.
+ if ( file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-sites/astra-sites.php' ) ) {
+ $ast_sites_notice_btn['class'] = 'astra-activate-recommended-plugin';
+ $ast_sites_notice_btn['button_text'] = __( 'Activate Importer Plugin', 'astra' );
+ $ast_sites_notice_btn['data_slug'] = 'astra-sites';
+ $ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php';
+ $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
+ $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library &#187;', 'astra' );
+ $ast_sites_notice_btn['activating_text'] = __( 'Activating Importer Plugin ', 'astra' ) . '&hellip;';
+
+ return $ast_sites_notice_btn;
+ }
+
+ // Any of the Starter Templates plugin not available.
+ if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) || ! file_exists( WP_PLUGIN_DIR . '/astra-pro-sites/astra-pro-sites.php' ) ) {
+ $ast_sites_notice_btn['class'] = 'astra-install-recommended-plugin';
+ $ast_sites_notice_btn['button_text'] = __( 'Install Importer Plugin', 'astra' );
+ $ast_sites_notice_btn['data_slug'] = 'astra-sites';
+ $ast_sites_notice_btn['data_init'] = '/astra-sites/astra-sites.php';
+ $ast_sites_notice_btn['data_settings_link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
+ $ast_sites_notice_btn['data_settings_link_text'] = __( 'See Library &#187;', 'astra' );
+ $ast_sites_notice_btn['detail_link_class'] = 'plugin-detail thickbox open-plugin-details-modal astra-starter-sites-detail-link';
+ $ast_sites_notice_btn['detail_link'] = network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=astra-sites&TB_iframe=true&width=772&height=400' );
+ $ast_sites_notice_btn['detail_link_text'] = __( 'Details &#187;', 'astra' );
+
+ return $ast_sites_notice_btn;
+ }
+
+ $ast_sites_notice_btn['class'] = 'active';
+ $ast_sites_notice_btn['button_text'] = __( 'See Library &#187;', 'astra' );
+ $ast_sites_notice_btn['link'] = admin_url( 'themes.php?page=' . self::$starter_templates_slug );
+
+ return $ast_sites_notice_btn;
+ }
+
+ /**
+ * Check if installed Starter Sites plugin is new.
+ *
+ * @since 2.3.2
+ */
+ public static function get_starter_templates_slug() {
+
+ if ( defined( 'ASTRA_PRO_SITES_VER' ) && version_compare( ASTRA_PRO_SITES_VER, '2.0.0', '>=' ) ) {
+ self::$starter_templates_slug = 'starter-templates';
+ }
+
+ if ( defined( 'ASTRA_SITES_VER' ) && version_compare( ASTRA_SITES_VER, '2.0.0', '>=' ) ) {
+ self::$starter_templates_slug = 'starter-templates';
+ }
+ }
+
+ /**
+ * Load the scripts and styles in the customizer controls.
+ *
+ * @since 1.2.1
+ */
+ public static function customizer_scripts() {
+ $color_palettes = wp_json_encode( astra_color_palette() );
+ wp_add_inline_script( 'wp-color-picker', 'jQuery.wp.wpColorPicker.prototype.options.palettes = ' . $color_palettes . ';' );
+ }
+
+ /**
+ * Register admin scripts.
+ *
+ * @param String $hook Screen name where the hook is fired.
+ * @return void
+ */
+ public static function register_scripts( $hook ) {
+
+ if ( in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) {
+ $post_types = get_post_types( array( 'public' => true ) );
+ $screen = get_current_screen();
+ $post_type = $screen->id;
+
+ if ( in_array( $post_type, (array) $post_types ) ) {
+
+ echo '<style class="astra-meta-box-style">
+ .block-editor-page #side-sortables #astra_settings_meta_box select { min-width: 84%; padding: 3px 24px 3px 8px; height: 20px; }
+ .block-editor-page #normal-sortables #astra_settings_meta_box select { min-width: 200px; }
+ .block-editor-page .edit-post-meta-boxes-area #poststuff #astra_settings_meta_box h2.hndle { border-bottom: 0; }
+ .block-editor-page #astra_settings_meta_box .components-base-control__field, .block-editor-page #astra_settings_meta_box .block-editor-page .transparent-header-wrapper, .block-editor-page #astra_settings_meta_box .adv-header-wrapper, .block-editor-page #astra_settings_meta_box .stick-header-wrapper, .block-editor-page #astra_settings_meta_box .disable-section-meta div { margin-bottom: 8px; }
+ .block-editor-page #astra_settings_meta_box .disable-section-meta div label { vertical-align: inherit; }
+ .block-editor-page #astra_settings_meta_box .post-attributes-label-wrapper { margin-bottom: 4px; }
+ #side-sortables #astra_settings_meta_box select { min-width: 100%; }
+ #normal-sortables #astra_settings_meta_box select { min-width: 200px; }
+ </style>';
+ }
+ }
+ /* Add CSS for the Submenu for BSF plugins added in Appearance Menu */
+
+ if ( ! is_customize_preview() ) {
+
+ if ( ! current_user_can( 'manage_options' ) ) {
+ return;
+ }
+
+ wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false );
+
+ $localize = array(
+ 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
+ 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '&hellip;',
+ 'astraSitesLink' => admin_url( 'themes.php?page=' ),
+ 'astraSitesLinkTitle' => __( 'See Library &#187;', 'astra' ),
+ 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '&hellip;',
+ 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '&hellip;',
+ 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ),
+ 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ),
+ 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ),
+ 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ),
+ );
+
+ wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) );
+ }
+ }
+
+ /**
+ * Enqueues the needed CSS/JS for the builder's admin settings page.
+ *
+ * @since 1.0
+ */
+ public static function styles_scripts() {
+
+ // Styles.
+ if ( is_rtl() ) {
+ wp_enqueue_style( 'astra-admin-settings-rtl', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings-rtl.css', array(), ASTRA_THEME_VERSION );
+ } else {
+ wp_enqueue_style( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/css/astra-admin-menu-settings.css', array(), ASTRA_THEME_VERSION );
+ }
+
+ if ( ! current_user_can( 'manage_options' ) ) {
+ return;
+ }
+
+ wp_register_script( 'astra-admin-settings', ASTRA_THEME_URI . 'inc/assets/js/astra-admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), ASTRA_THEME_VERSION, false );
+
+ $localize = array(
+ 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
+ 'btnActivating' => __( 'Activating Importer Plugin ', 'astra' ) . '&hellip;',
+ 'astraSitesLink' => admin_url( 'themes.php?page=' ),
+ 'astraSitesLinkTitle' => __( 'See Library &#187;', 'astra' ),
+ 'recommendedPluiginActivatingText' => __( 'Activating', 'astra' ) . '&hellip;',
+ 'recommendedPluiginDeactivatingText' => __( 'Deactivating', 'astra' ) . '&hellip;',
+ 'recommendedPluiginActivateText' => __( 'Activate', 'astra' ),
+ 'recommendedPluiginDeactivateText' => __( 'Deactivate', 'astra' ),
+ 'recommendedPluiginSettingsText' => __( 'Settings', 'astra' ),
+ 'astraPluginManagerNonce' => wp_create_nonce( 'astra-recommended-plugin-nonce' ),
+ 'ajax_nonce' => wp_create_nonce( 'astra-builder-module-nonce' ),
+ 'old_header_footer' => __( 'Use Old Header/Footer', 'astra' ),
+ 'migrate_to_builder' => __( 'Use New Header/Footer Builder', 'astra' ),
+ );
+ wp_localize_script( 'astra-admin-settings', 'astra', apply_filters( 'astra_theme_js_localize', $localize ) );
+
+ // Script.
+ wp_enqueue_script( 'astra-admin-settings' );
+
+ if ( ! file_exists( WP_PLUGIN_DIR . '/astra-sites/astra-sites.php' ) && is_plugin_inactive( 'astra-pro-sites/astra-pro-sites.php' ) ) {
+ // For starter site plugin popup detail "Details &#187;" on Astra Options page.
+ wp_enqueue_script( 'plugin-install' );
+ wp_enqueue_script( 'thickbox' );
+ wp_enqueue_style( 'thickbox' );
+ }
+ }
+
+
+ /**
+ * Get and return page URL
+ *
+ * @param string $menu_slug Menu name.
+ * @since 1.0
+ * @return string page url
+ */
+ public static function get_page_url( $menu_slug ) {
+
+ $parent_page = self::$default_menu_position;
+
+ if ( strpos( $parent_page, '?' ) !== false ) {
+ $query_var = '&page=' . self::$plugin_slug;
+ } else {
+ $query_var = '?page=' . self::$plugin_slug;
+ }
+
+ $parent_page_url = admin_url( $parent_page . $query_var );
+
+ $url = $parent_page_url . '&action=' . $menu_slug;
+
+ return esc_url( $url );
+ }
+
+ /**
+ * Add main menu
+ *
+ * @since 1.0
+ */
+ public static function add_admin_menu() {
+
+ $parent_page = self::$default_menu_position;
+ $page_title = self::$menu_page_title;
+ $capability = 'manage_options';
+ $page_menu_slug = self::$plugin_slug;
+ $page_menu_func = __CLASS__ . '::menu_callback';
+
+ if ( apply_filters( 'astra_dashboard_admin_menu', true ) ) {
+ add_theme_page( $page_title, $page_title, $capability, $page_menu_slug, $page_menu_func );
+ } else {
+ do_action( 'asta_register_admin_menu', $parent_page, $page_title, $capability, $page_menu_slug, $page_menu_func );
+ }
+ }
+
+ /**
+ * Menu callback
+ *
+ * @since 1.0
+ */
+ public static function menu_callback() {
+
+ $current_slug = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : self::$current_slug; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
+
+ $current_slug = str_replace( '-', '_', $current_slug );
+
+ $ast_icon = apply_filters( 'astra_page_top_icon', true );
+ $ast_visit_site_url = apply_filters( 'astra_site_url', 'https://www.adelielinux.org/' );
+ $ast_wrapper_class = apply_filters( 'astra_welcome_wrapper_class', array( $current_slug ) );
+
+ ?>
+ <div class="ast-menu-page-wrapper wrap ast-clear <?php echo esc_attr( implode( ' ', $ast_wrapper_class ) ); ?>">
+ <div class="ast-theme-page-header">
+ <div class="ast-container ast-flex">
+ <div class="ast-theme-title">
+ <a href="<?php echo esc_url( $ast_visit_site_url ); ?>" target="_blank" rel="noopener" >
+ <?php if ( $ast_icon ) { ?>
+ <img src="<?php echo esc_url( ASTRA_THEME_URI . 'inc/assets/images/gen_polylogo_black_color_x200.png' ); ?>" class="ast-theme-icon" alt="<?php echo esc_attr( self::$page_title ); ?> " >
+ <span class="astra-theme-version"><?php echo esc_html( ASTRA_THEME_VERSION ); ?></span>
+ <?php } ?>
+ <?php do_action( 'astra_welcome_page_header_title' ); ?>
+ </a>
+ </div>
+
+ <?php do_action( 'astra_header_right_section' ); ?>
+
+ </div>
+ </div>
+
+ <?php do_action( 'astra_menu_' . esc_attr( $current_slug ) . '_action' ); ?>
+ </div>
+ <?php
+ }
+
+ /**
+ * Include general page
+ *
+ * @since 1.0
+ */
+ public static function general_page() {
+ require_once ASTRA_THEME_DIR . 'inc/core/view-general.php';// phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
+ }
+
+ /**
+ * External links through Astra Options page.
+ *
+ * @since 3.4.0
+ */
+ public static function external_important_links_section() {
+
+ if ( astra_is_white_labelled() ) {
+ return;
+ }
+ ?>
+
+ <div class="postbox">
+ <h2 class="hndle ast-normal-cursor">
+ <span><?php echo esc_html( apply_filters( 'astra_other_links_postbox_title', __( 'Important Links', 'astra' ) ) ); ?></span>
+ </h2>
+ <div class="inside">
+ <ul class="ast-other-links-list">
+ <li>
+ <span class="dashicons dashicons-admin-home"></span>
+ <a href="https://www.adelielinux.org/" target="_blank" rel="noopener"> <?php esc_html_e( 'Adélie Linux Homepage', 'astra' ); ?> </a>
+ </li>
+ <li>
+ <span class="dashicons dashicons-book"></span>
+ <a href="https://blog.adelielinux.org/" target="_blank" rel="noopener"> <?php esc_html_e( 'Adélie Linux Blog', 'astra' ); ?> </a>
+ </li>
+ <li>
+ <span class="dashicons dashicons-groups"></span>
+ <a href="https://git.adelielinux.org/adelie/blog-ng/" target="_blank" rel="noopener"> <?php esc_html_e( 'Theme Source Code', 'astra' ); ?> </a>
+ </li>
+ <li>
+ <span class="dashicons dashicons-star-filled"></span>
+ <a href="https://www.adelielinux.org/contribute/donate.html" target="_blank" rel="noopener"> <?php esc_html_e( 'Donate', 'astra' ); ?> </a>
+ </li>
+ </ul>
+ </div>
+ </div>
+
+ <?php
+ }
+
+ /**
+ * Starter Templates Post Box Title.
+ *
+ * @since 3.4.0
+ *
+ * @return string Starter Templates Plugin name.
+ */
+ public static function get_starter_templates_title() {
+
+ $astra_sites_name = __( '150+ Starter Templates', 'astra' );
+
+ if ( method_exists( 'Astra_Ext_White_Label_Markup', 'get_whitelabel_string' ) ) {
+ $white_labelled_astra_sites_name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
+ if ( ! empty( $white_labelled_astra_sites_name ) ) {
+ $astra_sites_name = $white_labelled_astra_sites_name;
+ }
+ }
+
+ return $astra_sites_name;
+ }
+
+ /**
+ * Include Welcome page right starter sites content
+ *
+ * @since 1.2.4
+ */
+ public static function astra_welcome_page_starter_sites_section() {
+
+ if ( astra_is_white_labelled() ) {
+ return;
+ }
+
+ }
+
+ /**
+ * Include Welcome page content
+ *
+ * @since 1.2.4
+ */
+ public static function astra_welcome_page_content() {
+
+ $astra_addon_tagline = apply_filters( 'astra_addon_list_tagline', __( 'More Options Available with Astra Pro!', 'astra' ) );
+
+ // Quick settings.
+ $quick_settings = apply_filters(
+ 'astra_quick_settings',
+ array(
+ 'header' => array(
+ 'title' => __( 'Header Options', 'astra' ),
+ 'dashicon' => 'dashicons-align-center',
+ 'quick_url' => admin_url( 'customize.php?autofocus[panel]=panel-header-group' ),
+ ),
+ 'logo-favicon' => array(
+ 'title' => __( 'Upload Logo', 'astra' ),
+ 'dashicon' => 'dashicons-format-image',
+ 'quick_url' => admin_url( 'customize.php?autofocus[control]=custom_logo' ),
+ ),
+ 'footer' => array(
+ 'title' => __( 'Footer Settings', 'astra' ),
+ 'dashicon' => 'dashicons-align-wide',
+ 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-footer-group' ),
+ ),
+ 'colors' => array(
+ 'title' => __( 'Set Colors', 'astra' ),
+ 'dashicon' => 'dashicons-admin-customizer',
+ 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-colors-background' ),
+ ),
+ 'layout' => array(
+ 'title' => __( 'Layout Options', 'astra' ),
+ 'dashicon' => 'dashicons-layout',
+ 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-container-layout' ),
+ ),
+ 'typography' => array(
+ 'title' => __( 'Customize Fonts', 'astra' ),
+ 'dashicon' => 'dashicons-editor-textcolor',
+ 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-typography' ),
+ ),
+ 'blog-layout' => array(
+ 'title' => __( 'Blog Layouts', 'astra' ),
+ 'dashicon' => 'dashicons-welcome-write-blog',
+ 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-blog-group' ),
+ ),
+ 'sidebars' => array(
+ 'title' => __( 'Sidebar Options', 'astra' ),
+ 'dashicon' => 'dashicons-align-left',
+ 'quick_url' => admin_url( 'customize.php?autofocus[section]=section-sidebars' ),
+ ),
+ )
+ );
+
+ $extensions = apply_filters(
+ 'astra_addon_list',
+ array(
+ )
+ );
+ ?>
+ <div class="postbox">
+ <h2 class="hndle ast-normal-cursor"><span><?php esc_html_e( 'Links to Customizer Settings:', 'astra' ); ?></span></h2>
+ <div class="ast-quick-setting-section">
+ <?php
+ if ( ! empty( $quick_settings ) ) :
+ ?>
+ <div class="ast-quick-links">
+ <ul class="ast-flex">
+ <?php
+ foreach ( (array) $quick_settings as $key => $link ) {
+ echo '<li class="' . esc_attr( $key ) . '"><span class="dashicons ' . esc_attr( $link['dashicon'] ) . '"></span><a class="ast-quick-setting-title" href="' . esc_url( $link['quick_url'] ) . '" target="_blank" rel="noopener">' . esc_html( $link['title'] ) . '</a></li>';
+ }
+ ?>
+ </ul>
+ </div>
+ <?php endif; ?>
+ </div>
+ </div>
+
+ <?php
+ }
+
+ /**
+ * Include Welcome page content
+ *
+ * @since 1.2.4
+ */
+ public static function astra_available_plugins() {
+
+ // Return if white labeled.
+ if ( astra_is_white_labelled() ) {
+ return;
+ }
+
+ }
+
+ /**
+ * Build plugin's page URL on WordPress.org
+ * https://wordpress.org/plugins/{plugin-slug}
+ *
+ * @since 1.6.9
+ * @param String $slug plugin slug.
+ * @return String Plugin URL on WordPress.org
+ */
+ private static function build_worg_plugin_link( $slug ) {
+ return esc_url( trailingslashit( 'https://wordpress.org/plugins/' . $slug ) );
+ }
+
+ /**
+ * Required Plugin Activate
+ *
+ * @since 1.2.4
+ */
+ public static function required_plugin_activate() {
+
+ $nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : '';
+
+ if ( false === wp_verify_nonce( $nonce, 'astra-recommended-plugin-nonce' ) ) {
+ wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'astra' ) );
+ }
+
+ if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) {
+ wp_send_json_error(
+ array(
+ 'success' => false,
+ 'message' => __( 'No plugin specified', 'astra' ),
+ )
+ );
+ }
+
+ $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : '';
+
+ $activate = activate_plugin( $plugin_init, '', false, true );
+
+ if ( '/astra-pro-sites/astra-pro-sites.php' === $plugin_init || '/astra-sites/astra-sites.php' === $plugin_init ) {
+ self::get_starter_templates_slug();
+ }
+
+ if ( is_wp_error( $activate ) ) {
+ wp_send_json_error(
+ array(
+ 'success' => false,
+ 'message' => $activate->get_error_message(),
+ 'starter_template_slug' => self::$starter_templates_slug,
+ )
+ );
+ }
+
+ wp_send_json_success(
+ array(
+ 'success' => true,
+ 'message' => __( 'Plugin Successfully Activated', 'astra' ),
+ 'starter_template_slug' => self::$starter_templates_slug,
+ )
+ );
+ }
+
+ /**
+ * Required Plugin Activate
+ *
+ * @since 1.2.4
+ */
+ public static function required_plugin_deactivate() {
+
+ $nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : '';
+
+ if ( false === wp_verify_nonce( $nonce, 'astra-recommended-plugin-nonce' ) ) {
+ wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'astra' ) );
+ }
+
+ if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! sanitize_text_field( wp_unslash( $_POST['init'] ) ) ) {
+ wp_send_json_error(
+ array(
+ 'success' => false,
+ 'message' => __( 'No plugin specified', 'astra' ),
+ )
+ );
+ }
+
+ $plugin_init = ( isset( $_POST['init'] ) ) ? sanitize_text_field( wp_unslash( $_POST['init'] ) ) : '';
+
+ $deactivate = deactivate_plugins( $plugin_init, '', false );
+
+ if ( is_wp_error( $deactivate ) ) {
+ wp_send_json_error(
+ array(
+ 'success' => false,
+ 'message' => $deactivate->get_error_message(),
+ )
+ );
+ }
+
+ wp_send_json_success(
+ array(
+ 'success' => true,
+ 'message' => __( 'Plugin Successfully Deactivated', 'astra' ),
+ )
+ );
+
+ }
+
+ /**
+ * Astra Header Right Section Links
+ *
+ * @since 1.2.4
+ */
+ public static function top_header_right_section() {
+
+ if ( ! empty( $top_links ) ) {
+ ?>
+ <div class="ast-top-links">
+ <ul>
+ <?php
+ foreach ( (array) $top_links as $key => $info ) {
+ /* translators: %1$s: Top Link URL wrapper, %2$s: Top Link URL, %3$s: Top Link URL target attribute */
+ printf(
+ '<li><%1$s %2$s %3$s > %4$s </%1$s>',
+ isset( $info['url'] ) ? 'a' : 'span',
+ isset( $info['url'] ) ? 'href="' . esc_url( $info['url'] ) . '"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ isset( $info['url'] ) ? 'target="_blank" rel="noopener"' : '', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ $info['title']// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ );
+ }
+ ?>
+ </ul>
+ </div>
+ <?php
+ }
+ }
+
+ /**
+ * Add custom CSS for admin area sub menu icons.
+ *
+ * @since 2.5.4
+ */
+ public static function admin_submenu_css() {
+
+ echo '<style class="astra-menu-appearance-style">
+ #menu-appearance a[href^="edit.php?post_type=astra-"]:before,
+ #menu-appearance a[href^="themes.php?page=astra-"]:before,
+ #menu-appearance a[href^="edit.php?post_type=astra_"]:before,
+ #menu-appearance a[href^="edit-tags.php?taxonomy=bsf_custom_fonts"]:before,
+ #menu-appearance a[href^="themes.php?page=custom-typekit-fonts"]:before,
+ #menu-appearance a[href^="edit.php?post_type=bsf-sidebar"]:before {
+ content: "\21B3";
+ margin-right: 0.5em;
+ opacity: 0.5;
+ }
+ </style>';
+
+ }
+ }
+
+ new Astra_Admin_Settings();
+}
diff --git a/inc/core/class-astra-attr.php b/inc/core/class-astra-attr.php
index 2f55e46..9154c47 100644
--- a/inc/core/class-astra-attr.php
+++ b/inc/core/class-astra-attr.php
@@ -1,115 +1,115 @@
-<?php
-/**
- * Astra Attributes Class.
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.6.2
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-if ( ! class_exists( 'Astra_Attr' ) ) :
-
- /**
- * Class Astra_Attr
- */
- class Astra_Attr {
-
- /**
- * Store Instance on Current Class.
- *
- * @var object instance
- */
- private static $instance;
-
- /**
- * Initiator
- */
- public static function get_instance() {
- if ( ! isset( self::$instance ) ) {
- self::$instance = new self();
- }
- return self::$instance;
- }
-
- /**
- * Initialuze the Class.
- *
- * @since 1.6.2
- */
- private function __construct() {}
-
- /**
- * Build list of attributes into a string and apply contextual filter on string.
- *
- * The contextual filter is of the form `astra_attr_{context}_output`.
- *
- * @since 1.6.2
- *
- * @param string $context The context, to build filter name.
- * @param array $attributes Optional. Extra attributes to merge with defaults.
- * @param array $args Optional. Custom data to pass to filter.
- * @return string String of HTML attributes and values.
- */
- public function astra_attr( $context, $attributes = array(), $args = array() ) {
-
- $attributes = $this->astra_parse_attr( $context, $attributes, $args );
-
- $output = '';
-
- // Cycle through attributes, build tag attribute string.
- foreach ( $attributes as $key => $value ) {
-
- if ( ! $value ) {
- continue;
- }
-
- if ( true === $value ) {
- $output .= esc_html( $key ) . ' ';
- } else {
- $output .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) );
- }
- }
-
- $output = apply_filters( "astra_attr_{$context}_output", $output, $attributes, $context, $args );
-
- return trim( $output );
- }
-
- /**
- * Merge array of attributes with defaults, and apply contextual filter on array.
- *
- * The contextual filter is of the form `astra_attr_{context}`.
- *
- * @since 1.6.2
- *
- * @param string $context The context, to build filter name.
- * @param array $attributes Optional. Extra attributes to merge with defaults.
- * @param array $args Optional. Custom data to pass to filter.
- * @return array Merged and filtered attributes.
- */
- public function astra_parse_attr( $context, $attributes = array(), $args = array() ) {
-
- $defaults = array(
- 'class' => sanitize_html_class( $context ),
- );
-
- $attributes = wp_parse_args( $attributes, $defaults );
-
- // Contextual filter.
- return apply_filters( "astra_attr_{$context}", $attributes, $context, $args );
- }
-
- }
-
-endif;
-
-/**
- * Kicking this off by calling 'get_instance()' method
- */
-Astra_Attr::get_instance();
+<?php
+/**
+ * Astra Attributes Class.
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.6.2
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+if ( ! class_exists( 'Astra_Attr' ) ) :
+
+ /**
+ * Class Astra_Attr
+ */
+ class Astra_Attr {
+
+ /**
+ * Store Instance on Current Class.
+ *
+ * @var object instance
+ */
+ private static $instance;
+
+ /**
+ * Initiator
+ */
+ public static function get_instance() {
+ if ( ! isset( self::$instance ) ) {
+ self::$instance = new self();
+ }
+ return self::$instance;
+ }
+
+ /**
+ * Initialuze the Class.
+ *
+ * @since 1.6.2
+ */
+ private function __construct() {}
+
+ /**
+ * Build list of attributes into a string and apply contextual filter on string.
+ *
+ * The contextual filter is of the form `astra_attr_{context}_output`.
+ *
+ * @since 1.6.2
+ *
+ * @param string $context The context, to build filter name.
+ * @param array $attributes Optional. Extra attributes to merge with defaults.
+ * @param array $args Optional. Custom data to pass to filter.
+ * @return string String of HTML attributes and values.
+ */
+ public function astra_attr( $context, $attributes = array(), $args = array() ) {
+
+ $attributes = $this->astra_parse_attr( $context, $attributes, $args );
+
+ $output = '';
+
+ // Cycle through attributes, build tag attribute string.
+ foreach ( $attributes as $key => $value ) {
+
+ if ( ! $value ) {
+ continue;
+ }
+
+ if ( true === $value ) {
+ $output .= esc_html( $key ) . ' ';
+ } else {
+ $output .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) );
+ }
+ }
+
+ $output = apply_filters( "astra_attr_{$context}_output", $output, $attributes, $context, $args );
+
+ return trim( $output );
+ }
+
+ /**
+ * Merge array of attributes with defaults, and apply contextual filter on array.
+ *
+ * The contextual filter is of the form `astra_attr_{context}`.
+ *
+ * @since 1.6.2
+ *
+ * @param string $context The context, to build filter name.
+ * @param array $attributes Optional. Extra attributes to merge with defaults.
+ * @param array $args Optional. Custom data to pass to filter.
+ * @return array Merged and filtered attributes.
+ */
+ public function astra_parse_attr( $context, $attributes = array(), $args = array() ) {
+
+ $defaults = array(
+ 'class' => sanitize_html_class( $context ),
+ );
+
+ $attributes = wp_parse_args( $attributes, $defaults );
+
+ // Contextual filter.
+ return apply_filters( "astra_attr_{$context}", $attributes, $context, $args );
+ }
+
+ }
+
+endif;
+
+/**
+ * Kicking this off by calling 'get_instance()' method
+ */
+Astra_Attr::get_instance();
diff --git a/inc/core/class-astra-enqueue-scripts.php b/inc/core/class-astra-enqueue-scripts.php
index c249445..9772037 100644
--- a/inc/core/class-astra-enqueue-scripts.php
+++ b/inc/core/class-astra-enqueue-scripts.php
@@ -1,389 +1,389 @@
-<?php
-/**
- * Loader Functions
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.0.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-/**
- * Theme Enqueue Scripts
- */
-if ( ! class_exists( 'Astra_Enqueue_Scripts' ) ) {
-
- /**
- * Theme Enqueue Scripts
- */
- class Astra_Enqueue_Scripts {
-
- /**
- * Class styles.
- *
- * @access public
- * @var $styles Enqueued styles.
- */
- public static $styles;
-
- /**
- * Class scripts.
- *
- * @access public
- * @var $scripts Enqueued scripts.
- */
- public static $scripts;
-
- /**
- * Constructor
- */
- public function __construct() {
-
- add_action( 'astra_get_fonts', array( $this, 'add_fonts' ), 1 );
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
- add_action( 'enqueue_block_editor_assets', array( $this, 'gutenberg_assets' ) );
- add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
- add_action( 'wp_print_footer_scripts', array( $this, 'astra_skip_link_focus_fix' ) );
- add_filter( 'gallery_style', array( $this, 'enqueue_galleries_style' ) );
- }
-
- /**
- * Fix skip link focus in IE11.
- *
- * This does not enqueue the script because it is tiny and because it is only for IE11,
- * thus it does not warrant having an entire dedicated blocking script being loaded.
- *
- * @link https://git.io/vWdr2
- * @link https://github.com/WordPress/twentynineteen/pull/47/files
- * @link https://github.com/ampproject/amphtml/issues/18671
- */
- public function astra_skip_link_focus_fix() {
- // Skip printing script on AMP content, since accessibility fix is covered by AMP framework.
- if ( astra_is_amp_endpoint() ) {
- return;
- }
-
- // The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`.
- ?>
- <script>
- /(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1);
- </script>
- <?php
- }
-
- /**
- * Admin body classes.
- *
- * Body classes to be added to <body> tag in admin page
- *
- * @param String $classes body classes returned from the filter.
- * @return String body classes to be added to <body> tag in admin page
- */
- public function admin_body_class( $classes ) {
-
- global $pagenow;
- $screen = get_current_screen();
-
- if ( ( ( 'post-new.php' == $pagenow || 'post.php' == $pagenow ) && ( defined( 'ASTRA_ADVANCED_HOOKS_POST_TYPE' ) && ASTRA_ADVANCED_HOOKS_POST_TYPE == $screen->post_type ) ) || 'widgets.php' == $pagenow ) {
- return;
- }
-
- $post_id = get_the_ID();
-
- if ( $post_id ) {
- $meta_content_layout = get_post_meta( $post_id, 'site-content-layout', true );
- }
-
- if ( ( isset( $meta_content_layout ) && ! empty( $meta_content_layout ) ) && 'default' !== $meta_content_layout ) {
- $content_layout = $meta_content_layout;
- } else {
- $content_layout = astra_get_option( 'site-content-layout' );
- }
-
- if ( 'content-boxed-container' == $content_layout ) {
- $classes .= ' ast-separate-container';
- } elseif ( 'boxed-container' == $content_layout ) {
- $classes .= ' ast-separate-container ast-two-container';
- } elseif ( 'page-builder' == $content_layout ) {
- $classes .= ' ast-page-builder-template';
- } elseif ( 'plain-container' == $content_layout ) {
- $classes .= ' ast-plain-container';
- }
-
- $site_layout = astra_get_option( 'site-layout' );
- if ( 'ast-box-layout' === $site_layout ) {
- $classes .= ' ast-max-width-layout';
- }
-
- $classes .= ' ast-' . astra_page_layout();
-
- return $classes;
- }
-
- /**
- * List of all assets.
- *
- * @return array assets array.
- */
- public static function theme_assets() {
-
- $default_assets = array(
- // handle => location ( in /assets/js/ ) ( without .js ext).
- 'js' => array(
- 'astra-theme-js' => 'style',
- ),
- // handle => location ( in /assets/css/ ) ( without .css ext).
- 'css' => array(
- 'astra-theme-css' => Astra_Builder_Helper::apply_flex_based_css() ? 'style-flex' : 'style',
- ),
- );
-
- if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
-
- $default_assets = array(
- // handle => location ( in /assets/js/ ) ( without .js ext).
- 'js' => array(
- 'astra-theme-js' => 'frontend',
- ),
- // handle => location ( in /assets/css/ ) ( without .css ext).
- 'css' => array(
- 'astra-theme-css' => Astra_Builder_Helper::apply_flex_based_css() ? 'main' : 'frontend',
- ),
- );
-
- if ( Astra_Builder_Helper::is_component_loaded( 'edd-cart', 'header' ) ||
- Astra_Builder_Helper::is_component_loaded( 'woo-cart', 'header' ) ) {
- $default_assets['js']['astra-mobile-cart'] = 'mobile-cart';
- }
- }
- return apply_filters( 'astra_theme_assets', $default_assets );
- }
-
- /**
- * Add Fonts
- */
- public function add_fonts() {
-
- $font_family = astra_get_option( 'body-font-family' );
- $font_weight = astra_get_option( 'body-font-weight' );
- $font_variant = astra_get_option( 'body-font-variant' );
-
- Astra_Fonts::add_font( $font_family, $font_weight );
- Astra_Fonts::add_font( $font_family, $font_variant );
-
- // Render headings font.
- $heading_font_family = astra_get_option( 'headings-font-family' );
- $heading_font_weight = astra_get_option( 'headings-font-weight' );
- $heading_font_variant = astra_get_option( 'headings-font-variant' );
-
- Astra_Fonts::add_font( $heading_font_family, $heading_font_weight );
- Astra_Fonts::add_font( $heading_font_family, $heading_font_variant );
- }
-
- /**
- * Enqueue Scripts
- */
- public function enqueue_scripts() {
-
- if ( false === self::enqueue_theme_assets() ) {
- return;
- }
-
- /* Directory and Extension */
- $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
- $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
-
- $js_uri = ASTRA_THEME_URI . 'assets/js/' . $dir_name . '/';
- $css_uri = ASTRA_THEME_URI . 'assets/css/' . $dir_name . '/';
-
- /**
- * IE Only Js and CSS Files.
- */
- // Flexibility.js for flexbox IE10 support.
- wp_enqueue_script( 'astra-flexibility', $js_uri . 'flexibility' . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, false );
- wp_add_inline_script( 'astra-flexibility', 'flexibility(document.documentElement);' );
- wp_script_add_data( 'astra-flexibility', 'conditional', 'IE' );
-
- // Polyfill for CustomEvent for IE.
- wp_register_script( 'astra-customevent', $js_uri . 'custom-events-polyfill' . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, false );
- wp_register_style( 'astra-galleries-css', $css_uri . 'galleries' . $file_prefix . '.css', array(), ASTRA_THEME_VERSION, 'all' );
- // All assets.
- $all_assets = self::theme_assets();
- $styles = $all_assets['css'];
- $scripts = $all_assets['js'];
-
- if ( is_array( $styles ) && ! empty( $styles ) ) {
- // Register & Enqueue Styles.
- foreach ( $styles as $key => $style ) {
-
- $dependency = array();
-
- // Add dynamic CSS dependency for all styles except for theme's style.css.
- if ( 'astra-theme-css' !== $key && class_exists( 'Astra_Cache_Base' ) ) {
- if ( ! Astra_Cache_Base::inline_assets() ) {
- $dependency[] = 'astra-theme-dynamic';
- }
- }
-
- // Generate CSS URL.
- $css_file = $css_uri . $style . $file_prefix . '.css';
-
- // Register.
- wp_register_style( $key, $css_file, $dependency, ASTRA_THEME_VERSION, 'all' );
-
- // Enqueue.
- wp_enqueue_style( $key );
-
- // RTL support.
- wp_style_add_data( $key, 'rtl', 'replace' );
- }
- }
-
- // Fonts - Render Fonts.
- Astra_Fonts::render_fonts();
-
- /**
- * Inline styles
- */
-
- add_filter( 'astra_dynamic_theme_css', array( 'Astra_Dynamic_CSS', 'return_output' ) );
- add_filter( 'astra_dynamic_theme_css', array( 'Astra_Dynamic_CSS', 'return_meta_output' ) );
-
- $menu_animation = astra_get_option( 'header-main-submenu-container-animation' );
-
- // Submenu Container Animation for header builder.
- if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
-
- for ( $index = 1; $index <= Astra_Builder_Helper::$component_limit; $index++ ) {
-
- $menu_animation_enable = astra_get_option( 'header-menu' . $index . '-submenu-container-animation' );
-
- if ( Astra_Builder_Helper::is_component_loaded( 'menu-' . $index, 'header' ) && ! empty( $menu_animation_enable ) ) {
- $menu_animation = 'is_animated';
- break;
- }
- }
- }
-
- $rtl = ( is_rtl() ) ? '-rtl' : '';
-
- if ( ! empty( $menu_animation ) || is_customize_preview() ) {
- if ( class_exists( 'Astra_Cache' ) ) {
- Astra_Cache::add_css_file( ASTRA_THEME_DIR . 'assets/css/' . $dir_name . '/menu-animation' . $rtl . $file_prefix . '.css' );
- } else {
- wp_register_style( 'astra-menu-animation', $css_uri . 'menu-animation' . $file_prefix . '.css', null, ASTRA_THEME_VERSION, 'all' );
- wp_enqueue_style( 'astra-menu-animation' );
- }
- }
-
- if ( ! class_exists( 'Astra_Cache' ) ) {
- $theme_css_data = apply_filters( 'astra_dynamic_theme_css', '' );
- wp_add_inline_style( 'astra-theme-css', $theme_css_data );
- }
-
- if ( astra_is_amp_endpoint() ) {
- return;
- }
-
- // Comment assets.
- if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
- wp_enqueue_script( 'comment-reply' );
- }
-
- if ( is_array( $scripts ) && ! empty( $scripts ) ) {
-
- // Register & Enqueue Scripts.
- foreach ( $scripts as $key => $script ) {
-
- // Register.
- wp_register_script( $key, $js_uri . $script . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, true );
-
- // Enqueue.
- wp_enqueue_script( $key );
- }
- }
-
- $astra_localize = array(
- 'break_point' => astra_header_break_point(), // Header Break Point.
- 'isRtl' => is_rtl(),
- );
-
- wp_localize_script( 'astra-theme-js', 'astra', apply_filters( 'astra_theme_js_localize', $astra_localize ) );
- }
-
- /**
- * Trim CSS
- *
- * @since 1.0.0
- * @param string $css CSS content to trim.
- * @return string
- */
- public static function trim_css( $css = '' ) {
-
- // Trim white space for faster page loading.
- if ( ! empty( $css ) ) {
- $css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css );
- $css = str_replace( array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), '', $css );
- $css = str_replace( ', ', ',', $css );
- }
-
- return $css;
- }
-
- /**
- * Enqueue Gutenberg assets.
- *
- * @since 1.5.2
- *
- * @return void
- */
- public function gutenberg_assets() {
- /* Directory and Extension */
- $rtl = '';
- if ( is_rtl() ) {
- $rtl = '-rtl';
- }
-
- $css_uri = ASTRA_THEME_URI . 'inc/assets/css/block-editor-styles' . $rtl . '.css';
- $js_uri = ASTRA_THEME_URI . 'inc/assets/js/block-editor-script.js';
-
- wp_enqueue_style( 'astra-block-editor-styles', $css_uri, false, ASTRA_THEME_VERSION, 'all' );
- wp_enqueue_script( 'astra-block-editor-script', $js_uri, false, ASTRA_THEME_VERSION, 'all' );
-
- // Render fonts in Gutenberg layout.
- Astra_Fonts::render_fonts();
-
- wp_add_inline_style( 'astra-block-editor-styles', apply_filters( 'astra_block_editor_dynamic_css', Gutenberg_Editor_CSS::get_css() ) );
- }
-
- /**
- * Function to check if enqueuing of Astra assets are disabled.
- *
- * @since 2.1.0
- * @return boolean
- */
- public static function enqueue_theme_assets() {
- return apply_filters( 'astra_enqueue_theme_assets', true );
- }
-
- /**
- * Enqueue galleries relates CSS on gallery_style filter.
- *
- * @param string $gallery_style gallery style and div.
- * @since 3.5.0
- * @return string
- */
- public function enqueue_galleries_style( $gallery_style ) {
- wp_enqueue_style( 'astra-galleries-css' );
- return $gallery_style;
- }
-
- }
-
- new Astra_Enqueue_Scripts();
-}
+<?php
+/**
+ * Loader Functions
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+/**
+ * Theme Enqueue Scripts
+ */
+if ( ! class_exists( 'Astra_Enqueue_Scripts' ) ) {
+
+ /**
+ * Theme Enqueue Scripts
+ */
+ class Astra_Enqueue_Scripts {
+
+ /**
+ * Class styles.
+ *
+ * @access public
+ * @var $styles Enqueued styles.
+ */
+ public static $styles;
+
+ /**
+ * Class scripts.
+ *
+ * @access public
+ * @var $scripts Enqueued scripts.
+ */
+ public static $scripts;
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+
+ add_action( 'astra_get_fonts', array( $this, 'add_fonts' ), 1 );
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
+ add_action( 'enqueue_block_editor_assets', array( $this, 'gutenberg_assets' ) );
+ add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
+ add_action( 'wp_print_footer_scripts', array( $this, 'astra_skip_link_focus_fix' ) );
+ add_filter( 'gallery_style', array( $this, 'enqueue_galleries_style' ) );
+ }
+
+ /**
+ * Fix skip link focus in IE11.
+ *
+ * This does not enqueue the script because it is tiny and because it is only for IE11,
+ * thus it does not warrant having an entire dedicated blocking script being loaded.
+ *
+ * @link https://git.io/vWdr2
+ * @link https://github.com/WordPress/twentynineteen/pull/47/files
+ * @link https://github.com/ampproject/amphtml/issues/18671
+ */
+ public function astra_skip_link_focus_fix() {
+ // Skip printing script on AMP content, since accessibility fix is covered by AMP framework.
+ if ( astra_is_amp_endpoint() ) {
+ return;
+ }
+
+ // The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`.
+ ?>
+ <script>
+ /(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1);
+ </script>
+ <?php
+ }
+
+ /**
+ * Admin body classes.
+ *
+ * Body classes to be added to <body> tag in admin page
+ *
+ * @param String $classes body classes returned from the filter.
+ * @return String body classes to be added to <body> tag in admin page
+ */
+ public function admin_body_class( $classes ) {
+
+ global $pagenow;
+ $screen = get_current_screen();
+
+ if ( ( ( 'post-new.php' == $pagenow || 'post.php' == $pagenow ) && ( defined( 'ASTRA_ADVANCED_HOOKS_POST_TYPE' ) && ASTRA_ADVANCED_HOOKS_POST_TYPE == $screen->post_type ) ) || 'widgets.php' == $pagenow ) {
+ return;
+ }
+
+ $post_id = get_the_ID();
+
+ if ( $post_id ) {
+ $meta_content_layout = get_post_meta( $post_id, 'site-content-layout', true );
+ }
+
+ if ( ( isset( $meta_content_layout ) && ! empty( $meta_content_layout ) ) && 'default' !== $meta_content_layout ) {
+ $content_layout = $meta_content_layout;
+ } else {
+ $content_layout = astra_get_option( 'site-content-layout' );
+ }
+
+ if ( 'content-boxed-container' == $content_layout ) {
+ $classes .= ' ast-separate-container';
+ } elseif ( 'boxed-container' == $content_layout ) {
+ $classes .= ' ast-separate-container ast-two-container';
+ } elseif ( 'page-builder' == $content_layout ) {
+ $classes .= ' ast-page-builder-template';
+ } elseif ( 'plain-container' == $content_layout ) {
+ $classes .= ' ast-plain-container';
+ }
+
+ $site_layout = astra_get_option( 'site-layout' );
+ if ( 'ast-box-layout' === $site_layout ) {
+ $classes .= ' ast-max-width-layout';
+ }
+
+ $classes .= ' ast-' . astra_page_layout();
+
+ return $classes;
+ }
+
+ /**
+ * List of all assets.
+ *
+ * @return array assets array.
+ */
+ public static function theme_assets() {
+
+ $default_assets = array(
+ // handle => location ( in /assets/js/ ) ( without .js ext).
+ 'js' => array(
+ 'astra-theme-js' => 'style',
+ ),
+ // handle => location ( in /assets/css/ ) ( without .css ext).
+ 'css' => array(
+ 'astra-theme-css' => Astra_Builder_Helper::apply_flex_based_css() ? 'style-flex' : 'style',
+ ),
+ );
+
+ if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
+
+ $default_assets = array(
+ // handle => location ( in /assets/js/ ) ( without .js ext).
+ 'js' => array(
+ 'astra-theme-js' => 'frontend',
+ ),
+ // handle => location ( in /assets/css/ ) ( without .css ext).
+ 'css' => array(
+ 'astra-theme-css' => Astra_Builder_Helper::apply_flex_based_css() ? 'main' : 'frontend',
+ ),
+ );
+
+ if ( Astra_Builder_Helper::is_component_loaded( 'edd-cart', 'header' ) ||
+ Astra_Builder_Helper::is_component_loaded( 'woo-cart', 'header' ) ) {
+ $default_assets['js']['astra-mobile-cart'] = 'mobile-cart';
+ }
+ }
+ return apply_filters( 'astra_theme_assets', $default_assets );
+ }
+
+ /**
+ * Add Fonts
+ */
+ public function add_fonts() {
+
+ $font_family = astra_get_option( 'body-font-family' );
+ $font_weight = astra_get_option( 'body-font-weight' );
+ $font_variant = astra_get_option( 'body-font-variant' );
+
+ Astra_Fonts::add_font( $font_family, $font_weight );
+ Astra_Fonts::add_font( $font_family, $font_variant );
+
+ // Render headings font.
+ $heading_font_family = astra_get_option( 'headings-font-family' );
+ $heading_font_weight = astra_get_option( 'headings-font-weight' );
+ $heading_font_variant = astra_get_option( 'headings-font-variant' );
+
+ Astra_Fonts::add_font( $heading_font_family, $heading_font_weight );
+ Astra_Fonts::add_font( $heading_font_family, $heading_font_variant );
+ }
+
+ /**
+ * Enqueue Scripts
+ */
+ public function enqueue_scripts() {
+
+ if ( false === self::enqueue_theme_assets() ) {
+ return;
+ }
+
+ /* Directory and Extension */
+ $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
+ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
+
+ $js_uri = ASTRA_THEME_URI . 'assets/js/' . $dir_name . '/';
+ $css_uri = ASTRA_THEME_URI . 'assets/css/' . $dir_name . '/';
+
+ /**
+ * IE Only Js and CSS Files.
+ */
+ // Flexibility.js for flexbox IE10 support.
+ wp_enqueue_script( 'astra-flexibility', $js_uri . 'flexibility' . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, false );
+ wp_add_inline_script( 'astra-flexibility', 'flexibility(document.documentElement);' );
+ wp_script_add_data( 'astra-flexibility', 'conditional', 'IE' );
+
+ // Polyfill for CustomEvent for IE.
+ wp_register_script( 'astra-customevent', $js_uri . 'custom-events-polyfill' . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, false );
+ wp_register_style( 'astra-galleries-css', $css_uri . 'galleries' . $file_prefix . '.css', array(), ASTRA_THEME_VERSION, 'all' );
+ // All assets.
+ $all_assets = self::theme_assets();
+ $styles = $all_assets['css'];
+ $scripts = $all_assets['js'];
+
+ if ( is_array( $styles ) && ! empty( $styles ) ) {
+ // Register & Enqueue Styles.
+ foreach ( $styles as $key => $style ) {
+
+ $dependency = array();
+
+ // Add dynamic CSS dependency for all styles except for theme's style.css.
+ if ( 'astra-theme-css' !== $key && class_exists( 'Astra_Cache_Base' ) ) {
+ if ( ! Astra_Cache_Base::inline_assets() ) {
+ $dependency[] = 'astra-theme-dynamic';
+ }
+ }
+
+ // Generate CSS URL.
+ $css_file = $css_uri . $style . $file_prefix . '.css';
+
+ // Register.
+ wp_register_style( $key, $css_file, $dependency, ASTRA_THEME_VERSION, 'all' );
+
+ // Enqueue.
+ wp_enqueue_style( $key );
+
+ // RTL support.
+ wp_style_add_data( $key, 'rtl', 'replace' );
+ }
+ }
+
+ // Fonts - Render Fonts.
+ Astra_Fonts::render_fonts();
+
+ /**
+ * Inline styles
+ */
+
+ add_filter( 'astra_dynamic_theme_css', array( 'Astra_Dynamic_CSS', 'return_output' ) );
+ add_filter( 'astra_dynamic_theme_css', array( 'Astra_Dynamic_CSS', 'return_meta_output' ) );
+
+ $menu_animation = astra_get_option( 'header-main-submenu-container-animation' );
+
+ // Submenu Container Animation for header builder.
+ if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
+
+ for ( $index = 1; $index <= Astra_Builder_Helper::$component_limit; $index++ ) {
+
+ $menu_animation_enable = astra_get_option( 'header-menu' . $index . '-submenu-container-animation' );
+
+ if ( Astra_Builder_Helper::is_component_loaded( 'menu-' . $index, 'header' ) && ! empty( $menu_animation_enable ) ) {
+ $menu_animation = 'is_animated';
+ break;
+ }
+ }
+ }
+
+ $rtl = ( is_rtl() ) ? '-rtl' : '';
+
+ if ( ! empty( $menu_animation ) || is_customize_preview() ) {
+ if ( class_exists( 'Astra_Cache' ) ) {
+ Astra_Cache::add_css_file( ASTRA_THEME_DIR . 'assets/css/' . $dir_name . '/menu-animation' . $rtl . $file_prefix . '.css' );
+ } else {
+ wp_register_style( 'astra-menu-animation', $css_uri . 'menu-animation' . $file_prefix . '.css', null, ASTRA_THEME_VERSION, 'all' );
+ wp_enqueue_style( 'astra-menu-animation' );
+ }
+ }
+
+ if ( ! class_exists( 'Astra_Cache' ) ) {
+ $theme_css_data = apply_filters( 'astra_dynamic_theme_css', '' );
+ wp_add_inline_style( 'astra-theme-css', $theme_css_data );
+ }
+
+ if ( astra_is_amp_endpoint() ) {
+ return;
+ }
+
+ // Comment assets.
+ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
+ wp_enqueue_script( 'comment-reply' );
+ }
+
+ if ( is_array( $scripts ) && ! empty( $scripts ) ) {
+
+ // Register & Enqueue Scripts.
+ foreach ( $scripts as $key => $script ) {
+
+ // Register.
+ wp_register_script( $key, $js_uri . $script . $file_prefix . '.js', array(), ASTRA_THEME_VERSION, true );
+
+ // Enqueue.
+ wp_enqueue_script( $key );
+ }
+ }
+
+ $astra_localize = array(
+ 'break_point' => astra_header_break_point(), // Header Break Point.
+ 'isRtl' => is_rtl(),
+ );
+
+ wp_localize_script( 'astra-theme-js', 'astra', apply_filters( 'astra_theme_js_localize', $astra_localize ) );
+ }
+
+ /**
+ * Trim CSS
+ *
+ * @since 1.0.0
+ * @param string $css CSS content to trim.
+ * @return string
+ */
+ public static function trim_css( $css = '' ) {
+
+ // Trim white space for faster page loading.
+ if ( ! empty( $css ) ) {
+ $css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css );
+ $css = str_replace( array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), '', $css );
+ $css = str_replace( ', ', ',', $css );
+ }
+
+ return $css;
+ }
+
+ /**
+ * Enqueue Gutenberg assets.
+ *
+ * @since 1.5.2
+ *
+ * @return void
+ */
+ public function gutenberg_assets() {
+ /* Directory and Extension */
+ $rtl = '';
+ if ( is_rtl() ) {
+ $rtl = '-rtl';
+ }
+
+ $css_uri = ASTRA_THEME_URI . 'inc/assets/css/block-editor-styles' . $rtl . '.css';
+ $js_uri = ASTRA_THEME_URI . 'inc/assets/js/block-editor-script.js';
+
+ wp_enqueue_style( 'astra-block-editor-styles', $css_uri, false, ASTRA_THEME_VERSION, 'all' );
+ wp_enqueue_script( 'astra-block-editor-script', $js_uri, false, ASTRA_THEME_VERSION, 'all' );
+
+ // Render fonts in Gutenberg layout.
+ Astra_Fonts::render_fonts();
+
+ wp_add_inline_style( 'astra-block-editor-styles', apply_filters( 'astra_block_editor_dynamic_css', Gutenberg_Editor_CSS::get_css() ) );
+ }
+
+ /**
+ * Function to check if enqueuing of Astra assets are disabled.
+ *
+ * @since 2.1.0
+ * @return boolean
+ */
+ public static function enqueue_theme_assets() {
+ return apply_filters( 'astra_enqueue_theme_assets', true );
+ }
+
+ /**
+ * Enqueue galleries relates CSS on gallery_style filter.
+ *
+ * @param string $gallery_style gallery style and div.
+ * @since 3.5.0
+ * @return string
+ */
+ public function enqueue_galleries_style( $gallery_style ) {
+ wp_enqueue_style( 'astra-galleries-css' );
+ return $gallery_style;
+ }
+
+ }
+
+ new Astra_Enqueue_Scripts();
+}
diff --git a/inc/core/class-astra-theme-options.php b/inc/core/class-astra-theme-options.php
index 3521399..3bac1e6 100644
--- a/inc/core/class-astra-theme-options.php
+++ b/inc/core/class-astra-theme-options.php
@@ -1,530 +1,530 @@
-<?php
-/**
- * Astra Theme Options
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.0.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-/**
- * Theme Options
- */
-if ( ! class_exists( 'Astra_Theme_Options' ) ) {
- /**
- * Theme Options
- */
- class Astra_Theme_Options {
-
- /**
- * Class instance.
- *
- * @access private
- * @var $instance Class instance.
- */
- private static $instance;
-
- /**
- * Customizer defaults.
- *
- * @access Private
- * @since 1.4.3
- * @var Array
- */
- private static $defaults;
-
- /**
- * Post id.
- *
- * @var $instance Post id.
- */
- public static $post_id = null;
-
- /**
- * A static option variable.
- *
- * @since 1.0.0
- * @access private
- * @var mixed $db_options
- */
- private static $db_options;
-
- /**
- * A static option variable.
- *
- * @since 1.0.0
- * @access private
- * @var mixed $db_options
- */
- private static $db_options_no_defaults;
-
- /**
- * Initiator
- */
- public static function get_instance() {
- if ( ! isset( self::$instance ) ) {
- self::$instance = new self();
- }
- return self::$instance;
- }
-
- /**
- * Constructor
- */
- public function __construct() {
-
- // Refresh options variables after customizer save.
- add_action( 'after_setup_theme', array( $this, 'refresh' ) );
-
- }
-
- /**
- * Set default theme option values
- *
- * @since 1.0.0
- * @return default values of the theme.
- */
- public static function defaults() {
-
- if ( ! is_null( self::$defaults ) ) {
- return self::$defaults;
- }
-
- /**
- * Update Astra customizer default values. To not update directly on existing users site, added backwards.
- *
- * @since 3.6.3
- */
- $apply_new_default_values = astra_button_default_padding_updated();
-
- // Defaults list of options.
- self::$defaults = apply_filters(
- 'astra_theme_defaults',
- array(
- // Blog Single.
- 'blog-single-post-structure' => array(
- 'single-image',
- 'single-title-meta',
- ),
-
- 'blog-single-width' => 'default',
- 'blog-single-max-width' => 1200,
- 'blog-single-meta' => array(
- 'comments',
- 'category',
- 'author',
- ),
- // Blog.
- 'blog-post-structure' => array(
- 'image',
- 'title-meta',
- ),
- 'blog-width' => 'default',
- 'blog-max-width' => 1200,
- 'blog-post-content' => 'excerpt',
- 'blog-meta' => array(
- 'comments',
- 'category',
- 'author',
- ),
- // Colors.
- 'text-color' => '#3a3a3a',
- 'link-color' => '#0170B9',
- 'theme-color' => '#0170B9',
- 'link-h-color' => '#3a3a3a',
-
- // Footer Bar Background.
- 'footer-bg-obj' => array(
- 'background-color' => '',
- 'background-image' => '',
- 'background-repeat' => 'repeat',
- 'background-position' => 'center center',
- 'background-size' => 'auto',
- 'background-attachment' => 'scroll',
- 'background-type' => '',
- 'background-media' => '',
- ),
- 'footer-color' => '',
- 'footer-link-color' => '',
- 'footer-link-h-color' => '',
-
- // Footer Widgets Background.
- 'footer-adv-bg-obj' => array(
- 'background-color' => '',
- 'background-image' => '',
- 'background-repeat' => 'repeat',
- 'background-position' => 'center center',
- 'background-size' => 'auto',
- 'background-attachment' => 'scroll',
- 'background-type' => '',
- 'background-media' => '',
- ),
- 'footer-adv-text-color' => '',
- 'footer-adv-link-color' => '',
- 'footer-adv-link-h-color' => '',
- 'footer-adv-wgt-title-color' => '',
-
- // Buttons.
- 'button-color' => '',
- 'button-h-color' => '',
- 'button-bg-color' => '',
- 'button-bg-h-color' => '',
- 'theme-button-padding' => array(
- 'desktop' => array(
- 'top' => $apply_new_default_values ? 15 : 10,
- 'right' => $apply_new_default_values ? 30 : 40,
- 'bottom' => $apply_new_default_values ? 15 : 10,
- 'left' => $apply_new_default_values ? 30 : 40,
- ),
- 'tablet' => array(
- 'top' => $apply_new_default_values ? 14 : '',
- 'right' => $apply_new_default_values ? 28 : '',
- 'bottom' => $apply_new_default_values ? 14 : '',
- 'left' => $apply_new_default_values ? 28 : '',
- ),
- 'mobile' => array(
- 'top' => $apply_new_default_values ? 12 : '',
- 'right' => $apply_new_default_values ? 24 : '',
- 'bottom' => $apply_new_default_values ? 12 : '',
- 'left' => $apply_new_default_values ? 24 : '',
- ),
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
- 'button-radius' => 2,
- 'theme-button-border-group-border-size' => array(
- 'top' => '',
- 'right' => '',
- 'bottom' => '',
- 'left' => '',
- ),
- // Footer - Small.
- 'footer-sml-layout' => 'footer-sml-layout-1',
- 'footer-sml-section-1' => 'custom',
- 'footer-sml-section-1-credit' => __( 'Copyright &copy; [current_year] [site_title] | Powered by [theme_author]', 'astra' ),
- 'footer-sml-section-2' => '',
- 'footer-sml-section-2-credit' => __( 'Copyright &copy; [current_year] [site_title] | Powered by [theme_author]', 'astra' ),
- 'footer-sml-dist-equal-align' => true,
- 'footer-sml-divider' => 1,
- 'footer-sml-divider-color' => '#7a7a7a',
- 'footer-layout-width' => 'content',
- // General.
- 'ast-header-retina-logo' => '',
- 'ast-header-logo-width' => '',
- 'ast-header-responsive-logo-width' => array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- ),
- 'header-color-site-title' => '',
- 'header-color-h-site-title' => '',
- 'header-color-site-tagline' => '',
- 'display-site-title-responsive' => array(
- 'desktop' => 1,
- 'tablet' => 1,
- 'mobile' => 1,
- ),
- 'display-site-tagline-responsive' => array(
- 'desktop' => 0,
- 'tablet' => 0,
- 'mobile' => 0,
- ),
- 'logo-title-inline' => 1,
- // Header - Primary.
- 'disable-primary-nav' => false,
- 'header-layouts' => 'header-main-layout-1',
- 'header-main-rt-section' => 'none',
- 'header-display-outside-menu' => false,
- 'header-main-rt-section-html' => '<button>' . __( 'Contact Us', 'astra' ) . '</button>',
- 'header-main-rt-section-button-text' => __( 'Button', 'astra' ),
- 'header-main-rt-section-button-link' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ),
- 'header-main-rt-section-button-link-option' => array(
- 'url' => apply_filters( 'astra_site_url', 'https://www.wpastra.com' ),
- 'new_tab' => false,
- 'link_rel' => '',
- ),
- 'header-main-rt-section-button-style' => 'theme-button',
- 'header-main-rt-section-button-text-color' => '',
- 'header-main-rt-section-button-back-color' => '',
- 'header-main-rt-section-button-text-h-color' => '',
- 'header-main-rt-section-button-back-h-color' => '',
- 'header-main-rt-section-button-padding' => array(
- 'desktop' => array(
- 'top' => '',
- 'right' => '',
- 'bottom' => '',
- 'left' => '',
- ),
- 'tablet' => array(
- 'top' => '',
- 'right' => '',
- 'bottom' => '',
- 'left' => '',
- ),
- 'mobile' => array(
- 'top' => '',
- 'right' => '',
- 'bottom' => '',
- 'left' => '',
- ),
- ),
- 'header-main-rt-section-button-border-size' => array(
- 'top' => '',
- 'right' => '',
- 'bottom' => '',
- 'left' => '',
- ),
- 'header-main-sep' => 1,
- 'header-main-sep-color' => '',
- 'header-main-layout-width' => 'content',
- // Header - Sub menu Border.
- 'primary-submenu-border' => array(
- 'top' => '2',
- 'right' => '0',
- 'bottom' => '0',
- 'left' => '0',
- ),
- 'primary-submenu-item-border' => false,
- 'primary-submenu-b-color' => '',
- 'primary-submenu-item-b-color' => '',
-
- // Primary header button typo options.
- 'primary-header-button-font-family' => 'inherit',
- 'primary-header-button-font-weight' => 'inherit',
- 'primary-header-button-font-size' => array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
- 'primary-header-button-text-transform' => '',
- 'primary-header-button-line-height' => 1,
- 'primary-header-button-letter-spacing' => '',
-
- 'header-main-menu-label' => '',
- 'header-main-menu-align' => 'inline',
- 'header-main-submenu-container-animation' => '',
- 'mobile-header-breakpoint' => '',
- 'mobile-header-logo' => '',
- 'mobile-header-logo-width' => '',
- // Site Layout.
- 'site-layout' => 'ast-full-width-layout',
- 'site-content-width' => 1200,
- 'site-layout-outside-bg-obj-responsive' => array(
- 'desktop' => array(
- 'background-color' => '',
- 'background-image' => '',
- 'background-repeat' => 'repeat',
- 'background-position' => 'center center',
- 'background-size' => 'auto',
- 'background-attachment' => 'scroll',
- 'background-type' => '',
- 'background-media' => '',
- ),
- 'tablet' => array(
- 'background-color' => '',
- 'background-image' => '',
- 'background-repeat' => 'repeat',
- 'background-position' => 'center center',
- 'background-size' => 'auto',
- 'background-attachment' => 'scroll',
- 'background-type' => '',
- 'background-media' => '',
- ),
- 'mobile' => array(
- 'background-color' => '',
- 'background-image' => '',
- 'background-repeat' => 'repeat',
- 'background-position' => 'center center',
- 'background-size' => 'auto',
- 'background-attachment' => 'scroll',
- 'background-type' => '',
- 'background-media' => '',
- ),
- ),
- // Container.
- 'site-content-layout' => 'content-boxed-container',
- 'single-page-content-layout' => 'default',
- 'single-post-content-layout' => 'default',
- 'archive-post-content-layout' => 'default',
- // Typography.
- 'body-font-family' => 'inherit',
- 'body-font-variant' => '',
- 'body-font-weight' => 'inherit',
- 'font-size-body' => array(
- 'desktop' => 15,
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
-
- 'body-line-height' => '',
- 'para-margin-bottom' => '',
- 'underline-content-links' => true,
- 'body-text-transform' => '',
- 'headings-font-family' => 'inherit',
- 'headings-font-weight' => 'inherit',
- 'headings-text-transform' => '',
- 'headings-line-height' => '',
- 'font-size-site-title' => array(
- 'desktop' => 35,
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
- 'font-size-site-tagline' => array(
- 'desktop' => 15,
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
- 'font-size-entry-title' => array(
- 'desktop' => 30,
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
- 'font-size-archive-summary-title' => array(
- 'desktop' => 40,
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
- 'font-size-page-title' => array(
- 'desktop' => 30,
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
- 'font-size-h1' => array(
- 'desktop' => 40,
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
- 'font-size-h2' => array(
- 'desktop' => 30,
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
- 'font-size-h3' => array(
- 'desktop' => 25,
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
- 'font-size-h4' => array(
- 'desktop' => 20,
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
- 'font-size-h5' => array(
- 'desktop' => 18,
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
- 'font-size-h6' => array(
- 'desktop' => 15,
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- ),
-
- // Sidebar.
- 'site-sidebar-layout' => 'right-sidebar',
- 'site-sidebar-width' => 30,
- 'single-page-sidebar-layout' => 'default',
- 'single-post-sidebar-layout' => 'default',
- 'archive-post-sidebar-layout' => 'default',
-
- // Sidebar.
- 'footer-adv' => 'disabled',
- 'footer-adv-border-width' => '',
- 'footer-adv-border-color' => '#7a7a7a',
-
- // toogle menu style.
- 'mobile-header-toggle-btn-style' => 'minimal',
- 'hide-custom-menu-mobile' => 1,
-
- // toogle menu target.
- 'mobile-header-toggle-target' => 'icon',
-
- // Performance.
- 'load-google-fonts-locally' => false,
- 'preload-local-fonts' => false,
- )
- );
-
- return self::$defaults;
- }
-
- /**
- * Get theme options from static array()
- *
- * @return array Return array of theme options.
- */
- public static function get_options() {
- return self::$db_options;
- }
-
- /**
- * Update theme static option array.
- */
- public static function refresh() {
- self::$db_options = wp_parse_args(
- self::get_db_options(),
- self::defaults()
- );
- }
-
- /**
- * Get theme options from static array() from database
- *
- * @return array Return array of theme options from database.
- */
- public static function get_db_options() {
- self::$db_options_no_defaults = get_option( ASTRA_THEME_SETTINGS );
- return self::$db_options_no_defaults;
- }
- }
-}
-/**
- * Kicking this off by calling 'get_instance()' method
- */
-Astra_Theme_Options::get_instance();
+<?php
+/**
+ * Astra Theme Options
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Theme Options
+ */
+if ( ! class_exists( 'Astra_Theme_Options' ) ) {
+ /**
+ * Theme Options
+ */
+ class Astra_Theme_Options {
+
+ /**
+ * Class instance.
+ *
+ * @access private
+ * @var $instance Class instance.
+ */
+ private static $instance;
+
+ /**
+ * Customizer defaults.
+ *
+ * @access Private
+ * @since 1.4.3
+ * @var Array
+ */
+ private static $defaults;
+
+ /**
+ * Post id.
+ *
+ * @var $instance Post id.
+ */
+ public static $post_id = null;
+
+ /**
+ * A static option variable.
+ *
+ * @since 1.0.0
+ * @access private
+ * @var mixed $db_options
+ */
+ private static $db_options;
+
+ /**
+ * A static option variable.
+ *
+ * @since 1.0.0
+ * @access private
+ * @var mixed $db_options
+ */
+ private static $db_options_no_defaults;
+
+ /**
+ * Initiator
+ */
+ public static function get_instance() {
+ if ( ! isset( self::$instance ) ) {
+ self::$instance = new self();
+ }
+ return self::$instance;
+ }
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+
+ // Refresh options variables after customizer save.
+ add_action( 'after_setup_theme', array( $this, 'refresh' ) );
+
+ }
+
+ /**
+ * Set default theme option values
+ *
+ * @since 1.0.0
+ * @return default values of the theme.
+ */
+ public static function defaults() {
+
+ if ( ! is_null( self::$defaults ) ) {
+ return self::$defaults;
+ }
+
+ /**
+ * Update Astra customizer default values. To not update directly on existing users site, added backwards.
+ *
+ * @since 3.6.3
+ */
+ $apply_new_default_values = astra_button_default_padding_updated();
+
+ // Defaults list of options.
+ self::$defaults = apply_filters(
+ 'astra_theme_defaults',
+ array(
+ // Blog Single.
+ 'blog-single-post-structure' => array(
+ 'single-image',
+ 'single-title-meta',
+ ),
+
+ 'blog-single-width' => 'default',
+ 'blog-single-max-width' => 1200,
+ 'blog-single-meta' => array(
+ 'comments',
+ 'category',
+ 'author',
+ ),
+ // Blog.
+ 'blog-post-structure' => array(
+ 'image',
+ 'title-meta',
+ ),
+ 'blog-width' => 'default',
+ 'blog-max-width' => 1200,
+ 'blog-post-content' => 'excerpt',
+ 'blog-meta' => array(
+ 'comments',
+ 'category',
+ 'author',
+ ),
+ // Colors.
+ 'text-color' => '#3a3a3a',
+ 'link-color' => '#0170B9',
+ 'theme-color' => '#0170B9',
+ 'link-h-color' => '#3a3a3a',
+
+ // Footer Bar Background.
+ 'footer-bg-obj' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ 'background-type' => '',
+ 'background-media' => '',
+ ),
+ 'footer-color' => '',
+ 'footer-link-color' => '',
+ 'footer-link-h-color' => '',
+
+ // Footer Widgets Background.
+ 'footer-adv-bg-obj' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ 'background-type' => '',
+ 'background-media' => '',
+ ),
+ 'footer-adv-text-color' => '',
+ 'footer-adv-link-color' => '',
+ 'footer-adv-link-h-color' => '',
+ 'footer-adv-wgt-title-color' => '',
+
+ // Buttons.
+ 'button-color' => '',
+ 'button-h-color' => '',
+ 'button-bg-color' => '',
+ 'button-bg-h-color' => '',
+ 'theme-button-padding' => array(
+ 'desktop' => array(
+ 'top' => $apply_new_default_values ? 15 : 10,
+ 'right' => $apply_new_default_values ? 30 : 40,
+ 'bottom' => $apply_new_default_values ? 15 : 10,
+ 'left' => $apply_new_default_values ? 30 : 40,
+ ),
+ 'tablet' => array(
+ 'top' => $apply_new_default_values ? 14 : '',
+ 'right' => $apply_new_default_values ? 28 : '',
+ 'bottom' => $apply_new_default_values ? 14 : '',
+ 'left' => $apply_new_default_values ? 28 : '',
+ ),
+ 'mobile' => array(
+ 'top' => $apply_new_default_values ? 12 : '',
+ 'right' => $apply_new_default_values ? 24 : '',
+ 'bottom' => $apply_new_default_values ? 12 : '',
+ 'left' => $apply_new_default_values ? 24 : '',
+ ),
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'button-radius' => 2,
+ 'theme-button-border-group-border-size' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ // Footer - Small.
+ 'footer-sml-layout' => 'footer-sml-layout-1',
+ 'footer-sml-section-1' => 'custom',
+ 'footer-sml-section-1-credit' => __( 'Copyright &copy; [current_year] [site_title] | Powered by [theme_author]', 'astra' ),
+ 'footer-sml-section-2' => '',
+ 'footer-sml-section-2-credit' => __( 'Copyright &copy; [current_year] [site_title] | Powered by [theme_author]', 'astra' ),
+ 'footer-sml-dist-equal-align' => true,
+ 'footer-sml-divider' => 1,
+ 'footer-sml-divider-color' => '#7a7a7a',
+ 'footer-layout-width' => 'content',
+ // General.
+ 'ast-header-retina-logo' => '',
+ 'ast-header-logo-width' => '',
+ 'ast-header-responsive-logo-width' => array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ ),
+ 'header-color-site-title' => '',
+ 'header-color-h-site-title' => '',
+ 'header-color-site-tagline' => '',
+ 'display-site-title-responsive' => array(
+ 'desktop' => 1,
+ 'tablet' => 1,
+ 'mobile' => 1,
+ ),
+ 'display-site-tagline-responsive' => array(
+ 'desktop' => 0,
+ 'tablet' => 0,
+ 'mobile' => 0,
+ ),
+ 'logo-title-inline' => 1,
+ // Header - Primary.
+ 'disable-primary-nav' => false,
+ 'header-layouts' => 'header-main-layout-1',
+ 'header-main-rt-section' => 'none',
+ 'header-display-outside-menu' => false,
+ 'header-main-rt-section-html' => '<button>' . __( 'Contact Us', 'astra' ) . '</button>',
+ 'header-main-rt-section-button-text' => __( 'Button', 'astra' ),
+ 'header-main-rt-section-button-link' => apply_filters( 'astra_site_url', 'https://www.adelielinux.org/' ),
+ 'header-main-rt-section-button-link-option' => array(
+ 'url' => apply_filters( 'astra_site_url', 'https://www.adelielinux.org/' ),
+ 'new_tab' => false,
+ 'link_rel' => '',
+ ),
+ 'header-main-rt-section-button-style' => 'theme-button',
+ 'header-main-rt-section-button-text-color' => '',
+ 'header-main-rt-section-button-back-color' => '',
+ 'header-main-rt-section-button-text-h-color' => '',
+ 'header-main-rt-section-button-back-h-color' => '',
+ 'header-main-rt-section-button-padding' => array(
+ 'desktop' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'tablet' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'mobile' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ ),
+ 'header-main-rt-section-button-border-size' => array(
+ 'top' => '',
+ 'right' => '',
+ 'bottom' => '',
+ 'left' => '',
+ ),
+ 'header-main-sep' => 1,
+ 'header-main-sep-color' => '',
+ 'header-main-layout-width' => 'content',
+ // Header - Sub menu Border.
+ 'primary-submenu-border' => array(
+ 'top' => '2',
+ 'right' => '0',
+ 'bottom' => '0',
+ 'left' => '0',
+ ),
+ 'primary-submenu-item-border' => false,
+ 'primary-submenu-b-color' => '',
+ 'primary-submenu-item-b-color' => '',
+
+ // Primary header button typo options.
+ 'primary-header-button-font-family' => 'inherit',
+ 'primary-header-button-font-weight' => 'inherit',
+ 'primary-header-button-font-size' => array(
+ 'desktop' => '',
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'primary-header-button-text-transform' => '',
+ 'primary-header-button-line-height' => 1,
+ 'primary-header-button-letter-spacing' => '',
+
+ 'header-main-menu-label' => '',
+ 'header-main-menu-align' => 'inline',
+ 'header-main-submenu-container-animation' => '',
+ 'mobile-header-breakpoint' => '',
+ 'mobile-header-logo' => '',
+ 'mobile-header-logo-width' => '',
+ // Site Layout.
+ 'site-layout' => 'ast-full-width-layout',
+ 'site-content-width' => 1200,
+ 'site-layout-outside-bg-obj-responsive' => array(
+ 'desktop' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ 'background-type' => '',
+ 'background-media' => '',
+ ),
+ 'tablet' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ 'background-type' => '',
+ 'background-media' => '',
+ ),
+ 'mobile' => array(
+ 'background-color' => '',
+ 'background-image' => '',
+ 'background-repeat' => 'repeat',
+ 'background-position' => 'center center',
+ 'background-size' => 'auto',
+ 'background-attachment' => 'scroll',
+ 'background-type' => '',
+ 'background-media' => '',
+ ),
+ ),
+ // Container.
+ 'site-content-layout' => 'content-boxed-container',
+ 'single-page-content-layout' => 'default',
+ 'single-post-content-layout' => 'default',
+ 'archive-post-content-layout' => 'default',
+ // Typography.
+ 'body-font-family' => 'inherit',
+ 'body-font-variant' => '',
+ 'body-font-weight' => 'inherit',
+ 'font-size-body' => array(
+ 'desktop' => 15,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+
+ 'body-line-height' => '',
+ 'para-margin-bottom' => '',
+ 'underline-content-links' => true,
+ 'body-text-transform' => '',
+ 'headings-font-family' => 'inherit',
+ 'headings-font-weight' => 'inherit',
+ 'headings-text-transform' => '',
+ 'headings-line-height' => '',
+ 'font-size-site-title' => array(
+ 'desktop' => 35,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-site-tagline' => array(
+ 'desktop' => 15,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-entry-title' => array(
+ 'desktop' => 30,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-archive-summary-title' => array(
+ 'desktop' => 40,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-page-title' => array(
+ 'desktop' => 30,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-h1' => array(
+ 'desktop' => 40,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-h2' => array(
+ 'desktop' => 30,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-h3' => array(
+ 'desktop' => 25,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-h4' => array(
+ 'desktop' => 20,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-h5' => array(
+ 'desktop' => 18,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+ 'font-size-h6' => array(
+ 'desktop' => 15,
+ 'tablet' => '',
+ 'mobile' => '',
+ 'desktop-unit' => 'px',
+ 'tablet-unit' => 'px',
+ 'mobile-unit' => 'px',
+ ),
+
+ // Sidebar.
+ 'site-sidebar-layout' => 'right-sidebar',
+ 'site-sidebar-width' => 30,
+ 'single-page-sidebar-layout' => 'default',
+ 'single-post-sidebar-layout' => 'default',
+ 'archive-post-sidebar-layout' => 'default',
+
+ // Sidebar.
+ 'footer-adv' => 'disabled',
+ 'footer-adv-border-width' => '',
+ 'footer-adv-border-color' => '#7a7a7a',
+
+ // toogle menu style.
+ 'mobile-header-toggle-btn-style' => 'minimal',
+ 'hide-custom-menu-mobile' => 1,
+
+ // toogle menu target.
+ 'mobile-header-toggle-target' => 'icon',
+
+ // Performance.
+ 'load-google-fonts-locally' => false,
+ 'preload-local-fonts' => false,
+ )
+ );
+
+ return self::$defaults;
+ }
+
+ /**
+ * Get theme options from static array()
+ *
+ * @return array Return array of theme options.
+ */
+ public static function get_options() {
+ return self::$db_options;
+ }
+
+ /**
+ * Update theme static option array.
+ */
+ public static function refresh() {
+ self::$db_options = wp_parse_args(
+ self::get_db_options(),
+ self::defaults()
+ );
+ }
+
+ /**
+ * Get theme options from static array() from database
+ *
+ * @return array Return array of theme options from database.
+ */
+ public static function get_db_options() {
+ self::$db_options_no_defaults = get_option( ASTRA_THEME_SETTINGS );
+ return self::$db_options_no_defaults;
+ }
+ }
+}
+/**
+ * Kicking this off by calling 'get_instance()' method
+ */
+Astra_Theme_Options::get_instance();
diff --git a/inc/core/class-astra-walker-page.php b/inc/core/class-astra-walker-page.php
index b4d0082..ecaf99c 100644
--- a/inc/core/class-astra-walker-page.php
+++ b/inc/core/class-astra-walker-page.php
@@ -1,137 +1,137 @@
-<?php
-/**
- * Navigation Menu customizations.
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.5.4
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-/**
- * Custom wp_nav_menu walker.
- *
- * @package Astra WordPress theme
- */
-if ( ! class_exists( 'Astra_Walker_Page' ) ) {
-
- /**
- * Astra custom navigation walker.
- *
- * @since 1.5.4
- */
- class Astra_Walker_Page extends Walker_Page {
-
- /**
- * Outputs the beginning of the current level in the tree before elements are output.
- *
- * @since 1.5.4
- *
- * @see Walker::start_lvl()
- *
- * @param string $output Used to append additional content (passed by reference).
- * @param int $depth Optional. Depth of page. Used for padding. Default 0.
- * @param array $args Optional. Arguments for outputting the next level.
- * Default empty array.
- */
- public function start_lvl( &$output, $depth = 0, $args = array() ) {
- if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
- $t = "\t";
- $n = "\n";
- } else {
- $t = '';
- $n = '';
- }
- $indent = str_repeat( $t, $depth );
- $output .= "{$n}{$indent}<ul class='children sub-menu'>{$n}";
- $output = apply_filters( 'astra_caret_wrap_filter', $output, $args['sort_column'] );
-
- }
-
- /**
- * Outputs the beginning of the current element in the tree.
- *
- * @see Walker::start_el()
- * @since 1.7.2
- *
- * @param string $output Used to append additional content. Passed by reference.
- * @param WP_Post $page Page data object.
- * @param int $depth Optional. Depth of page. Used for padding. Default 0.
- * @param array $args Optional. Array of arguments. Default empty array.
- * @param int $current_page Optional. Page ID. Default 0.
- */
- public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
- $css_class = array( 'page_item', 'page-item-' . $page->ID );
- $icon = '';
- $mobile_icon = '';
-
- if ( isset( $args['pages_with_children'][ $page->ID ] ) ) {
- $css_class[] = 'menu-item-has-children';
- $icon = Astra_Icons::get_icons( 'arrow' );
- $icon = '<span role="presentation" class="dropdown-menu-toggle">' . $icon . '</span>';
- // Add toggle button if menu is from Astra.
- if ( true === is_object( $args ) ) {
- if ( isset( $args->theme_location ) &&
- ( 'primary' === $args->theme_location ||
- 'above_header_menu' === $args->theme_location ||
- 'below_header_menu' === $args->theme_location )
- ) {
- $mobile_icon = '<button ' . astra_attr(
- 'ast-menu-toggle',
- array(
- 'aria-expanded' => 'false',
- ),
- $page
- ) . '><span class="screen-reader-text">' . __( 'Menu Toggle', 'astra' ) . '</span>' . Astra_Icons::get_icons( 'arrow' ) . '</button>';
- }
- } else {
- if ( isset( $page->post_parent ) && 0 === $page->post_parent ) {
- $mobile_icon = '<button ' . astra_attr(
- 'ast-menu-toggle',
- array(
- 'aria-expanded' => 'false',
- ),
- $page
- ) . '><span class="screen-reader-text">' . __( 'Menu Toggle', 'astra' ) . '</span>' . Astra_Icons::get_icons( 'arrow' ) . '</button>';
- }
- }
- }
-
- if ( ! empty( $current_page ) ) {
- $_current_page = get_post( $current_page );
- if ( $_current_page && in_array( $page->ID, $_current_page->ancestors ) ) {
- $css_class[] = 'current-menu-ancestor';
- }
- if ( $page->ID == $current_page ) {
- $css_class[] = 'current-menu-item';
- } elseif ( $_current_page && $page->ID == $_current_page->post_parent ) {
- $css_class[] = 'current-menu-parent';
- }
- } elseif ( get_option( 'page_for_posts' ) == $page->ID ) {
- $css_class[] = 'current-menu-parent';
- }
-
- $css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
-
- $args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before'];
- $args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after'];
-
- $output .= sprintf(
- '<li class="%s"><a href="%s" class="menu-link">%s%s%s%s</a>%s',
- $css_classes,
- get_permalink( $page->ID ),
- $args['link_before'],
- apply_filters( 'the_title', $page->post_title, $page->ID ),
- $args['link_after'],
- $icon,
- $mobile_icon
- );
- }
- }
-
-}
+<?php
+/**
+ * Navigation Menu customizations.
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.5.4
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Custom wp_nav_menu walker.
+ *
+ * @package Astra WordPress theme
+ */
+if ( ! class_exists( 'Astra_Walker_Page' ) ) {
+
+ /**
+ * Astra custom navigation walker.
+ *
+ * @since 1.5.4
+ */
+ class Astra_Walker_Page extends Walker_Page {
+
+ /**
+ * Outputs the beginning of the current level in the tree before elements are output.
+ *
+ * @since 1.5.4
+ *
+ * @see Walker::start_lvl()
+ *
+ * @param string $output Used to append additional content (passed by reference).
+ * @param int $depth Optional. Depth of page. Used for padding. Default 0.
+ * @param array $args Optional. Arguments for outputting the next level.
+ * Default empty array.
+ */
+ public function start_lvl( &$output, $depth = 0, $args = array() ) {
+ if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
+ $t = "\t";
+ $n = "\n";
+ } else {
+ $t = '';
+ $n = '';
+ }
+ $indent = str_repeat( $t, $depth );
+ $output .= "{$n}{$indent}<ul class='children sub-menu'>{$n}";
+ $output = apply_filters( 'astra_caret_wrap_filter', $output, $args['sort_column'] );
+
+ }
+
+ /**
+ * Outputs the beginning of the current element in the tree.
+ *
+ * @see Walker::start_el()
+ * @since 1.7.2
+ *
+ * @param string $output Used to append additional content. Passed by reference.
+ * @param WP_Post $page Page data object.
+ * @param int $depth Optional. Depth of page. Used for padding. Default 0.
+ * @param array $args Optional. Array of arguments. Default empty array.
+ * @param int $current_page Optional. Page ID. Default 0.
+ */
+ public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
+ $css_class = array( 'page_item', 'page-item-' . $page->ID );
+ $icon = '';
+ $mobile_icon = '';
+
+ if ( isset( $args['pages_with_children'][ $page->ID ] ) ) {
+ $css_class[] = 'menu-item-has-children';
+ $icon = Astra_Icons::get_icons( 'arrow' );
+ $icon = '<span role="presentation" class="dropdown-menu-toggle">' . $icon . '</span>';
+ // Add toggle button if menu is from Astra.
+ if ( true === is_object( $args ) ) {
+ if ( isset( $args->theme_location ) &&
+ ( 'primary' === $args->theme_location ||
+ 'above_header_menu' === $args->theme_location ||
+ 'below_header_menu' === $args->theme_location )
+ ) {
+ $mobile_icon = '<button ' . astra_attr(
+ 'ast-menu-toggle',
+ array(
+ 'aria-expanded' => 'false',
+ ),
+ $page
+ ) . '><span class="screen-reader-text">' . __( 'Menu Toggle', 'astra' ) . '</span>' . Astra_Icons::get_icons( 'arrow' ) . '</button>';
+ }
+ } else {
+ if ( isset( $page->post_parent ) && 0 === $page->post_parent ) {
+ $mobile_icon = '<button ' . astra_attr(
+ 'ast-menu-toggle',
+ array(
+ 'aria-expanded' => 'false',
+ ),
+ $page
+ ) . '><span class="screen-reader-text">' . __( 'Menu Toggle', 'astra' ) . '</span>' . Astra_Icons::get_icons( 'arrow' ) . '</button>';
+ }
+ }
+ }
+
+ if ( ! empty( $current_page ) ) {
+ $_current_page = get_post( $current_page );
+ if ( $_current_page && in_array( $page->ID, $_current_page->ancestors ) ) {
+ $css_class[] = 'current-menu-ancestor';
+ }
+ if ( $page->ID == $current_page ) {
+ $css_class[] = 'current-menu-item';
+ } elseif ( $_current_page && $page->ID == $_current_page->post_parent ) {
+ $css_class[] = 'current-menu-parent';
+ }
+ } elseif ( get_option( 'page_for_posts' ) == $page->ID ) {
+ $css_class[] = 'current-menu-parent';
+ }
+
+ $css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
+
+ $args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before'];
+ $args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after'];
+
+ $output .= sprintf(
+ '<li class="%s"><a href="%s" class="menu-link">%s%s%s%s</a>%s',
+ $css_classes,
+ get_permalink( $page->ID ),
+ $args['link_before'],
+ apply_filters( 'the_title', $page->post_title, $page->ID ),
+ $args['link_after'],
+ $icon,
+ $mobile_icon
+ );
+ }
+ }
+
+}
diff --git a/inc/core/class-gutenberg-editor-css.php b/inc/core/class-gutenberg-editor-css.php
index c77182b..6a681b4 100644
--- a/inc/core/class-gutenberg-editor-css.php
+++ b/inc/core/class-gutenberg-editor-css.php
@@ -1,1116 +1,1116 @@
-<?php
-/**
- * Gutenberg Editor CSS
- *
- * @link https://developer.wordpress.org/themes/basics/theme-functions/
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link http://wpastra.com/
- * @since Astra 1.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-if ( ! class_exists( 'Gutenberg_Editor_CSS' ) ) :
-
- /**
- * Admin Helper
- */
- class Gutenberg_Editor_CSS {
-
- /**
- * Get dynamic CSS required for the block editor to make editing experience similar to how it looks on frontend.
- *
- * @return String CSS to be loaded in the editor interface.
- */
- public static function get_css() {
- global $pagenow;
- global $post;
- $post_id = astra_get_post_id();
- $is_site_rtl = is_rtl();
-
- $site_content_width = astra_get_option( 'site-content-width', 1200 ) + 56;
- $headings_font_family = astra_get_option( 'headings-font-family' );
- $headings_font_weight = astra_get_option( 'headings-font-weight' );
- $headings_text_transform = astra_get_option( 'headings-text-transform' );
- $headings_line_height = astra_get_option( 'headings-line-height' );
- $single_post_title_font_size = astra_get_option( 'font-size-entry-title' );
- $body_font_family = astra_body_font_family();
- $para_margin_bottom = astra_get_option( 'para-margin-bottom' );
- $theme_color = astra_get_option( 'theme-color' );
- $link_color = astra_get_option( 'link-color', $theme_color );
- $heading_base_color = astra_get_option( 'heading-base-color' );
-
- $highlight_theme_color = astra_get_foreground_color( $theme_color );
-
- $body_font_weight = astra_get_option( 'body-font-weight' );
- $body_font_size = astra_get_option( 'font-size-body' );
- $body_line_height = astra_get_option( 'body-line-height' );
- $body_text_transform = astra_get_option( 'body-text-transform' );
- $box_bg_obj = astra_get_option( 'site-layout-outside-bg-obj-responsive' );
- $text_color = astra_get_option( 'text-color' );
-
- $heading_h1_font_size = astra_get_option( 'font-size-h1' );
- $heading_h2_font_size = astra_get_option( 'font-size-h2' );
- $heading_h3_font_size = astra_get_option( 'font-size-h3' );
- $heading_h4_font_size = astra_get_option( 'font-size-h4' );
- $heading_h5_font_size = astra_get_option( 'font-size-h5' );
- $heading_h6_font_size = astra_get_option( 'font-size-h6' );
-
- /**
- * WooCommerce Grid Products compatibility.
- */
- $link_h_color = astra_get_option( 'link-h-color' );
- $btn_color = astra_get_option( 'button-color' );
- $btn_bg_color = astra_get_option( 'button-bg-color', '', $theme_color );
- $btn_h_color = astra_get_option( 'button-h-color' );
- $btn_bg_h_color = astra_get_option( 'button-bg-h-color', '', $link_h_color );
- $btn_border_radius = astra_get_option( 'button-radius' );
- $theme_btn_padding = astra_get_option( 'theme-button-padding' );
-
- /**
- * Button theme compatibility.
- */
- $global_custom_button_border_size = astra_get_option( 'theme-button-border-group-border-size' );
- $btn_border_color = astra_get_option( 'theme-button-border-group-border-color' );
- $btn_border_h_color = astra_get_option( 'theme-button-border-group-border-h-color' );
-
- /**
- * Theme Button Typography
- */
- $theme_btn_font_family = astra_get_option( 'font-family-button' );
- $theme_btn_font_size = astra_get_option( 'font-size-button' );
- $theme_btn_font_weight = astra_get_option( 'font-weight-button' );
- $theme_btn_text_transform = astra_get_option( 'text-transform-button' );
- $theme_btn_line_height = astra_get_option( 'theme-btn-line-height' );
- $theme_btn_letter_spacing = astra_get_option( 'theme-btn-letter-spacing' );
-
- $h1_font_family = astra_get_option( 'font-family-h1' );
- $h1_font_weight = astra_get_option( 'font-weight-h1' );
- $h1_line_height = astra_get_option( 'line-height-h1' );
- $h1_text_transform = astra_get_option( 'text-transform-h1' );
-
- $h2_font_family = astra_get_option( 'font-family-h2' );
- $h2_font_weight = astra_get_option( 'font-weight-h2' );
- $h2_line_height = astra_get_option( 'line-height-h2' );
- $h2_text_transform = astra_get_option( 'text-transform-h2' );
-
- $h3_font_family = astra_get_option( 'font-family-h3' );
- $h3_font_weight = astra_get_option( 'font-weight-h3' );
- $h3_line_height = astra_get_option( 'line-height-h3' );
- $h3_text_transform = astra_get_option( 'text-transform-h3' );
-
- $single_post_title = astra_get_option( 'blog-single-post-structure' );
- $title_enabled_from_meta = get_post_meta( $post_id, 'site-post-title', true );
-
- $is_widget_title_support_font_weight = Astra_Dynamic_CSS::support_font_css_to_widget_and_in_editor();
- $font_weight_prop = ( $is_widget_title_support_font_weight ) ? 'inherit' : 'normal';
-
- // Fallback for H1 - headings typography.
- if ( 'inherit' == $h1_font_family ) {
- $h1_font_family = $headings_font_family;
- }
- if ( $font_weight_prop === $h1_font_weight ) {
- $h1_font_weight = $headings_font_weight;
- }
- if ( '' == $h1_text_transform ) {
- $h1_text_transform = $headings_text_transform;
- }
- if ( '' == $h1_line_height ) {
- $h1_line_height = $headings_line_height;
- }
-
- // Fallback for H2 - headings typography.
- if ( 'inherit' == $h2_font_family ) {
- $h2_font_family = $headings_font_family;
- }
- if ( $font_weight_prop === $h2_font_weight ) {
- $h2_font_weight = $headings_font_weight;
- }
- if ( '' == $h2_text_transform ) {
- $h2_text_transform = $headings_text_transform;
- }
- if ( '' == $h2_line_height ) {
- $h2_line_height = $headings_line_height;
- }
-
- // Fallback for H3 - headings typography.
- if ( 'inherit' == $h3_font_family ) {
- $h3_font_family = $headings_font_family;
- }
- if ( $font_weight_prop === $h3_font_weight ) {
- $h3_font_weight = $headings_font_weight;
- }
- if ( '' == $h3_text_transform ) {
- $h3_text_transform = $headings_text_transform;
- }
- if ( '' == $h3_line_height ) {
- $h3_line_height = $headings_line_height;
- }
-
- // Fallback for H4 - headings typography.
- $h4_line_height = $headings_line_height;
-
- // Fallback for H5 - headings typography.
- $h5_line_height = $headings_line_height;
-
- // Fallback for H6 - headings typography.
- $h6_line_height = $headings_line_height;
-
- if ( empty( $btn_color ) ) {
- $btn_color = astra_get_foreground_color( $theme_color );
- }
-
- if ( empty( $btn_h_color ) ) {
- $btn_h_color = astra_get_foreground_color( $link_h_color );
- }
-
- if ( is_array( $body_font_size ) ) {
- $body_font_size_desktop = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15;
- } else {
- $body_font_size_desktop = ( '' != $body_font_size ) ? $body_font_size : 15;
- }
-
- // check the selection color incase of empty/no theme color.
- $selection_text_color = ( 'transparent' === $highlight_theme_color ) ? '' : $highlight_theme_color;
-
- $css = '';
-
- $desktop_css = array(
- 'html' => array(
- 'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 6.25, '%' ),
- ),
- 'a' => array(
- 'color' => esc_attr( $link_color ),
- ),
-
- // Global selection CSS.
- '.block-editor-block-list__layout .block-editor-block-list__block ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit:before' => array(
- 'background-color' => esc_attr( $theme_color ),
- ),
- '.block-editor-block-list__layout .block-editor-block-list__block ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit' => array(
- 'color' => esc_attr( $selection_text_color ),
- ),
- '.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'desktop' ),
- '.editor-post-title__block,.editor-default-block-appender,.block-editor-block-list__block' => array(
- 'max-width' => astra_get_css_value( $site_content_width, 'px' ),
- ),
- '.block-editor-block-list__block[data-align=wide]' => array(
- 'max-width' => astra_get_css_value( $site_content_width + 200, 'px' ),
- ),
- '.editor-post-title__block .editor-post-title__input, .edit-post-visual-editor .block-editor-block-list__block h1, .edit-post-visual-editor .block-editor-block-list__block h2, .edit-post-visual-editor .block-editor-block-list__block h3, .edit-post-visual-editor .block-editor-block-list__block h4, .edit-post-visual-editor .block-editor-block-list__block h5, .edit-post-visual-editor .block-editor-block-list__block h6' => array(
- 'font-family' => astra_get_css_value( $headings_font_family, 'font' ),
- 'font-weight' => astra_get_css_value( $headings_font_weight, 'font' ),
- 'text-transform' => esc_attr( $headings_text_transform ),
- ),
- '.edit-post-visual-editor h1, .edit-post-visual-editor h2, .edit-post-visual-editor h3, .edit-post-visual-editor h4, .edit-post-visual-editor h5, .edit-post-visual-editor h6' => array(
- 'line-height' => esc_attr( $headings_line_height ),
- ),
- '.edit-post-visual-editor.editor-styles-wrapper p,.block-editor-block-list__block p, .block-editor-block-list__layout, .editor-post-title' => array(
- 'font-size' => astra_responsive_font( $body_font_size, 'desktop' ),
- ),
- '.edit-post-visual-editor.editor-styles-wrapper p,.block-editor-block-list__block p, .wp-block-latest-posts a,.editor-default-block-appender textarea.editor-default-block-appender__content, .block-editor-block-list__block, .block-editor-block-list__block h1, .block-editor-block-list__block h2, .block-editor-block-list__block h3, .block-editor-block-list__block h4, .block-editor-block-list__block h5, .block-editor-block-list__block h6, .edit-post-visual-editor .editor-styles-wrapper' => array(
- 'font-family' => astra_get_font_family( $body_font_family ),
- 'font-weight' => esc_attr( $body_font_weight ),
- 'font-size' => astra_responsive_font( $body_font_size, 'desktop' ),
- 'line-height' => esc_attr( $body_line_height ),
- 'text-transform' => esc_attr( $body_text_transform ),
- 'margin-bottom' => astra_get_css_value( $para_margin_bottom, 'em' ),
- ),
- '.editor-post-title__block .editor-post-title__input' => array(
- 'font-family' => ( 'inherit' === $headings_font_family ) ? astra_get_font_family( $body_font_family ) : astra_get_font_family( $headings_font_family ),
- 'font-size' => astra_responsive_font( $single_post_title_font_size, 'desktop' ),
- 'font-weight' => 'normal',
- ),
- '.block-editor-block-list__block' => array(
- 'color' => esc_attr( $text_color ),
- ),
- /**
- * Content base heading color.
- */
- '.editor-post-title__block .editor-post-title__input, .wc-block-grid__product-title, .edit-post-visual-editor .block-editor-block-list__block h1, .edit-post-visual-editor .block-editor-block-list__block h2, .edit-post-visual-editor .block-editor-block-list__block h3, .edit-post-visual-editor .block-editor-block-list__block h4, .edit-post-visual-editor .block-editor-block-list__block h5, .edit-post-visual-editor .block-editor-block-list__block h6, .edit-post-visual-editor .wp-block-heading, .edit-post-visual-editor .wp-block-uagb-advanced-heading h1, .edit-post-visual-editor .wp-block-uagb-advanced-heading h2, .edit-post-visual-editor .wp-block-uagb-advanced-heading h3, .edit-post-visual-editor .wp-block-uagb-advanced-heading h4, .edit-post-visual-editor .wp-block-uagb-advanced-heading h5, .edit-post-visual-editor .wp-block-uagb-advanced-heading h6' => array(
- 'color' => esc_attr( $heading_base_color ),
- ),
- // Blockquote Text Color.
- 'blockquote' => array(
- 'color' => astra_adjust_brightness( $text_color, 75, 'darken' ),
- ),
- 'blockquote .editor-rich-text__tinymce a' => array(
- 'color' => astra_hex_to_rgba( $link_color, 1 ),
- ),
- 'blockquote' => array(
- 'border-color' => astra_hex_to_rgba( $link_color, 0.05 ),
- ),
- '.block-editor-block-list__block .wp-block-quote:not(.is-large):not(.is-style-large), .edit-post-visual-editor .wp-block-pullquote blockquote' => array(
- 'border-color' => astra_hex_to_rgba( $link_color, 0.15 ),
- ),
-
- // Heading H1 - H6 font size.
- '.edit-post-visual-editor .block-editor-block-list__block h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1, .edit-post-visual-editor h1.block-editor-block-list__block' => array(
- 'font-size' => astra_responsive_font( $heading_h1_font_size, 'desktop' ),
- 'font-family' => astra_get_css_value( $h1_font_family, 'font' ),
- 'font-weight' => astra_get_css_value( $h1_font_weight, 'font' ),
- 'line-height' => esc_attr( $h1_line_height ),
- 'text-transform' => esc_attr( $h1_text_transform ),
- ),
- '.edit-post-visual-editor .block-editor-block-list__block h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2, .edit-post-visual-editor h2.block-editor-block-list__block' => array(
- 'font-size' => astra_responsive_font( $heading_h2_font_size, 'desktop' ),
- 'font-family' => astra_get_css_value( $h2_font_family, 'font' ),
- 'font-weight' => astra_get_css_value( $h2_font_weight, 'font' ),
- 'line-height' => esc_attr( $h2_line_height ),
- 'text-transform' => esc_attr( $h2_text_transform ),
- ),
- '.edit-post-visual-editor .block-editor-block-list__block h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3, .edit-post-visual-editor h3.block-editor-block-list__block' => array(
- 'font-size' => astra_responsive_font( $heading_h3_font_size, 'desktop' ),
- 'font-family' => astra_get_css_value( $h3_font_family, 'font' ),
- 'font-weight' => astra_get_css_value( $h3_font_weight, 'font' ),
- 'line-height' => esc_attr( $h3_line_height ),
- 'text-transform' => esc_attr( $h3_text_transform ),
- ),
- '.edit-post-visual-editor .block-editor-block-list__block h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4, .edit-post-visual-editor h4.block-editor-block-list__block' => array(
- 'font-size' => astra_responsive_font( $heading_h4_font_size, 'desktop' ),
- 'line-height' => esc_attr( $h4_line_height ),
- ),
- '.edit-post-visual-editor .block-editor-block-list__block h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5, .edit-post-visual-editor h5.block-editor-block-list__block' => array(
- 'font-size' => astra_responsive_font( $heading_h5_font_size, 'desktop' ),
- 'line-height' => esc_attr( $h5_line_height ),
- ),
- '.edit-post-visual-editor .block-editor-block-list__block h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6, .edit-post-visual-editor h6.block-editor-block-list__block' => array(
- 'font-size' => astra_responsive_font( $heading_h6_font_size, 'desktop' ),
- 'line-height' => esc_attr( $h6_line_height ),
- ),
- /**
- * WooCommerce Grid Products compatibility.
- */
- '.wc-block-grid__product-title' => array(
- 'color' => esc_attr( $text_color ),
- ),
- '.wc-block-grid__product .wc-block-grid__product-onsale' => array(
- 'background-color' => $theme_color,
- 'color' => astra_get_foreground_color( $theme_color ),
- ),
- '.editor-styles-wrapper .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,
- ),
- '.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,
- ),
- '.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' ),
- ),
- );
-
- if ( astra_wp_version_compare( '5.7', '>=' ) ) {
- $base_background_color = astra_get_responsive_background_obj( $box_bg_obj, 'desktop' );
- if ( empty( $base_background_color ) ) {
- $background_style_data = array(
- 'background-color' => '#ffffff',
- );
- } else {
- $background_style_data = $base_background_color;
- }
-
- $desktop_css['.edit-post-visual-editor'] = array(
- 'padding' => '20px',
- 'padding-top' => 'calc(2em + 20px)',
- );
- $desktop_css['.ast-page-builder-template .edit-post-visual-editor'] = array(
- 'padding' => '0',
- 'padding-top' => '2em',
- );
- $desktop_css['.ast-separate-container .editor-post-title'] = array(
- 'margin-top' => '0',
- );
- $desktop_css['.editor-styles-wrapper .block-editor-writing-flow'] = array(
- 'height' => '100%',
- 'padding' => '10px',
- );
- $desktop_css['.edit-post-visual-editor .editor-styles-wrapper'] = array(
- 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
- 'width' => '100%',
- 'margin' => '0 auto',
- 'padding' => '0',
- );
- $desktop_css['.ast-page-builder-template .edit-post-visual-editor .editor-styles-wrapper'] = array(
- 'max-width' => '100%',
- );
- $desktop_css['.ast-separate-container .edit-post-visual-editor .block-editor-block-list__layout .wp-block[data-align="full"] figure.wp-block-image, .ast-separate-container .edit-post-visual-editor .wp-block[data-align="full"] .wp-block-cover'] = array(
- 'margin-left' => 'calc(-4.8em - 10px)',
- 'margin-right' => 'calc(-4.8em - 10px)',
- );
- $desktop_css['.ast-page-builder-template .editor-styles-wrapper .block-editor-writing-flow, .ast-plain-container .editor-styles-wrapper .block-editor-writing-flow, #editor .edit-post-visual-editor'] = $background_style_data;
- }
-
- if ( ( ( ! in_array( 'single-title-meta', $single_post_title ) ) && ( 'post' === get_post_type() ) ) || ( 'disabled' === $title_enabled_from_meta ) ) {
- $destop_title_css = array(
- '.editor-post-title__block' => array(
- 'opacity' => '0.2',
- ),
- );
- $css .= astra_parse_css( $destop_title_css );
- }
-
- $content_links_underline = astra_get_option( 'underline-content-links' );
-
- if ( $content_links_underline ) {
- $desktop_css['.edit-post-visual-editor a'] = array(
- 'text-decoration' => 'underline',
- );
- }
-
- $css .= astra_parse_css( $desktop_css );
-
- /**
- * Global button CSS - Tablet.
- */
- $css_prod_button_tablet = array(
- '.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' ),
- ),
- );
-
- if ( astra_wp_version_compare( '5.7', '>=' ) ) {
- $css_prod_button_tablet['.ast-page-builder-template .editor-styles-wrapper .block-editor-writing-flow, .ast-plain-container .editor-styles-wrapper .block-editor-writing-flow'] = astra_get_responsive_background_obj( $box_bg_obj, 'tablet' );
- }
-
- $css .= astra_parse_css( $css_prod_button_tablet, '', astra_get_tablet_breakpoint() );
-
- /**
- * Global button CSS - Mobile.
- */
- $css_prod_button_mobile = array(
- '.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' ),
- ),
- );
-
- if ( astra_wp_version_compare( '5.7', '>=' ) ) {
- $css_prod_button_mobile['.ast-page-builder-template .editor-styles-wrapper .block-editor-writing-flow, .ast-plain-container .editor-styles-wrapper .block-editor-writing-flow'] = astra_get_responsive_background_obj( $box_bg_obj, 'mobile' );
- }
-
- $css .= astra_parse_css( $css_prod_button_mobile, '', astra_get_mobile_breakpoint() );
-
- $theme_btn_top_border = ( isset( $global_custom_button_border_size['top'] ) && '' !== $global_custom_button_border_size['top'] ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : '1px';
- $theme_btn_right_border = ( isset( $global_custom_button_border_size['right'] ) && '' !== $global_custom_button_border_size['right'] ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : '1px';
- $theme_btn_left_border = ( isset( $global_custom_button_border_size['left'] ) && '' !== $global_custom_button_border_size['left'] ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : '1px';
- $theme_btn_bottom_border = ( isset( $global_custom_button_border_size['bottom'] ) && '' !== $global_custom_button_border_size['bottom'] ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : '1px';
-
- if ( Astra_Dynamic_CSS::page_builder_button_style_css() ) {
-
- $is_support_wp_5_8 = Astra_Dynamic_CSS::is_block_editor_support_enabled();
- $search_button_selector = $is_support_wp_5_8 ? ', .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button' : '';
- $search_button_hover_selector = $is_support_wp_5_8 ? ', .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:hover, .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:focus' : '';
-
- $button_desktop_css = array(
- /**
- * Gutenberg button compatibility for default styling.
- */
- '.wp-block-button .wp-block-button__link' . $search_button_selector => array(
- 'border-style' => 'solid',
- 'border-top-width' => $theme_btn_top_border,
- 'border-right-width' => $theme_btn_right_border,
- 'border-left-width' => $theme_btn_left_border,
- 'border-bottom-width' => $theme_btn_bottom_border,
- 'color' => esc_attr( $btn_color ),
- 'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
- 'background-color' => esc_attr( $btn_bg_color ),
- 'font-family' => astra_get_font_family( $theme_btn_font_family ),
- 'font-weight' => esc_attr( $theme_btn_font_weight ),
- 'line-height' => esc_attr( $theme_btn_line_height ),
- 'text-transform' => esc_attr( $theme_btn_text_transform ),
- 'letter-spacing' => astra_get_css_value( $theme_btn_letter_spacing, 'px' ),
- 'font-size' => astra_responsive_font( $theme_btn_font_size, 'desktop' ),
- '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' ),
- ),
- '.wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus' . $search_button_hover_selector => array(
- 'color' => esc_attr( $btn_h_color ),
- 'background-color' => esc_attr( $btn_bg_h_color ),
- 'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_h_color ) : esc_attr( $btn_border_h_color ),
- ),
- );
-
- if ( $is_support_wp_5_8 ) {
- $button_desktop_css['.wp-block-search .wp-block-search__input, .wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper'] = array(
- 'border-color' => '#eaeaea',
- 'background' => '#fafafa',
- );
- $button_desktop_css['.block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__input'] = array(
- 'padding' => '15px',
- );
- $button_desktop_css['.wp-block-search__button svg'] = array(
- 'fill' => 'currentColor',
- );
- }
-
- $css .= astra_parse_css( $button_desktop_css );
-
- /**
- * Global button CSS - Tablet.
- */
- $css_global_button_tablet = array(
- '.wp-block-button .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' ),
- ),
- );
-
- $css .= astra_parse_css( $css_global_button_tablet, '', astra_get_tablet_breakpoint() );
-
- /**
- * Global button CSS - Mobile.
- */
- $css_global_button_mobile = array(
- '.wp-block-button .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' ),
- ),
- );
-
- $css .= astra_parse_css( $css_global_button_mobile, '', astra_get_mobile_breakpoint() );
- }
-
- if ( Astra_Dynamic_CSS::gutenberg_core_patterns_compat() ) {
-
- $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 );
- }
-
- /**
- * When supporting GB button outline patterns in v3.3.0 we have given 2px as default border for GB outline button, where we restrict button border for flat type buttons.
- * But now while reverting this change there is no need of default border because whatever customizer border will set it should behave accordingly. Although it is empty ('') WP applying 2px as default border for outline buttons.
- *
- * @since 3.6.3
- */
- $default_border_size = '2px';
- if ( ! astra_button_default_padding_updated() ) {
- $default_border_size = '';
- }
-
- // Outline Gutenberg button compatibility CSS.
- $theme_btn_top_border = ( isset( $global_custom_button_border_size['top'] ) && ( '' !== $global_custom_button_border_size['top'] && '0' !== $global_custom_button_border_size['top'] ) ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : $default_border_size;
- $theme_btn_right_border = ( isset( $global_custom_button_border_size['right'] ) && ( '' !== $global_custom_button_border_size['right'] && '0' !== $global_custom_button_border_size['right'] ) ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : $default_border_size;
- $theme_btn_left_border = ( isset( $global_custom_button_border_size['left'] ) && ( '' !== $global_custom_button_border_size['left'] && '0' !== $global_custom_button_border_size['left'] ) ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : $default_border_size;
- $theme_btn_bottom_border = ( isset( $global_custom_button_border_size['bottom'] ) && ( '' !== $global_custom_button_border_size['bottom'] && '0' !== $global_custom_button_border_size['bottom'] ) ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : $default_border_size;
-
- // Added CSS compatibility support for Gutenberg pattern.
- $button_patterns_compat_css = array(
- '.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color), .wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color)' => array(
- 'color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
- ),
- '.wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-button.is-style-outline .wp-block-button__link:focus' => array(
- 'color' => esc_attr( $btn_text_hover_color ) . ' !important',
- ),
- '.wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus' => array(
- 'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_h_color ) : esc_attr( $btn_border_h_color ),
- ),
- );
-
- if ( ! astra_button_default_padding_updated() ) {
- $button_patterns_compat_css['.wp-block-button .wp-block-button__link'] = array(
- 'border' => 'none',
- 'padding' => '15px 30px',
- );
- $button_patterns_compat_css['.wp-block-button.is-style-outline .wp-block-button__link'] = array(
- 'border-style' => 'solid',
- 'border-top-width' => esc_attr( $theme_btn_top_border ),
- 'border-right-width' => esc_attr( $theme_btn_right_border ),
- 'border-bottom-width' => esc_attr( $theme_btn_bottom_border ),
- 'border-left-width' => esc_attr( $theme_btn_left_border ),
- 'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
- 'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
- 'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
- 'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
- 'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
- );
- }
-
- $css .= astra_parse_css( $button_patterns_compat_css );
-
- if ( ! astra_button_default_padding_updated() ) {
- // Tablet CSS.
- $button_patterns_tablet_compat_css = array(
- '.wp-block-button .wp-block-button__link' => array(
- 'border' => 'none',
- 'padding' => '15px 30px',
- ),
- '.wp-block-button.is-style-outline .wp-block-button__link' => array(
- 'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
- 'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
- 'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
- 'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
- ),
- );
-
- $css .= astra_parse_css( $button_patterns_tablet_compat_css, '', astra_get_tablet_breakpoint() );
-
- // Mobile CSS.
- $button_patterns_mobile_compat_css = array(
- '.wp-block-button .wp-block-button__link' => array(
- 'border' => 'none',
- 'padding' => '15px 30px',
- ),
- '.wp-block-button.is-style-outline .wp-block-button__link' => array(
- 'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
- 'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
- 'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
- 'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
- ),
- );
-
- $css .= astra_parse_css( $button_patterns_mobile_compat_css, '', astra_get_mobile_breakpoint() );
- }
-
- if ( $is_site_rtl ) {
- $gb_patterns_min_mobile_css = array(
- '.editor-styles-wrapper .alignleft' => array(
- 'margin-left' => '20px',
- ),
- '.editor-styles-wrapper .alignright' => array(
- 'margin-right' => '20px',
- ),
- );
- } else {
- $gb_patterns_min_mobile_css = array(
- '.editor-styles-wrapper .alignleft' => array(
- 'margin-right' => '20px',
- ),
- '.editor-styles-wrapper .alignright' => array(
- 'margin-left' => '20px',
- ),
- );
- }
-
- if ( ! astra_button_default_padding_updated() ) {
- $gb_patterns_min_mobile_css['.editor-styles-wrapper p.has-background'] = array(
- 'padding' => '20px',
- );
- }
-
- /* Parse CSS from array() -> min-width: (mobile-breakpoint) px CSS */
- $css .= astra_parse_css( $gb_patterns_min_mobile_css );
- }
-
- if ( Astra_Dynamic_CSS::gutenberg_core_blocks_css_comp() ) {
-
- $desktop_screen_gb_css = array(
- '.wp-block-columns' => array(
- 'margin-bottom' => 'unset',
- ),
- 'figure.size-full' => array(
- 'margin' => '2rem 0',
- ),
- '.wp-block-gallery' => array(
- 'margin-bottom' => '1.6em',
- ),
- '.wp-block-group' => array(
- 'padding-top' => '4em',
- 'padding-bottom' => '4em',
- ),
- '.wp-block-group__inner-container:last-child, .wp-block-table table' => array(
- 'margin-bottom' => '0',
- ),
- '.blocks-gallery-grid' => array(
- 'width' => '100%',
- ),
- '.wp-block-navigation-link__content' => array(
- 'padding' => '5px 0',
- ),
- '.wp-block-group .wp-block-group .has-text-align-center, .wp-block-group .wp-block-column .has-text-align-center' => array(
- 'max-width' => '100%',
- ),
- '.has-text-align-center' => array(
- 'margin' => '0 auto',
- ),
- );
-
- /* Parse CSS from array() -> Desktop CSS */
- $css .= astra_parse_css( $desktop_screen_gb_css );
-
- $middle_screen_min_gb_css = array(
- '.wp-block-cover__inner-container, .alignwide .wp-block-group__inner-container, .alignfull .wp-block-group__inner-container' => array(
- 'max-width' => '1200px',
- 'margin' => '0 auto',
- ),
- '.wp-block-group.alignnone, .wp-block-group.aligncenter, .wp-block-group.alignleft, .wp-block-group.alignright, .wp-block-group.alignwide, .wp-block-columns.alignwide' => array(
- 'margin' => '2rem 0 1rem 0',
- ),
- );
-
- /* Parse CSS from array() -> min-width: (1200)px CSS */
- $css .= astra_parse_css( $middle_screen_min_gb_css, '1200' );
-
- $middle_screen_max_gb_css = array(
- '.wp-block-group' => array(
- 'padding' => '3em',
- ),
- '.wp-block-group .wp-block-group' => array(
- 'padding' => '1.5em',
- ),
- '.wp-block-columns, .wp-block-column' => array(
- 'margin' => '1rem 0',
- ),
- );
-
- /* Parse CSS from array() -> max-width: (1200)px CSS */
- $css .= astra_parse_css( $middle_screen_max_gb_css, '', '1200' );
-
- $tablet_screen_min_gb_css = array(
- '.wp-block-columns .wp-block-group' => array(
- 'padding' => '2em',
- ),
- );
-
- /* Parse CSS from array() -> min-width: (tablet-breakpoint)px CSS */
- $css .= astra_parse_css( $tablet_screen_min_gb_css, astra_get_tablet_breakpoint() );
-
- $mobile_screen_max_gb_css = array(
- '.wp-block-media-text .wp-block-media-text__content' => array(
- 'padding' => '3em 2em',
- ),
- '.wp-block-cover-image .wp-block-cover__inner-container, .wp-block-cover .wp-block-cover__inner-container' => array(
- 'width' => 'unset',
- ),
- '.wp-block-cover, .wp-block-cover-image' => array(
- 'padding' => '2em 0',
- ),
- '.wp-block-group, .wp-block-cover' => array(
- 'padding' => '2em',
- ),
- '.wp-block-media-text__media img, .wp-block-media-text__media video' => array(
- 'width' => 'unset',
- 'max-width' => '100%',
- ),
- '.wp-block-media-text.has-background .wp-block-media-text__content' => array(
- 'padding' => '1em',
- ),
- );
-
- /* Parse CSS from array() -> max-width: (mobile-breakpoint)px CSS */
- $css .= astra_parse_css( $mobile_screen_max_gb_css, '', astra_get_mobile_breakpoint() );
- }
-
- if ( Astra_Dynamic_CSS::gutenberg_core_patterns_compat() ) {
-
- // Added CSS compatibility support for Gutenberg Editor's Media & Text block pattern.
- if ( $is_site_rtl ) {
- $gb_editor_block_pattern_css = array(
- '.wp-block-media-text .wp-block-media-text__content .wp-block-group__inner-container' => array(
- 'padding' => '0 8% 0 0',
- ),
- '.ast-separate-container .block-editor-block-list__layout .wp-block[data-align="full"] .wp-block[data-align="center"] > .wp-block-image' => array(
- 'margin-right' => 'auto',
- 'margin-left' => 'auto',
- ),
- );
- } else {
- $gb_editor_block_pattern_css = array(
- '.wp-block-media-text .wp-block-media-text__content .wp-block-group__inner-container' => array(
- 'padding' => '0 0 0 8%',
- ),
- '.ast-separate-container .block-editor-block-list__layout .wp-block[data-align="full"] .wp-block[data-align="center"] > .wp-block-image' => array(
- 'margin-right' => 'auto',
- 'margin-left' => 'auto',
- ),
- );
- }
-
- $gb_editor_block_pattern_css['.block-editor-block-list__layout * .block-editor-block-list__block'] = array(
- 'padding-left' => '20px',
- 'padding-right' => '20px',
- );
-
- $css .= astra_parse_css( $gb_editor_block_pattern_css );
- }
-
- $tablet_css = array(
- '.editor-post-title__block .editor-post-title__input' => array(
- 'font-size' => astra_responsive_font( $single_post_title_font_size, 'tablet', 30 ),
- ),
- // Heading H1 - H6 font size.
- '.edit-post-visual-editor h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1' => array(
- 'font-size' => astra_responsive_font( $heading_h1_font_size, 'tablet', 30 ),
- ),
- '.edit-post-visual-editor h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2' => array(
- 'font-size' => astra_responsive_font( $heading_h2_font_size, 'tablet', 25 ),
- ),
- '.edit-post-visual-editor h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3' => array(
- 'font-size' => astra_responsive_font( $heading_h3_font_size, 'tablet', 20 ),
- ),
- '.edit-post-visual-editor h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4' => array(
- 'font-size' => astra_responsive_font( $heading_h4_font_size, 'tablet' ),
- ),
- '.edit-post-visual-editor h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5' => array(
- 'font-size' => astra_responsive_font( $heading_h5_font_size, 'tablet' ),
- ),
- '.edit-post-visual-editor h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6' => array(
- 'font-size' => astra_responsive_font( $heading_h6_font_size, 'tablet' ),
- ),
- '.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'tablet' ),
- );
-
- $css .= astra_parse_css( $tablet_css, '', astra_get_tablet_breakpoint() );
-
- $mobile_css = array(
- '.editor-post-title__block .editor-post-title__input' => array(
- 'font-size' => astra_responsive_font( $single_post_title_font_size, 'mobile', 30 ),
- ),
-
- // Heading H1 - H6 font size.
- '.edit-post-visual-editor h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1' => array(
- 'font-size' => astra_responsive_font( $heading_h1_font_size, 'mobile', 30 ),
- ),
- '.edit-post-visual-editor h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2' => array(
- 'font-size' => astra_responsive_font( $heading_h2_font_size, 'mobile', 25 ),
- ),
- '.edit-post-visual-editor h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3' => array(
- 'font-size' => astra_responsive_font( $heading_h3_font_size, 'mobile', 20 ),
- ),
- '.edit-post-visual-editor h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4' => array(
- 'font-size' => astra_responsive_font( $heading_h4_font_size, 'mobile' ),
- ),
- '.edit-post-visual-editor h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5' => array(
- 'font-size' => astra_responsive_font( $heading_h5_font_size, 'mobile' ),
- ),
- '.edit-post-visual-editor h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6' => array(
- 'font-size' => astra_responsive_font( $heading_h6_font_size, 'mobile' ),
- ),
- '.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'mobile' ),
- );
-
- $css .= astra_parse_css( $mobile_css, '', astra_get_mobile_breakpoint() );
-
- if ( is_callable( 'Astra_Woocommerce::astra_global_btn_woo_comp' ) && Astra_Woocommerce::astra_global_btn_woo_comp() ) {
-
- $woo_global_button_css = array(
- '.editor-styles-wrapper .wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array(
- '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,
- ),
- '.wc-block-grid__products .wc-block-grid__product .wp-block-button__link:hover' => array(
- 'border-color' => $btn_bg_h_color,
- ),
- );
- $css .= astra_parse_css( $woo_global_button_css );
- }
-
- if ( astra_wp_version_compare( '5.4.99', '>=' ) ) {
-
- $page_builder_css = array(
- '.ast-page-builder-template .editor-post-title__block, .ast-page-builder-template .editor-default-block-appender' => array(
- 'width' => '100%',
- 'max-width' => '100%',
- ),
- '.ast-page-builder-template .wp-block[data-align="right"] > *' => array(
- 'max-width' => 'unset',
- 'width' => 'unset',
- ),
- '.ast-page-builder-template .block-editor-block-list__layout' => array(
- 'padding-left' => 0,
- 'padding-right' => 0,
- ),
- '.ast-page-builder-template .editor-block-list__block-edit' => array(
- 'padding-left' => '20px',
- 'padding-right' => '20px',
- ),
- '.ast-page-builder-template .editor-block-list__block-edit .editor-block-list__block-edit' => array(
- 'padding-left' => '0',
- 'padding-right' => '0',
- ),
- );
-
- } else {
-
- $page_builder_css = array(
- '.ast-page-builder-template .editor-post-title__block, .ast-page-builder-template .editor-default-block-appender, .ast-page-builder-template .block-editor-block-list__block' => array(
- 'width' => '100%',
- 'max-width' => '100%',
- ),
- '.ast-page-builder-template .block-editor-block-list__layout' => array(
- 'padding-left' => 0,
- 'padding-right' => 0,
- ),
- '.ast-page-builder-template .editor-block-list__block-edit' => array(
- 'padding-left' => '20px',
- 'padding-right' => '20px',
- ),
- '.ast-page-builder-template .editor-block-list__block-edit .editor-block-list__block-edit' => array(
- 'padding-left' => '0',
- 'padding-right' => '0',
- ),
- );
- }
-
- $css .= astra_parse_css( $page_builder_css );
-
- $aligned_full_content_css = array(
- '.ast-page-builder-template .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit, .ast-plain-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit' => array(
- 'margin-left' => '0',
- 'margin-right' => '0',
- ),
- '.ast-page-builder-template .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"], .ast-plain-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"]' => array(
- 'margin-left' => '0',
- 'margin-right' => '0',
- ),
- );
-
- $css .= astra_parse_css( $aligned_full_content_css );
-
- $boxed_container = array(
- '.ast-separate-container .block-editor-writing-flow, .ast-two-container .block-editor-writing-flow' => array(
- 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
- 'margin' => '0 auto',
- 'background-color' => '#fff',
- ),
- '.ast-separate-container .gutenberg__editor, .ast-two-container .gutenberg__editor' => array(
- 'background-color' => '#f5f5f5',
- ),
-
- '.ast-separate-container .block-editor-block-list__layout, .ast-two-container .editor-block-list__layout' => array(
- 'padding-top' => '0',
- ),
-
- '.ast-two-container .editor-post-title, .ast-separate-container .block-editor-block-list__layout, .ast-two-container .editor-post-title' => array(
- 'padding-top' => 'calc( 5.34em - 19px)',
- 'padding-bottom' => '5.34em',
- 'padding-left' => 'calc( 6.67em - 28px )',
- 'padding-right' => 'calc( 6.67em - 28px )',
- ),
- '.ast-separate-container .block-editor-block-list__layout' => array(
- 'padding-top' => '0',
- 'padding-bottom' => '5.34em',
- 'padding-left' => 'calc( 6.67em - 28px )',
- 'padding-right' => 'calc( 6.67em - 28px )',
- ),
- '.ast-separate-container .editor-post-title' => array(
- 'padding-top' => 'calc( 5.34em - 19px)',
- 'padding-bottom' => '5.34em',
- 'padding-left' => 'calc( 6.67em - 28px )',
- 'padding-right' => 'calc( 6.67em - 28px )',
- ),
-
- '.ast-separate-container .editor-post-title, .ast-two-container .editor-post-title' => array(
- 'padding-bottom' => '0',
- ),
- '.ast-separate-container .editor-block-list__block, .ast-two-container .editor-block-list__block' => array(
- 'max-width' => 'calc(' . astra_get_css_value( $site_content_width, 'px' ) . ' - 6.67em)',
- ),
- '.ast-separate-container .editor-block-list__block[data-align=wide], .ast-two-container .editor-block-list__block[data-align=wide]' => array(
- 'margin-left' => '-20px',
- 'margin-right' => '-20px',
- ),
- '.ast-separate-container .editor-block-list__block[data-align=full], .ast-two-container .editor-block-list__block[data-align=full]' => array(
- 'margin-left' => '-6.67em',
- 'margin-right' => '-6.67em',
- ),
- '.ast-separate-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"], .ast-separate-container .block-editor-block-list__layout .editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit, .ast-two-container .block-editor-block-list__layout .editor-block-list__block[data-align="full"], .ast-two-container .block-editor-block-list__layout .editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit' => array(
- 'margin-left' => '0',
- 'margin-right' => '0',
- ),
- );
-
- $css .= astra_parse_css( $boxed_container );
-
- // Manage the extra padding applied in the block inster preview of blocks.
- $block_inserter_css = array(
- '.ast-separate-container .block-editor-inserter__preview .block-editor-block-list__layout' => array(
- 'padding-top' => '0px',
- 'padding-bottom' => '0px',
- 'padding-left' => '0px',
- 'padding-right' => '0px',
- ),
- );
-
- $css .= astra_parse_css( $block_inserter_css );
-
- // WP 5.5 compatibility fix the extra padding applied for the block patterns in the editor view.
- if ( astra_wp_version_compare( '5.4.99', '>=' ) ) {
-
- $block_pattern_css = array(
- '.ast-separate-container .block-editor-inserter__panel-content .block-editor-block-list__layout' => array(
- 'padding-top' => '0px',
- 'padding-bottom' => '0px',
- 'padding-left' => '0px',
- 'padding-right' => '0px',
-
- ),
- '.block-editor-inserter__panel-content .block-editor-block-list__layout' => array(
- 'margin-left' => '60px',
- 'margin-right' => '60px',
- ),
- '.block-editor-inserter__panel-content .block-editor-block-list__layout .block-editor-block-list__layout' => array(
- 'margin-left' => '0px',
- 'margin-right' => '0px',
- ),
- '.ast-page-builder-template .block-editor-inserter__panel-content .block-editor-block-list__layout' => array(
- 'margin-left' => '0px',
- 'margin-right' => '0px',
- ),
- );
-
- $css .= astra_parse_css( $block_pattern_css );
- } else {
- $full_width_streched_css = array(
- '.ast-page-builder-template .block-editor-block-list__layout' => array(
- 'margin-left' => '60px',
- 'margin-right' => '60px',
- ),
- '.ast-page-builder-template .block-editor-block-list__layout .block-editor-block-list__layout' => array(
- 'margin-left' => '0px',
- 'margin-right' => '0px',
- ),
- );
-
- $css .= astra_parse_css( $full_width_streched_css );
- }
-
- $ast_gtn_mobile_css = array(
- '.ast-separate-container .editor-post-title' => array(
- 'padding-top' => 'calc( 2.34em - 19px)',
- 'padding-left' => 'calc( 3.67em - 28px )',
- 'padding-right' => 'calc( 3.67em - 28px )',
- ),
- '.ast-separate-container .block-editor-block-list__layout' => array(
- 'padding-bottom' => '2.34em',
- 'padding-left' => 'calc( 3.67em - 28px )',
- 'padding-right' => 'calc( 3.67em - 28px )',
- ),
- '.ast-page-builder-template .block-editor-block-list__layout' => array(
- 'margin-left' => '30px',
- 'margin-right' => '30px',
- ),
- '.ast-plain-container .block-editor-block-list__layout' => array(
- 'padding-left' => '30px',
- 'padding-right' => '30px',
- ),
- );
-
- $css .= astra_parse_css( $ast_gtn_mobile_css, '', astra_get_mobile_breakpoint() );
-
- if ( astra_wp_version_compare( '5.4.99', '>=' ) ) {
- $gtn_full_wide_image_css = array(
- '.wp-block[data-align="left"], .wp-block[data-align="right"], .wp-block[data-align="center"]' => array(
- 'max-width' => '100%',
- 'width' => '100%',
- ),
- '.ast-separate-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > .wp-block[data-align="full"], .ast-plain-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > .wp-block[data-align="full"]' => array(
- 'margin-left' => 'auto',
- 'margin-right' => 'auto',
- ),
- '.ast-separate-container .block-editor-block-list__layout .wp-block[data-align="full"] figure.wp-block-image' => array(
- 'margin-left' => '-4.8em',
- 'margin-right' => '-4.81em',
- 'max-width' => 'unset',
- 'width' => 'unset',
- ),
- '.ast-separate-container .wp-block[data-align="full"] .wp-block-cover' => array(
- 'margin-left' => '-4.8em',
- 'margin-right' => '-4.81em',
- 'max-width' => 'unset',
- 'width' => 'unset',
- ),
- '.ast-plain-container .wp-block[data-align="left"], .ast-plain-container .wp-block[data-align="right"], .ast-plain-container .wp-block[data-align="center"], .ast-plain-container .wp-block[data-align="full"]' => array(
- 'max-width' => astra_get_css_value( $site_content_width, 'px' ),
- ),
- '.ast-plain-container .wp-block[data-align="wide"]' => array(
- 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
- ),
- );
- } else {
- $gtn_full_wide_image_css = array(
- '.ast-separate-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] figure.wp-block-image' => array(
- 'margin-left' => '-4.8em',
- 'margin-right' => '-4.81em',
- 'max-width' => 'unset',
- 'width' => 'unset',
- ),
- '.ast-separate-container .block-editor-block-list__block[data-align="full"] .wp-block-cover' => array(
- 'margin-left' => '-4.8em',
- 'margin-right' => '-4.81em',
- 'max-width' => 'unset',
- 'width' => 'unset',
- ),
- );
- }
-
- $css .= astra_parse_css( $gtn_full_wide_image_css );
-
- if ( in_array( $pagenow, array( 'post-new.php' ) ) && ! isset( $post ) ) {
-
- $boxed_container = array(
- '.block-editor-writing-flow' => array(
- 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
- 'margin' => '0 auto',
- 'background-color' => '#fff',
- ),
- '.gutenberg__editor' => array(
- 'background-color' => '#f5f5f5',
- ),
- '.block-editor-block-list__layout, .editor-post-title' => array(
- 'padding-top' => 'calc( 5.34em - 19px)',
- 'padding-bottom' => '5.34em',
- 'padding-left' => 'calc( 6.67em - 28px )',
- 'padding-right' => 'calc( 6.67em - 28px )',
- ),
- '.block-editor-block-list__layout' => array(
- 'padding-top' => '0',
- ),
- '.editor-post-title' => array(
- 'padding-bottom' => '0',
- ),
- '.block-editor-block-list__block' => array(
- 'max-width' => 'calc(' . astra_get_css_value( $site_content_width, 'px' ) . ' - 6.67em)',
- ),
- '.block-editor-block-list__block[data-align=wide]' => array(
- 'margin-left' => '-20px',
- 'margin-right' => '-20px',
- ),
- '.block-editor-block-list__block[data-align=full]' => array(
- 'margin-left' => '-6.67em',
- 'margin-right' => '-6.67em',
- ),
- '.block-editor-block-list__layout .block-editor-block-list__block[data-align="full"], .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .editor-block-list__block-edit' => array(
- 'margin-left' => '0',
- 'margin-right' => '0',
- ),
- );
-
- $css .= astra_parse_css( $boxed_container );
-
- }
-
- return $css;
- }
- }
-
-endif;
+<?php
+/**
+ * Gutenberg Editor CSS
+ *
+ * @link https://developer.wordpress.org/themes/basics/theme-functions/
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link http://wpastra.com/
+ * @since Astra 1.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+if ( ! class_exists( 'Gutenberg_Editor_CSS' ) ) :
+
+ /**
+ * Admin Helper
+ */
+ class Gutenberg_Editor_CSS {
+
+ /**
+ * Get dynamic CSS required for the block editor to make editing experience similar to how it looks on frontend.
+ *
+ * @return String CSS to be loaded in the editor interface.
+ */
+ public static function get_css() {
+ global $pagenow;
+ global $post;
+ $post_id = astra_get_post_id();
+ $is_site_rtl = is_rtl();
+
+ $site_content_width = astra_get_option( 'site-content-width', 1200 ) + 56;
+ $headings_font_family = astra_get_option( 'headings-font-family' );
+ $headings_font_weight = astra_get_option( 'headings-font-weight' );
+ $headings_text_transform = astra_get_option( 'headings-text-transform' );
+ $headings_line_height = astra_get_option( 'headings-line-height' );
+ $single_post_title_font_size = astra_get_option( 'font-size-entry-title' );
+ $body_font_family = astra_body_font_family();
+ $para_margin_bottom = astra_get_option( 'para-margin-bottom' );
+ $theme_color = astra_get_option( 'theme-color' );
+ $link_color = astra_get_option( 'link-color', $theme_color );
+ $heading_base_color = astra_get_option( 'heading-base-color' );
+
+ $highlight_theme_color = astra_get_foreground_color( $theme_color );
+
+ $body_font_weight = astra_get_option( 'body-font-weight' );
+ $body_font_size = astra_get_option( 'font-size-body' );
+ $body_line_height = astra_get_option( 'body-line-height' );
+ $body_text_transform = astra_get_option( 'body-text-transform' );
+ $box_bg_obj = astra_get_option( 'site-layout-outside-bg-obj-responsive' );
+ $text_color = astra_get_option( 'text-color' );
+
+ $heading_h1_font_size = astra_get_option( 'font-size-h1' );
+ $heading_h2_font_size = astra_get_option( 'font-size-h2' );
+ $heading_h3_font_size = astra_get_option( 'font-size-h3' );
+ $heading_h4_font_size = astra_get_option( 'font-size-h4' );
+ $heading_h5_font_size = astra_get_option( 'font-size-h5' );
+ $heading_h6_font_size = astra_get_option( 'font-size-h6' );
+
+ /**
+ * WooCommerce Grid Products compatibility.
+ */
+ $link_h_color = astra_get_option( 'link-h-color' );
+ $btn_color = astra_get_option( 'button-color' );
+ $btn_bg_color = astra_get_option( 'button-bg-color', '', $theme_color );
+ $btn_h_color = astra_get_option( 'button-h-color' );
+ $btn_bg_h_color = astra_get_option( 'button-bg-h-color', '', $link_h_color );
+ $btn_border_radius = astra_get_option( 'button-radius' );
+ $theme_btn_padding = astra_get_option( 'theme-button-padding' );
+
+ /**
+ * Button theme compatibility.
+ */
+ $global_custom_button_border_size = astra_get_option( 'theme-button-border-group-border-size' );
+ $btn_border_color = astra_get_option( 'theme-button-border-group-border-color' );
+ $btn_border_h_color = astra_get_option( 'theme-button-border-group-border-h-color' );
+
+ /**
+ * Theme Button Typography
+ */
+ $theme_btn_font_family = astra_get_option( 'font-family-button' );
+ $theme_btn_font_size = astra_get_option( 'font-size-button' );
+ $theme_btn_font_weight = astra_get_option( 'font-weight-button' );
+ $theme_btn_text_transform = astra_get_option( 'text-transform-button' );
+ $theme_btn_line_height = astra_get_option( 'theme-btn-line-height' );
+ $theme_btn_letter_spacing = astra_get_option( 'theme-btn-letter-spacing' );
+
+ $h1_font_family = astra_get_option( 'font-family-h1' );
+ $h1_font_weight = astra_get_option( 'font-weight-h1' );
+ $h1_line_height = astra_get_option( 'line-height-h1' );
+ $h1_text_transform = astra_get_option( 'text-transform-h1' );
+
+ $h2_font_family = astra_get_option( 'font-family-h2' );
+ $h2_font_weight = astra_get_option( 'font-weight-h2' );
+ $h2_line_height = astra_get_option( 'line-height-h2' );
+ $h2_text_transform = astra_get_option( 'text-transform-h2' );
+
+ $h3_font_family = astra_get_option( 'font-family-h3' );
+ $h3_font_weight = astra_get_option( 'font-weight-h3' );
+ $h3_line_height = astra_get_option( 'line-height-h3' );
+ $h3_text_transform = astra_get_option( 'text-transform-h3' );
+
+ $single_post_title = astra_get_option( 'blog-single-post-structure' );
+ $title_enabled_from_meta = get_post_meta( $post_id, 'site-post-title', true );
+
+ $is_widget_title_support_font_weight = Astra_Dynamic_CSS::support_font_css_to_widget_and_in_editor();
+ $font_weight_prop = ( $is_widget_title_support_font_weight ) ? 'inherit' : 'normal';
+
+ // Fallback for H1 - headings typography.
+ if ( 'inherit' == $h1_font_family ) {
+ $h1_font_family = $headings_font_family;
+ }
+ if ( $font_weight_prop === $h1_font_weight ) {
+ $h1_font_weight = $headings_font_weight;
+ }
+ if ( '' == $h1_text_transform ) {
+ $h1_text_transform = $headings_text_transform;
+ }
+ if ( '' == $h1_line_height ) {
+ $h1_line_height = $headings_line_height;
+ }
+
+ // Fallback for H2 - headings typography.
+ if ( 'inherit' == $h2_font_family ) {
+ $h2_font_family = $headings_font_family;
+ }
+ if ( $font_weight_prop === $h2_font_weight ) {
+ $h2_font_weight = $headings_font_weight;
+ }
+ if ( '' == $h2_text_transform ) {
+ $h2_text_transform = $headings_text_transform;
+ }
+ if ( '' == $h2_line_height ) {
+ $h2_line_height = $headings_line_height;
+ }
+
+ // Fallback for H3 - headings typography.
+ if ( 'inherit' == $h3_font_family ) {
+ $h3_font_family = $headings_font_family;
+ }
+ if ( $font_weight_prop === $h3_font_weight ) {
+ $h3_font_weight = $headings_font_weight;
+ }
+ if ( '' == $h3_text_transform ) {
+ $h3_text_transform = $headings_text_transform;
+ }
+ if ( '' == $h3_line_height ) {
+ $h3_line_height = $headings_line_height;
+ }
+
+ // Fallback for H4 - headings typography.
+ $h4_line_height = $headings_line_height;
+
+ // Fallback for H5 - headings typography.
+ $h5_line_height = $headings_line_height;
+
+ // Fallback for H6 - headings typography.
+ $h6_line_height = $headings_line_height;
+
+ if ( empty( $btn_color ) ) {
+ $btn_color = astra_get_foreground_color( $theme_color );
+ }
+
+ if ( empty( $btn_h_color ) ) {
+ $btn_h_color = astra_get_foreground_color( $link_h_color );
+ }
+
+ if ( is_array( $body_font_size ) ) {
+ $body_font_size_desktop = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15;
+ } else {
+ $body_font_size_desktop = ( '' != $body_font_size ) ? $body_font_size : 15;
+ }
+
+ // check the selection color incase of empty/no theme color.
+ $selection_text_color = ( 'transparent' === $highlight_theme_color ) ? '' : $highlight_theme_color;
+
+ $css = '';
+
+ $desktop_css = array(
+ 'html' => array(
+ 'font-size' => astra_get_font_css_value( (int) $body_font_size_desktop * 6.25, '%' ),
+ ),
+ 'a' => array(
+ 'color' => esc_attr( $link_color ),
+ ),
+
+ // Global selection CSS.
+ '.block-editor-block-list__layout .block-editor-block-list__block ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit:before' => array(
+ 'background-color' => esc_attr( $theme_color ),
+ ),
+ '.block-editor-block-list__layout .block-editor-block-list__block ::selection,.block-editor-block-list__layout .block-editor-block-list__block.is-multi-selected .editor-block-list__block-edit' => array(
+ 'color' => esc_attr( $selection_text_color ),
+ ),
+ '.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'desktop' ),
+ '.editor-post-title__block,.editor-default-block-appender,.block-editor-block-list__block' => array(
+ 'max-width' => astra_get_css_value( $site_content_width, 'px' ),
+ ),
+ '.block-editor-block-list__block[data-align=wide]' => array(
+ 'max-width' => astra_get_css_value( $site_content_width + 200, 'px' ),
+ ),
+ '.editor-post-title__block .editor-post-title__input, .edit-post-visual-editor .block-editor-block-list__block h1, .edit-post-visual-editor .block-editor-block-list__block h2, .edit-post-visual-editor .block-editor-block-list__block h3, .edit-post-visual-editor .block-editor-block-list__block h4, .edit-post-visual-editor .block-editor-block-list__block h5, .edit-post-visual-editor .block-editor-block-list__block h6' => array(
+ 'font-family' => astra_get_css_value( $headings_font_family, 'font' ),
+ 'font-weight' => astra_get_css_value( $headings_font_weight, 'font' ),
+ 'text-transform' => esc_attr( $headings_text_transform ),
+ ),
+ '.edit-post-visual-editor h1, .edit-post-visual-editor h2, .edit-post-visual-editor h3, .edit-post-visual-editor h4, .edit-post-visual-editor h5, .edit-post-visual-editor h6' => array(
+ 'line-height' => esc_attr( $headings_line_height ),
+ ),
+ '.edit-post-visual-editor.editor-styles-wrapper p,.block-editor-block-list__block p, .block-editor-block-list__layout, .editor-post-title' => array(
+ 'font-size' => astra_responsive_font( $body_font_size, 'desktop' ),
+ ),
+ '.edit-post-visual-editor.editor-styles-wrapper p,.block-editor-block-list__block p, .wp-block-latest-posts a,.editor-default-block-appender textarea.editor-default-block-appender__content, .block-editor-block-list__block, .block-editor-block-list__block h1, .block-editor-block-list__block h2, .block-editor-block-list__block h3, .block-editor-block-list__block h4, .block-editor-block-list__block h5, .block-editor-block-list__block h6, .edit-post-visual-editor .editor-styles-wrapper' => array(
+ 'font-family' => astra_get_font_family( $body_font_family ),
+ 'font-weight' => esc_attr( $body_font_weight ),
+ 'font-size' => astra_responsive_font( $body_font_size, 'desktop' ),
+ 'line-height' => esc_attr( $body_line_height ),
+ 'text-transform' => esc_attr( $body_text_transform ),
+ 'margin-bottom' => astra_get_css_value( $para_margin_bottom, 'em' ),
+ ),
+ '.editor-post-title__block .editor-post-title__input' => array(
+ 'font-family' => ( 'inherit' === $headings_font_family ) ? astra_get_font_family( $body_font_family ) : astra_get_font_family( $headings_font_family ),
+ 'font-size' => astra_responsive_font( $single_post_title_font_size, 'desktop' ),
+ 'font-weight' => 'normal',
+ ),
+ '.block-editor-block-list__block' => array(
+ 'color' => esc_attr( $text_color ),
+ ),
+ /**
+ * Content base heading color.
+ */
+ '.editor-post-title__block .editor-post-title__input, .wc-block-grid__product-title, .edit-post-visual-editor .block-editor-block-list__block h1, .edit-post-visual-editor .block-editor-block-list__block h2, .edit-post-visual-editor .block-editor-block-list__block h3, .edit-post-visual-editor .block-editor-block-list__block h4, .edit-post-visual-editor .block-editor-block-list__block h5, .edit-post-visual-editor .block-editor-block-list__block h6, .edit-post-visual-editor .wp-block-heading, .edit-post-visual-editor .wp-block-uagb-advanced-heading h1, .edit-post-visual-editor .wp-block-uagb-advanced-heading h2, .edit-post-visual-editor .wp-block-uagb-advanced-heading h3, .edit-post-visual-editor .wp-block-uagb-advanced-heading h4, .edit-post-visual-editor .wp-block-uagb-advanced-heading h5, .edit-post-visual-editor .wp-block-uagb-advanced-heading h6' => array(
+ 'color' => esc_attr( $heading_base_color ),
+ ),
+ // Blockquote Text Color.
+ 'blockquote' => array(
+ 'color' => astra_adjust_brightness( $text_color, 75, 'darken' ),
+ ),
+ 'blockquote .editor-rich-text__tinymce a' => array(
+ 'color' => astra_hex_to_rgba( $link_color, 1 ),
+ ),
+ 'blockquote' => array(
+ 'border-color' => astra_hex_to_rgba( $link_color, 0.05 ),
+ ),
+ '.block-editor-block-list__block .wp-block-quote:not(.is-large):not(.is-style-large), .edit-post-visual-editor .wp-block-pullquote blockquote' => array(
+ 'border-color' => astra_hex_to_rgba( $link_color, 0.15 ),
+ ),
+
+ // Heading H1 - H6 font size.
+ '.edit-post-visual-editor .block-editor-block-list__block h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1, .edit-post-visual-editor h1.block-editor-block-list__block' => array(
+ 'font-size' => astra_responsive_font( $heading_h1_font_size, 'desktop' ),
+ 'font-family' => astra_get_css_value( $h1_font_family, 'font' ),
+ 'font-weight' => astra_get_css_value( $h1_font_weight, 'font' ),
+ 'line-height' => esc_attr( $h1_line_height ),
+ 'text-transform' => esc_attr( $h1_text_transform ),
+ ),
+ '.edit-post-visual-editor .block-editor-block-list__block h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2, .edit-post-visual-editor h2.block-editor-block-list__block' => array(
+ 'font-size' => astra_responsive_font( $heading_h2_font_size, 'desktop' ),
+ 'font-family' => astra_get_css_value( $h2_font_family, 'font' ),
+ 'font-weight' => astra_get_css_value( $h2_font_weight, 'font' ),
+ 'line-height' => esc_attr( $h2_line_height ),
+ 'text-transform' => esc_attr( $h2_text_transform ),
+ ),
+ '.edit-post-visual-editor .block-editor-block-list__block h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3, .edit-post-visual-editor h3.block-editor-block-list__block' => array(
+ 'font-size' => astra_responsive_font( $heading_h3_font_size, 'desktop' ),
+ 'font-family' => astra_get_css_value( $h3_font_family, 'font' ),
+ 'font-weight' => astra_get_css_value( $h3_font_weight, 'font' ),
+ 'line-height' => esc_attr( $h3_line_height ),
+ 'text-transform' => esc_attr( $h3_text_transform ),
+ ),
+ '.edit-post-visual-editor .block-editor-block-list__block h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4, .edit-post-visual-editor h4.block-editor-block-list__block' => array(
+ 'font-size' => astra_responsive_font( $heading_h4_font_size, 'desktop' ),
+ 'line-height' => esc_attr( $h4_line_height ),
+ ),
+ '.edit-post-visual-editor .block-editor-block-list__block h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5, .edit-post-visual-editor h5.block-editor-block-list__block' => array(
+ 'font-size' => astra_responsive_font( $heading_h5_font_size, 'desktop' ),
+ 'line-height' => esc_attr( $h5_line_height ),
+ ),
+ '.edit-post-visual-editor .block-editor-block-list__block h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6, .edit-post-visual-editor h6.block-editor-block-list__block' => array(
+ 'font-size' => astra_responsive_font( $heading_h6_font_size, 'desktop' ),
+ 'line-height' => esc_attr( $h6_line_height ),
+ ),
+ /**
+ * WooCommerce Grid Products compatibility.
+ */
+ '.wc-block-grid__product-title' => array(
+ 'color' => esc_attr( $text_color ),
+ ),
+ '.wc-block-grid__product .wc-block-grid__product-onsale' => array(
+ 'background-color' => $theme_color,
+ 'color' => astra_get_foreground_color( $theme_color ),
+ ),
+ '.editor-styles-wrapper .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,
+ ),
+ '.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,
+ ),
+ '.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' ),
+ ),
+ );
+
+ if ( astra_wp_version_compare( '5.7', '>=' ) ) {
+ $base_background_color = astra_get_responsive_background_obj( $box_bg_obj, 'desktop' );
+ if ( empty( $base_background_color ) ) {
+ $background_style_data = array(
+ 'background-color' => '#ffffff',
+ );
+ } else {
+ $background_style_data = $base_background_color;
+ }
+
+ $desktop_css['.edit-post-visual-editor'] = array(
+ 'padding' => '20px',
+ 'padding-top' => 'calc(2em + 20px)',
+ );
+ $desktop_css['.ast-page-builder-template .edit-post-visual-editor'] = array(
+ 'padding' => '0',
+ 'padding-top' => '2em',
+ );
+ $desktop_css['.ast-separate-container .editor-post-title'] = array(
+ 'margin-top' => '0',
+ );
+ $desktop_css['.editor-styles-wrapper .block-editor-writing-flow'] = array(
+ 'height' => '100%',
+ 'padding' => '10px',
+ );
+ $desktop_css['.edit-post-visual-editor .editor-styles-wrapper'] = array(
+ 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
+ 'width' => '100%',
+ 'margin' => '0 auto',
+ 'padding' => '0',
+ );
+ $desktop_css['.ast-page-builder-template .edit-post-visual-editor .editor-styles-wrapper'] = array(
+ 'max-width' => '100%',
+ );
+ $desktop_css['.ast-separate-container .edit-post-visual-editor .block-editor-block-list__layout .wp-block[data-align="full"] figure.wp-block-image, .ast-separate-container .edit-post-visual-editor .wp-block[data-align="full"] .wp-block-cover'] = array(
+ 'margin-left' => 'calc(-4.8em - 10px)',
+ 'margin-right' => 'calc(-4.8em - 10px)',
+ );
+ $desktop_css['.ast-page-builder-template .editor-styles-wrapper .block-editor-writing-flow, .ast-plain-container .editor-styles-wrapper .block-editor-writing-flow, #editor .edit-post-visual-editor'] = $background_style_data;
+ }
+
+ if ( ( ( ! in_array( 'single-title-meta', $single_post_title ) ) && ( 'post' === get_post_type() ) ) || ( 'disabled' === $title_enabled_from_meta ) ) {
+ $destop_title_css = array(
+ '.editor-post-title__block' => array(
+ 'opacity' => '0.2',
+ ),
+ );
+ $css .= astra_parse_css( $destop_title_css );
+ }
+
+ $content_links_underline = astra_get_option( 'underline-content-links' );
+
+ if ( $content_links_underline ) {
+ $desktop_css['.edit-post-visual-editor a'] = array(
+ 'text-decoration' => 'underline',
+ );
+ }
+
+ $css .= astra_parse_css( $desktop_css );
+
+ /**
+ * Global button CSS - Tablet.
+ */
+ $css_prod_button_tablet = array(
+ '.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' ),
+ ),
+ );
+
+ if ( astra_wp_version_compare( '5.7', '>=' ) ) {
+ $css_prod_button_tablet['.ast-page-builder-template .editor-styles-wrapper .block-editor-writing-flow, .ast-plain-container .editor-styles-wrapper .block-editor-writing-flow'] = astra_get_responsive_background_obj( $box_bg_obj, 'tablet' );
+ }
+
+ $css .= astra_parse_css( $css_prod_button_tablet, '', astra_get_tablet_breakpoint() );
+
+ /**
+ * Global button CSS - Mobile.
+ */
+ $css_prod_button_mobile = array(
+ '.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' ),
+ ),
+ );
+
+ if ( astra_wp_version_compare( '5.7', '>=' ) ) {
+ $css_prod_button_mobile['.ast-page-builder-template .editor-styles-wrapper .block-editor-writing-flow, .ast-plain-container .editor-styles-wrapper .block-editor-writing-flow'] = astra_get_responsive_background_obj( $box_bg_obj, 'mobile' );
+ }
+
+ $css .= astra_parse_css( $css_prod_button_mobile, '', astra_get_mobile_breakpoint() );
+
+ $theme_btn_top_border = ( isset( $global_custom_button_border_size['top'] ) && '' !== $global_custom_button_border_size['top'] ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : '1px';
+ $theme_btn_right_border = ( isset( $global_custom_button_border_size['right'] ) && '' !== $global_custom_button_border_size['right'] ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : '1px';
+ $theme_btn_left_border = ( isset( $global_custom_button_border_size['left'] ) && '' !== $global_custom_button_border_size['left'] ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : '1px';
+ $theme_btn_bottom_border = ( isset( $global_custom_button_border_size['bottom'] ) && '' !== $global_custom_button_border_size['bottom'] ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : '1px';
+
+ if ( Astra_Dynamic_CSS::page_builder_button_style_css() ) {
+
+ $is_support_wp_5_8 = Astra_Dynamic_CSS::is_block_editor_support_enabled();
+ $search_button_selector = $is_support_wp_5_8 ? ', .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button' : '';
+ $search_button_hover_selector = $is_support_wp_5_8 ? ', .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:hover, .block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__button:focus' : '';
+
+ $button_desktop_css = array(
+ /**
+ * Gutenberg button compatibility for default styling.
+ */
+ '.wp-block-button .wp-block-button__link' . $search_button_selector => array(
+ 'border-style' => 'solid',
+ 'border-top-width' => $theme_btn_top_border,
+ 'border-right-width' => $theme_btn_right_border,
+ 'border-left-width' => $theme_btn_left_border,
+ 'border-bottom-width' => $theme_btn_bottom_border,
+ 'color' => esc_attr( $btn_color ),
+ 'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
+ 'background-color' => esc_attr( $btn_bg_color ),
+ 'font-family' => astra_get_font_family( $theme_btn_font_family ),
+ 'font-weight' => esc_attr( $theme_btn_font_weight ),
+ 'line-height' => esc_attr( $theme_btn_line_height ),
+ 'text-transform' => esc_attr( $theme_btn_text_transform ),
+ 'letter-spacing' => astra_get_css_value( $theme_btn_letter_spacing, 'px' ),
+ 'font-size' => astra_responsive_font( $theme_btn_font_size, 'desktop' ),
+ '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' ),
+ ),
+ '.wp-block-button .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus' . $search_button_hover_selector => array(
+ 'color' => esc_attr( $btn_h_color ),
+ 'background-color' => esc_attr( $btn_bg_h_color ),
+ 'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_h_color ) : esc_attr( $btn_border_h_color ),
+ ),
+ );
+
+ if ( $is_support_wp_5_8 ) {
+ $button_desktop_css['.wp-block-search .wp-block-search__input, .wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper'] = array(
+ 'border-color' => '#eaeaea',
+ 'background' => '#fafafa',
+ );
+ $button_desktop_css['.block-editor-writing-flow .wp-block-search .wp-block-search__inside-wrapper .wp-block-search__input'] = array(
+ 'padding' => '15px',
+ );
+ $button_desktop_css['.wp-block-search__button svg'] = array(
+ 'fill' => 'currentColor',
+ );
+ }
+
+ $css .= astra_parse_css( $button_desktop_css );
+
+ /**
+ * Global button CSS - Tablet.
+ */
+ $css_global_button_tablet = array(
+ '.wp-block-button .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' ),
+ ),
+ );
+
+ $css .= astra_parse_css( $css_global_button_tablet, '', astra_get_tablet_breakpoint() );
+
+ /**
+ * Global button CSS - Mobile.
+ */
+ $css_global_button_mobile = array(
+ '.wp-block-button .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' ),
+ ),
+ );
+
+ $css .= astra_parse_css( $css_global_button_mobile, '', astra_get_mobile_breakpoint() );
+ }
+
+ if ( Astra_Dynamic_CSS::gutenberg_core_patterns_compat() ) {
+
+ $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 );
+ }
+
+ /**
+ * When supporting GB button outline patterns in v3.3.0 we have given 2px as default border for GB outline button, where we restrict button border for flat type buttons.
+ * But now while reverting this change there is no need of default border because whatever customizer border will set it should behave accordingly. Although it is empty ('') WP applying 2px as default border for outline buttons.
+ *
+ * @since 3.6.3
+ */
+ $default_border_size = '2px';
+ if ( ! astra_button_default_padding_updated() ) {
+ $default_border_size = '';
+ }
+
+ // Outline Gutenberg button compatibility CSS.
+ $theme_btn_top_border = ( isset( $global_custom_button_border_size['top'] ) && ( '' !== $global_custom_button_border_size['top'] && '0' !== $global_custom_button_border_size['top'] ) ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : $default_border_size;
+ $theme_btn_right_border = ( isset( $global_custom_button_border_size['right'] ) && ( '' !== $global_custom_button_border_size['right'] && '0' !== $global_custom_button_border_size['right'] ) ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : $default_border_size;
+ $theme_btn_left_border = ( isset( $global_custom_button_border_size['left'] ) && ( '' !== $global_custom_button_border_size['left'] && '0' !== $global_custom_button_border_size['left'] ) ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : $default_border_size;
+ $theme_btn_bottom_border = ( isset( $global_custom_button_border_size['bottom'] ) && ( '' !== $global_custom_button_border_size['bottom'] && '0' !== $global_custom_button_border_size['bottom'] ) ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : $default_border_size;
+
+ // Added CSS compatibility support for Gutenberg pattern.
+ $button_patterns_compat_css = array(
+ '.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color), .wp-block-button.wp-block-button__link.is-style-outline:not(.has-text-color)' => array(
+ 'color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
+ ),
+ '.wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-button.is-style-outline .wp-block-button__link:focus' => array(
+ 'color' => esc_attr( $btn_text_hover_color ) . ' !important',
+ ),
+ '.wp-block-button.is-style-outline .wp-block-button__link:hover, .wp-block-button .wp-block-button__link:focus' => array(
+ 'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_h_color ) : esc_attr( $btn_border_h_color ),
+ ),
+ );
+
+ if ( ! astra_button_default_padding_updated() ) {
+ $button_patterns_compat_css['.wp-block-button .wp-block-button__link'] = array(
+ 'border' => 'none',
+ 'padding' => '15px 30px',
+ );
+ $button_patterns_compat_css['.wp-block-button.is-style-outline .wp-block-button__link'] = array(
+ 'border-style' => 'solid',
+ 'border-top-width' => esc_attr( $theme_btn_top_border ),
+ 'border-right-width' => esc_attr( $theme_btn_right_border ),
+ 'border-bottom-width' => esc_attr( $theme_btn_bottom_border ),
+ 'border-left-width' => esc_attr( $theme_btn_left_border ),
+ 'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
+ 'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
+ 'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
+ 'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
+ 'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
+ );
+ }
+
+ $css .= astra_parse_css( $button_patterns_compat_css );
+
+ if ( ! astra_button_default_padding_updated() ) {
+ // Tablet CSS.
+ $button_patterns_tablet_compat_css = array(
+ '.wp-block-button .wp-block-button__link' => array(
+ 'border' => 'none',
+ 'padding' => '15px 30px',
+ ),
+ '.wp-block-button.is-style-outline .wp-block-button__link' => array(
+ 'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
+ 'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
+ 'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
+ 'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
+ ),
+ );
+
+ $css .= astra_parse_css( $button_patterns_tablet_compat_css, '', astra_get_tablet_breakpoint() );
+
+ // Mobile CSS.
+ $button_patterns_mobile_compat_css = array(
+ '.wp-block-button .wp-block-button__link' => array(
+ 'border' => 'none',
+ 'padding' => '15px 30px',
+ ),
+ '.wp-block-button.is-style-outline .wp-block-button__link' => array(
+ 'padding-top' => 'calc(15px - ' . (int) $theme_btn_top_border . 'px)',
+ 'padding-right' => 'calc(30px - ' . (int) $theme_btn_right_border . 'px)',
+ 'padding-bottom' => 'calc(15px - ' . (int) $theme_btn_bottom_border . 'px)',
+ 'padding-left' => 'calc(30px - ' . (int) $theme_btn_left_border . 'px)',
+ ),
+ );
+
+ $css .= astra_parse_css( $button_patterns_mobile_compat_css, '', astra_get_mobile_breakpoint() );
+ }
+
+ if ( $is_site_rtl ) {
+ $gb_patterns_min_mobile_css = array(
+ '.editor-styles-wrapper .alignleft' => array(
+ 'margin-left' => '20px',
+ ),
+ '.editor-styles-wrapper .alignright' => array(
+ 'margin-right' => '20px',
+ ),
+ );
+ } else {
+ $gb_patterns_min_mobile_css = array(
+ '.editor-styles-wrapper .alignleft' => array(
+ 'margin-right' => '20px',
+ ),
+ '.editor-styles-wrapper .alignright' => array(
+ 'margin-left' => '20px',
+ ),
+ );
+ }
+
+ if ( ! astra_button_default_padding_updated() ) {
+ $gb_patterns_min_mobile_css['.editor-styles-wrapper p.has-background'] = array(
+ 'padding' => '20px',
+ );
+ }
+
+ /* Parse CSS from array() -> min-width: (mobile-breakpoint) px CSS */
+ $css .= astra_parse_css( $gb_patterns_min_mobile_css );
+ }
+
+ if ( Astra_Dynamic_CSS::gutenberg_core_blocks_css_comp() ) {
+
+ $desktop_screen_gb_css = array(
+ '.wp-block-columns' => array(
+ 'margin-bottom' => 'unset',
+ ),
+ 'figure.size-full' => array(
+ 'margin' => '2rem 0',
+ ),
+ '.wp-block-gallery' => array(
+ 'margin-bottom' => '1.6em',
+ ),
+ '.wp-block-group' => array(
+ 'padding-top' => '4em',
+ 'padding-bottom' => '4em',
+ ),
+ '.wp-block-group__inner-container:last-child, .wp-block-table table' => array(
+ 'margin-bottom' => '0',
+ ),
+ '.blocks-gallery-grid' => array(
+ 'width' => '100%',
+ ),
+ '.wp-block-navigation-link__content' => array(
+ 'padding' => '5px 0',
+ ),
+ '.wp-block-group .wp-block-group .has-text-align-center, .wp-block-group .wp-block-column .has-text-align-center' => array(
+ 'max-width' => '100%',
+ ),
+ '.has-text-align-center' => array(
+ 'margin' => '0 auto',
+ ),
+ );
+
+ /* Parse CSS from array() -> Desktop CSS */
+ $css .= astra_parse_css( $desktop_screen_gb_css );
+
+ $middle_screen_min_gb_css = array(
+ '.wp-block-cover__inner-container, .alignwide .wp-block-group__inner-container, .alignfull .wp-block-group__inner-container' => array(
+ 'max-width' => '1200px',
+ 'margin' => '0 auto',
+ ),
+ '.wp-block-group.alignnone, .wp-block-group.aligncenter, .wp-block-group.alignleft, .wp-block-group.alignright, .wp-block-group.alignwide, .wp-block-columns.alignwide' => array(
+ 'margin' => '2rem 0 1rem 0',
+ ),
+ );
+
+ /* Parse CSS from array() -> min-width: (1200)px CSS */
+ $css .= astra_parse_css( $middle_screen_min_gb_css, '1200' );
+
+ $middle_screen_max_gb_css = array(
+ '.wp-block-group' => array(
+ 'padding' => '3em',
+ ),
+ '.wp-block-group .wp-block-group' => array(
+ 'padding' => '1.5em',
+ ),
+ '.wp-block-columns, .wp-block-column' => array(
+ 'margin' => '1rem 0',
+ ),
+ );
+
+ /* Parse CSS from array() -> max-width: (1200)px CSS */
+ $css .= astra_parse_css( $middle_screen_max_gb_css, '', '1200' );
+
+ $tablet_screen_min_gb_css = array(
+ '.wp-block-columns .wp-block-group' => array(
+ 'padding' => '2em',
+ ),
+ );
+
+ /* Parse CSS from array() -> min-width: (tablet-breakpoint)px CSS */
+ $css .= astra_parse_css( $tablet_screen_min_gb_css, astra_get_tablet_breakpoint() );
+
+ $mobile_screen_max_gb_css = array(
+ '.wp-block-media-text .wp-block-media-text__content' => array(
+ 'padding' => '3em 2em',
+ ),
+ '.wp-block-cover-image .wp-block-cover__inner-container, .wp-block-cover .wp-block-cover__inner-container' => array(
+ 'width' => 'unset',
+ ),
+ '.wp-block-cover, .wp-block-cover-image' => array(
+ 'padding' => '2em 0',
+ ),
+ '.wp-block-group, .wp-block-cover' => array(
+ 'padding' => '2em',
+ ),
+ '.wp-block-media-text__media img, .wp-block-media-text__media video' => array(
+ 'width' => 'unset',
+ 'max-width' => '100%',
+ ),
+ '.wp-block-media-text.has-background .wp-block-media-text__content' => array(
+ 'padding' => '1em',
+ ),
+ );
+
+ /* Parse CSS from array() -> max-width: (mobile-breakpoint)px CSS */
+ $css .= astra_parse_css( $mobile_screen_max_gb_css, '', astra_get_mobile_breakpoint() );
+ }
+
+ if ( Astra_Dynamic_CSS::gutenberg_core_patterns_compat() ) {
+
+ // Added CSS compatibility support for Gutenberg Editor's Media & Text block pattern.
+ if ( $is_site_rtl ) {
+ $gb_editor_block_pattern_css = array(
+ '.wp-block-media-text .wp-block-media-text__content .wp-block-group__inner-container' => array(
+ 'padding' => '0 8% 0 0',
+ ),
+ '.ast-separate-container .block-editor-block-list__layout .wp-block[data-align="full"] .wp-block[data-align="center"] > .wp-block-image' => array(
+ 'margin-right' => 'auto',
+ 'margin-left' => 'auto',
+ ),
+ );
+ } else {
+ $gb_editor_block_pattern_css = array(
+ '.wp-block-media-text .wp-block-media-text__content .wp-block-group__inner-container' => array(
+ 'padding' => '0 0 0 8%',
+ ),
+ '.ast-separate-container .block-editor-block-list__layout .wp-block[data-align="full"] .wp-block[data-align="center"] > .wp-block-image' => array(
+ 'margin-right' => 'auto',
+ 'margin-left' => 'auto',
+ ),
+ );
+ }
+
+ $gb_editor_block_pattern_css['.block-editor-block-list__layout * .block-editor-block-list__block'] = array(
+ 'padding-left' => '20px',
+ 'padding-right' => '20px',
+ );
+
+ $css .= astra_parse_css( $gb_editor_block_pattern_css );
+ }
+
+ $tablet_css = array(
+ '.editor-post-title__block .editor-post-title__input' => array(
+ 'font-size' => astra_responsive_font( $single_post_title_font_size, 'tablet', 30 ),
+ ),
+ // Heading H1 - H6 font size.
+ '.edit-post-visual-editor h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1' => array(
+ 'font-size' => astra_responsive_font( $heading_h1_font_size, 'tablet', 30 ),
+ ),
+ '.edit-post-visual-editor h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2' => array(
+ 'font-size' => astra_responsive_font( $heading_h2_font_size, 'tablet', 25 ),
+ ),
+ '.edit-post-visual-editor h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3' => array(
+ 'font-size' => astra_responsive_font( $heading_h3_font_size, 'tablet', 20 ),
+ ),
+ '.edit-post-visual-editor h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4' => array(
+ 'font-size' => astra_responsive_font( $heading_h4_font_size, 'tablet' ),
+ ),
+ '.edit-post-visual-editor h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5' => array(
+ 'font-size' => astra_responsive_font( $heading_h5_font_size, 'tablet' ),
+ ),
+ '.edit-post-visual-editor h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6' => array(
+ 'font-size' => astra_responsive_font( $heading_h6_font_size, 'tablet' ),
+ ),
+ '.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'tablet' ),
+ );
+
+ $css .= astra_parse_css( $tablet_css, '', astra_get_tablet_breakpoint() );
+
+ $mobile_css = array(
+ '.editor-post-title__block .editor-post-title__input' => array(
+ 'font-size' => astra_responsive_font( $single_post_title_font_size, 'mobile', 30 ),
+ ),
+
+ // Heading H1 - H6 font size.
+ '.edit-post-visual-editor h1, .wp-block-heading h1, .wp-block-freeform.block-library-rich-text__tinymce h1, .edit-post-visual-editor .wp-block-heading h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h1' => array(
+ 'font-size' => astra_responsive_font( $heading_h1_font_size, 'mobile', 30 ),
+ ),
+ '.edit-post-visual-editor h2, .wp-block-heading h2, .wp-block-freeform.block-library-rich-text__tinymce h2, .edit-post-visual-editor .wp-block-heading h2, .wp-block-heading h2.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h2' => array(
+ 'font-size' => astra_responsive_font( $heading_h2_font_size, 'mobile', 25 ),
+ ),
+ '.edit-post-visual-editor h3, .wp-block-heading h3, .wp-block-freeform.block-library-rich-text__tinymce h3, .edit-post-visual-editor .wp-block-heading h3, .wp-block-heading h3.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h3' => array(
+ 'font-size' => astra_responsive_font( $heading_h3_font_size, 'mobile', 20 ),
+ ),
+ '.edit-post-visual-editor h4, .wp-block-heading h4, .wp-block-freeform.block-library-rich-text__tinymce h4, .edit-post-visual-editor .wp-block-heading h4, .wp-block-heading h4.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h4' => array(
+ 'font-size' => astra_responsive_font( $heading_h4_font_size, 'mobile' ),
+ ),
+ '.edit-post-visual-editor h5, .wp-block-heading h5, .wp-block-freeform.block-library-rich-text__tinymce h5, .edit-post-visual-editor .wp-block-heading h5, .wp-block-heading h5.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h5' => array(
+ 'font-size' => astra_responsive_font( $heading_h5_font_size, 'mobile' ),
+ ),
+ '.edit-post-visual-editor h6, .wp-block-heading h6, .wp-block-freeform.block-library-rich-text__tinymce h6, .edit-post-visual-editor .wp-block-heading h6, .wp-block-heading h6.editor-rich-text__tinymce, .editor-styles-wrapper .wp-block-uagb-advanced-heading h6' => array(
+ 'font-size' => astra_responsive_font( $heading_h6_font_size, 'mobile' ),
+ ),
+ '.ast-separate-container .edit-post-visual-editor, .ast-page-builder-template .edit-post-visual-editor, .ast-plain-container .edit-post-visual-editor, .ast-separate-container #wpwrap #editor .edit-post-visual-editor' => astra_get_responsive_background_obj( $box_bg_obj, 'mobile' ),
+ );
+
+ $css .= astra_parse_css( $mobile_css, '', astra_get_mobile_breakpoint() );
+
+ if ( is_callable( 'Astra_Woocommerce::astra_global_btn_woo_comp' ) && Astra_Woocommerce::astra_global_btn_woo_comp() ) {
+
+ $woo_global_button_css = array(
+ '.editor-styles-wrapper .wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array(
+ '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,
+ ),
+ '.wc-block-grid__products .wc-block-grid__product .wp-block-button__link:hover' => array(
+ 'border-color' => $btn_bg_h_color,
+ ),
+ );
+ $css .= astra_parse_css( $woo_global_button_css );
+ }
+
+ if ( astra_wp_version_compare( '5.4.99', '>=' ) ) {
+
+ $page_builder_css = array(
+ '.ast-page-builder-template .editor-post-title__block, .ast-page-builder-template .editor-default-block-appender' => array(
+ 'width' => '100%',
+ 'max-width' => '100%',
+ ),
+ '.ast-page-builder-template .wp-block[data-align="right"] > *' => array(
+ 'max-width' => 'unset',
+ 'width' => 'unset',
+ ),
+ '.ast-page-builder-template .block-editor-block-list__layout' => array(
+ 'padding-left' => 0,
+ 'padding-right' => 0,
+ ),
+ '.ast-page-builder-template .editor-block-list__block-edit' => array(
+ 'padding-left' => '20px',
+ 'padding-right' => '20px',
+ ),
+ '.ast-page-builder-template .editor-block-list__block-edit .editor-block-list__block-edit' => array(
+ 'padding-left' => '0',
+ 'padding-right' => '0',
+ ),
+ );
+
+ } else {
+
+ $page_builder_css = array(
+ '.ast-page-builder-template .editor-post-title__block, .ast-page-builder-template .editor-default-block-appender, .ast-page-builder-template .block-editor-block-list__block' => array(
+ 'width' => '100%',
+ 'max-width' => '100%',
+ ),
+ '.ast-page-builder-template .block-editor-block-list__layout' => array(
+ 'padding-left' => 0,
+ 'padding-right' => 0,
+ ),
+ '.ast-page-builder-template .editor-block-list__block-edit' => array(
+ 'padding-left' => '20px',
+ 'padding-right' => '20px',
+ ),
+ '.ast-page-builder-template .editor-block-list__block-edit .editor-block-list__block-edit' => array(
+ 'padding-left' => '0',
+ 'padding-right' => '0',
+ ),
+ );
+ }
+
+ $css .= astra_parse_css( $page_builder_css );
+
+ $aligned_full_content_css = array(
+ '.ast-page-builder-template .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit, .ast-plain-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit' => array(
+ 'margin-left' => '0',
+ 'margin-right' => '0',
+ ),
+ '.ast-page-builder-template .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"], .ast-plain-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"]' => array(
+ 'margin-left' => '0',
+ 'margin-right' => '0',
+ ),
+ );
+
+ $css .= astra_parse_css( $aligned_full_content_css );
+
+ $boxed_container = array(
+ '.ast-separate-container .block-editor-writing-flow, .ast-two-container .block-editor-writing-flow' => array(
+ 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
+ 'margin' => '0 auto',
+ 'background-color' => '#fff',
+ ),
+ '.ast-separate-container .gutenberg__editor, .ast-two-container .gutenberg__editor' => array(
+ 'background-color' => '#f5f5f5',
+ ),
+
+ '.ast-separate-container .block-editor-block-list__layout, .ast-two-container .editor-block-list__layout' => array(
+ 'padding-top' => '0',
+ ),
+
+ '.ast-two-container .editor-post-title, .ast-separate-container .block-editor-block-list__layout, .ast-two-container .editor-post-title' => array(
+ 'padding-top' => 'calc( 5.34em - 19px)',
+ 'padding-bottom' => '5.34em',
+ 'padding-left' => 'calc( 6.67em - 28px )',
+ 'padding-right' => 'calc( 6.67em - 28px )',
+ ),
+ '.ast-separate-container .block-editor-block-list__layout' => array(
+ 'padding-top' => '0',
+ 'padding-bottom' => '5.34em',
+ 'padding-left' => 'calc( 6.67em - 28px )',
+ 'padding-right' => 'calc( 6.67em - 28px )',
+ ),
+ '.ast-separate-container .editor-post-title' => array(
+ 'padding-top' => 'calc( 5.34em - 19px)',
+ 'padding-bottom' => '5.34em',
+ 'padding-left' => 'calc( 6.67em - 28px )',
+ 'padding-right' => 'calc( 6.67em - 28px )',
+ ),
+
+ '.ast-separate-container .editor-post-title, .ast-two-container .editor-post-title' => array(
+ 'padding-bottom' => '0',
+ ),
+ '.ast-separate-container .editor-block-list__block, .ast-two-container .editor-block-list__block' => array(
+ 'max-width' => 'calc(' . astra_get_css_value( $site_content_width, 'px' ) . ' - 6.67em)',
+ ),
+ '.ast-separate-container .editor-block-list__block[data-align=wide], .ast-two-container .editor-block-list__block[data-align=wide]' => array(
+ 'margin-left' => '-20px',
+ 'margin-right' => '-20px',
+ ),
+ '.ast-separate-container .editor-block-list__block[data-align=full], .ast-two-container .editor-block-list__block[data-align=full]' => array(
+ 'margin-left' => '-6.67em',
+ 'margin-right' => '-6.67em',
+ ),
+ '.ast-separate-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"], .ast-separate-container .block-editor-block-list__layout .editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit, .ast-two-container .block-editor-block-list__layout .editor-block-list__block[data-align="full"], .ast-two-container .block-editor-block-list__layout .editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit' => array(
+ 'margin-left' => '0',
+ 'margin-right' => '0',
+ ),
+ );
+
+ $css .= astra_parse_css( $boxed_container );
+
+ // Manage the extra padding applied in the block inster preview of blocks.
+ $block_inserter_css = array(
+ '.ast-separate-container .block-editor-inserter__preview .block-editor-block-list__layout' => array(
+ 'padding-top' => '0px',
+ 'padding-bottom' => '0px',
+ 'padding-left' => '0px',
+ 'padding-right' => '0px',
+ ),
+ );
+
+ $css .= astra_parse_css( $block_inserter_css );
+
+ // WP 5.5 compatibility fix the extra padding applied for the block patterns in the editor view.
+ if ( astra_wp_version_compare( '5.4.99', '>=' ) ) {
+
+ $block_pattern_css = array(
+ '.ast-separate-container .block-editor-inserter__panel-content .block-editor-block-list__layout' => array(
+ 'padding-top' => '0px',
+ 'padding-bottom' => '0px',
+ 'padding-left' => '0px',
+ 'padding-right' => '0px',
+
+ ),
+ '.block-editor-inserter__panel-content .block-editor-block-list__layout' => array(
+ 'margin-left' => '60px',
+ 'margin-right' => '60px',
+ ),
+ '.block-editor-inserter__panel-content .block-editor-block-list__layout .block-editor-block-list__layout' => array(
+ 'margin-left' => '0px',
+ 'margin-right' => '0px',
+ ),
+ '.ast-page-builder-template .block-editor-inserter__panel-content .block-editor-block-list__layout' => array(
+ 'margin-left' => '0px',
+ 'margin-right' => '0px',
+ ),
+ );
+
+ $css .= astra_parse_css( $block_pattern_css );
+ } else {
+ $full_width_streched_css = array(
+ '.ast-page-builder-template .block-editor-block-list__layout' => array(
+ 'margin-left' => '60px',
+ 'margin-right' => '60px',
+ ),
+ '.ast-page-builder-template .block-editor-block-list__layout .block-editor-block-list__layout' => array(
+ 'margin-left' => '0px',
+ 'margin-right' => '0px',
+ ),
+ );
+
+ $css .= astra_parse_css( $full_width_streched_css );
+ }
+
+ $ast_gtn_mobile_css = array(
+ '.ast-separate-container .editor-post-title' => array(
+ 'padding-top' => 'calc( 2.34em - 19px)',
+ 'padding-left' => 'calc( 3.67em - 28px )',
+ 'padding-right' => 'calc( 3.67em - 28px )',
+ ),
+ '.ast-separate-container .block-editor-block-list__layout' => array(
+ 'padding-bottom' => '2.34em',
+ 'padding-left' => 'calc( 3.67em - 28px )',
+ 'padding-right' => 'calc( 3.67em - 28px )',
+ ),
+ '.ast-page-builder-template .block-editor-block-list__layout' => array(
+ 'margin-left' => '30px',
+ 'margin-right' => '30px',
+ ),
+ '.ast-plain-container .block-editor-block-list__layout' => array(
+ 'padding-left' => '30px',
+ 'padding-right' => '30px',
+ ),
+ );
+
+ $css .= astra_parse_css( $ast_gtn_mobile_css, '', astra_get_mobile_breakpoint() );
+
+ if ( astra_wp_version_compare( '5.4.99', '>=' ) ) {
+ $gtn_full_wide_image_css = array(
+ '.wp-block[data-align="left"], .wp-block[data-align="right"], .wp-block[data-align="center"]' => array(
+ 'max-width' => '100%',
+ 'width' => '100%',
+ ),
+ '.ast-separate-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > .wp-block[data-align="full"], .ast-plain-container .editor-styles-wrapper .block-editor-block-list__layout.is-root-container > .wp-block[data-align="full"]' => array(
+ 'margin-left' => 'auto',
+ 'margin-right' => 'auto',
+ ),
+ '.ast-separate-container .block-editor-block-list__layout .wp-block[data-align="full"] figure.wp-block-image' => array(
+ 'margin-left' => '-4.8em',
+ 'margin-right' => '-4.81em',
+ 'max-width' => 'unset',
+ 'width' => 'unset',
+ ),
+ '.ast-separate-container .wp-block[data-align="full"] .wp-block-cover' => array(
+ 'margin-left' => '-4.8em',
+ 'margin-right' => '-4.81em',
+ 'max-width' => 'unset',
+ 'width' => 'unset',
+ ),
+ '.ast-plain-container .wp-block[data-align="left"], .ast-plain-container .wp-block[data-align="right"], .ast-plain-container .wp-block[data-align="center"], .ast-plain-container .wp-block[data-align="full"]' => array(
+ 'max-width' => astra_get_css_value( $site_content_width, 'px' ),
+ ),
+ '.ast-plain-container .wp-block[data-align="wide"]' => array(
+ 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
+ ),
+ );
+ } else {
+ $gtn_full_wide_image_css = array(
+ '.ast-separate-container .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] figure.wp-block-image' => array(
+ 'margin-left' => '-4.8em',
+ 'margin-right' => '-4.81em',
+ 'max-width' => 'unset',
+ 'width' => 'unset',
+ ),
+ '.ast-separate-container .block-editor-block-list__block[data-align="full"] .wp-block-cover' => array(
+ 'margin-left' => '-4.8em',
+ 'margin-right' => '-4.81em',
+ 'max-width' => 'unset',
+ 'width' => 'unset',
+ ),
+ );
+ }
+
+ $css .= astra_parse_css( $gtn_full_wide_image_css );
+
+ if ( in_array( $pagenow, array( 'post-new.php' ) ) && ! isset( $post ) ) {
+
+ $boxed_container = array(
+ '.block-editor-writing-flow' => array(
+ 'max-width' => astra_get_css_value( $site_content_width - 56, 'px' ),
+ 'margin' => '0 auto',
+ 'background-color' => '#fff',
+ ),
+ '.gutenberg__editor' => array(
+ 'background-color' => '#f5f5f5',
+ ),
+ '.block-editor-block-list__layout, .editor-post-title' => array(
+ 'padding-top' => 'calc( 5.34em - 19px)',
+ 'padding-bottom' => '5.34em',
+ 'padding-left' => 'calc( 6.67em - 28px )',
+ 'padding-right' => 'calc( 6.67em - 28px )',
+ ),
+ '.block-editor-block-list__layout' => array(
+ 'padding-top' => '0',
+ ),
+ '.editor-post-title' => array(
+ 'padding-bottom' => '0',
+ ),
+ '.block-editor-block-list__block' => array(
+ 'max-width' => 'calc(' . astra_get_css_value( $site_content_width, 'px' ) . ' - 6.67em)',
+ ),
+ '.block-editor-block-list__block[data-align=wide]' => array(
+ 'margin-left' => '-20px',
+ 'margin-right' => '-20px',
+ ),
+ '.block-editor-block-list__block[data-align=full]' => array(
+ 'margin-left' => '-6.67em',
+ 'margin-right' => '-6.67em',
+ ),
+ '.block-editor-block-list__layout .block-editor-block-list__block[data-align="full"], .block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .editor-block-list__block-edit' => array(
+ 'margin-left' => '0',
+ 'margin-right' => '0',
+ ),
+ );
+
+ $css .= astra_parse_css( $boxed_container );
+
+ }
+
+ return $css;
+ }
+ }
+
+endif;
diff --git a/inc/core/class-theme-strings.php b/inc/core/class-theme-strings.php
index 089de87..e5cd74b 100644
--- a/inc/core/class-theme-strings.php
+++ b/inc/core/class-theme-strings.php
@@ -1,108 +1,108 @@
-<?php
-/**
- * Astra Theme Strings
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.0.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-/**
- * Default Strings
- */
-if ( ! function_exists( 'astra_default_strings' ) ) {
-
- /**
- * Default Strings
- *
- * @since 1.0.0
- * @param string $key String key.
- * @param boolean $echo Print string.
- * @return mixed Return string or nothing.
- */
- function astra_default_strings( $key, $echo = true ) {
-
- $defaults = apply_filters(
- 'astra_default_strings',
- array(
-
- // Header.
- 'string-header-skip-link' => __( 'Skip to content', 'astra' ),
-
- // 404 Page Strings.
- 'string-404-sub-title' => __( 'It looks like the link pointing here was faulty. Maybe try searching?', 'astra' ),
-
- // Search Page Strings.
- 'string-search-nothing-found' => __( 'Nothing Found', 'astra' ),
- 'string-search-nothing-found-message' => __( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'astra' ),
- 'string-full-width-search-message' => __( 'Start typing and press enter to search', 'astra' ),
- 'string-full-width-search-placeholder' => __( 'Search &hellip;', 'astra' ),
- 'string-header-cover-search-placeholder' => __( 'Search &hellip;', 'astra' ),
- 'string-search-input-placeholder' => __( 'Search &hellip;', 'astra' ),
-
- // Comment Template Strings.
- 'string-comment-reply-link' => __( 'Reply', 'astra' ),
- 'string-comment-edit-link' => __( 'Edit', 'astra' ),
- 'string-comment-awaiting-moderation' => __( 'Your comment is awaiting moderation.', 'astra' ),
- 'string-comment-title-reply' => __( 'Leave a Comment', 'astra' ),
- 'string-comment-cancel-reply-link' => __( 'Cancel Reply', 'astra' ),
- 'string-comment-label-submit' => __( 'Post Comment &raquo;', 'astra' ),
- 'string-comment-label-message' => __( 'Type here..', 'astra' ),
- 'string-comment-label-name' => __( 'Name*', 'astra' ),
- 'string-comment-label-email' => __( 'Email*', 'astra' ),
- 'string-comment-label-website' => __( 'Website', 'astra' ),
- 'string-comment-closed' => __( 'Comments are closed.', 'astra' ),
- 'string-comment-navigation-title' => __( 'Comment navigation', 'astra' ),
- 'string-comment-navigation-next' => __( 'Newer Comments', 'astra' ),
- 'string-comment-navigation-previous' => __( 'Older Comments', 'astra' ),
-
- // Blog Default Strings.
- 'string-blog-page-links-before' => __( 'Pages:', 'astra' ),
- 'string-blog-meta-author-by' => __( 'By ', 'astra' ),
- 'string-blog-meta-leave-a-comment' => __( 'Leave a Comment', 'astra' ),
- 'string-blog-meta-one-comment' => __( '1 Comment', 'astra' ),
- 'string-blog-meta-multiple-comment' => __( '% Comments', 'astra' ),
- 'string-blog-navigation-next' => __( 'Next Page', 'astra' ) . ' <span class="ast-right-arrow">&rarr;</span>',
- 'string-blog-navigation-previous' => '<span class="ast-left-arrow">&larr;</span> ' . __( 'Previous Page', 'astra' ),
-
- // Single Post Default Strings.
- 'string-single-page-links-before' => __( 'Pages:', 'astra' ),
- /* translators: 1: Post type label */
- 'string-single-navigation-next' => __( 'Next %s', 'astra' ) . ' <span class="ast-right-arrow">&rarr;</span>',
- /* translators: 1: Post type label */
- 'string-single-navigation-previous' => '<span class="ast-left-arrow">&larr;</span> ' . __( 'Previous %s', 'astra' ),
-
- // Content None.
- 'string-content-nothing-found-message' => __( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'astra' ),
-
- )
- );
-
- if ( is_rtl() ) {
- $defaults['string-blog-navigation-next'] = __( 'Next Page', 'astra' ) . ' <span class="ast-left-arrow">&larr;</span>';
- $defaults['string-blog-navigation-previous'] = '<span class="ast-right-arrow">&rarr;</span> ' . __( 'Previous Page', 'astra' );
-
- /* translators: 1: Post type label */
- $defaults['string-single-navigation-next'] = __( 'Next %s', 'astra' ) . ' <span class="ast-left-arrow">&larr;</span>';
- /* translators: 1: Post type label */
- $defaults['string-single-navigation-previous'] = '<span class="ast-right-arrow">&rarr;</span> ' . __( 'Previous %s', 'astra' );
- }
-
- $output = isset( $defaults[ $key ] ) ? $defaults[ $key ] : '';
-
- /**
- * Print or return
- */
- if ( $echo ) {
- echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- } else {
- return $output;
- }
- }
-}
+<?php
+/**
+ * Astra Theme Strings
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Default Strings
+ */
+if ( ! function_exists( 'astra_default_strings' ) ) {
+
+ /**
+ * Default Strings
+ *
+ * @since 1.0.0
+ * @param string $key String key.
+ * @param boolean $echo Print string.
+ * @return mixed Return string or nothing.
+ */
+ function astra_default_strings( $key, $echo = true ) {
+
+ $defaults = apply_filters(
+ 'astra_default_strings',
+ array(
+
+ // Header.
+ 'string-header-skip-link' => __( 'Skip to content', 'astra' ),
+
+ // 404 Page Strings.
+ 'string-404-sub-title' => __( 'It looks like the link pointing here was faulty. Maybe try searching?', 'astra' ),
+
+ // Search Page Strings.
+ 'string-search-nothing-found' => __( 'Nothing Found', 'astra' ),
+ 'string-search-nothing-found-message' => __( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'astra' ),
+ 'string-full-width-search-message' => __( 'Start typing and press enter to search', 'astra' ),
+ 'string-full-width-search-placeholder' => __( 'Search &hellip;', 'astra' ),
+ 'string-header-cover-search-placeholder' => __( 'Search &hellip;', 'astra' ),
+ 'string-search-input-placeholder' => __( 'Search &hellip;', 'astra' ),
+
+ // Comment Template Strings.
+ 'string-comment-reply-link' => __( 'Reply', 'astra' ),
+ 'string-comment-edit-link' => __( 'Edit', 'astra' ),
+ 'string-comment-awaiting-moderation' => __( 'Your comment is awaiting moderation.', 'astra' ),
+ 'string-comment-title-reply' => __( 'Leave a Comment', 'astra' ),
+ 'string-comment-cancel-reply-link' => __( 'Cancel Reply', 'astra' ),
+ 'string-comment-label-submit' => __( 'Post Comment &raquo;', 'astra' ),
+ 'string-comment-label-message' => __( 'Type here..', 'astra' ),
+ 'string-comment-label-name' => __( 'Name*', 'astra' ),
+ 'string-comment-label-email' => __( 'Email*', 'astra' ),
+ 'string-comment-label-website' => __( 'Website', 'astra' ),
+ 'string-comment-closed' => __( 'Comments are closed.', 'astra' ),
+ 'string-comment-navigation-title' => __( 'Comment navigation', 'astra' ),
+ 'string-comment-navigation-next' => __( 'Newer Comments', 'astra' ),
+ 'string-comment-navigation-previous' => __( 'Older Comments', 'astra' ),
+
+ // Blog Default Strings.
+ 'string-blog-page-links-before' => __( 'Pages:', 'astra' ),
+ 'string-blog-meta-author-by' => __( 'By ', 'astra' ),
+ 'string-blog-meta-leave-a-comment' => __( 'Leave a Comment', 'astra' ),
+ 'string-blog-meta-one-comment' => __( '1 Comment', 'astra' ),
+ 'string-blog-meta-multiple-comment' => __( '% Comments', 'astra' ),
+ 'string-blog-navigation-next' => __( 'Next Page', 'astra' ) . ' <span class="ast-right-arrow">&rarr;</span>',
+ 'string-blog-navigation-previous' => '<span class="ast-left-arrow">&larr;</span> ' . __( 'Previous Page', 'astra' ),
+
+ // Single Post Default Strings.
+ 'string-single-page-links-before' => __( 'Pages:', 'astra' ),
+ /* translators: 1: Post type label */
+ 'string-single-navigation-next' => __( 'Next %s', 'astra' ) . ' <span class="ast-right-arrow">&rarr;</span>',
+ /* translators: 1: Post type label */
+ 'string-single-navigation-previous' => '<span class="ast-left-arrow">&larr;</span> ' . __( 'Previous %s', 'astra' ),
+
+ // Content None.
+ 'string-content-nothing-found-message' => __( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'astra' ),
+
+ )
+ );
+
+ if ( is_rtl() ) {
+ $defaults['string-blog-navigation-next'] = __( 'Next Page', 'astra' ) . ' <span class="ast-left-arrow">&larr;</span>';
+ $defaults['string-blog-navigation-previous'] = '<span class="ast-right-arrow">&rarr;</span> ' . __( 'Previous Page', 'astra' );
+
+ /* translators: 1: Post type label */
+ $defaults['string-single-navigation-next'] = __( 'Next %s', 'astra' ) . ' <span class="ast-left-arrow">&larr;</span>';
+ /* translators: 1: Post type label */
+ $defaults['string-single-navigation-previous'] = '<span class="ast-right-arrow">&rarr;</span> ' . __( 'Previous %s', 'astra' );
+ }
+
+ $output = isset( $defaults[ $key ] ) ? $defaults[ $key ] : '';
+
+ /**
+ * Print or return
+ */
+ if ( $echo ) {
+ echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ } else {
+ return $output;
+ }
+ }
+}
diff --git a/inc/core/common-functions.php b/inc/core/common-functions.php
index 3c9ae29..e7888ac 100644
--- a/inc/core/common-functions.php
+++ b/inc/core/common-functions.php
@@ -1,1526 +1,1526 @@
-<?php
-/**
- * Functions for Astra Theme.
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.0.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-/**
- * Foreground Color
- */
-if ( ! function_exists( 'astra_get_foreground_color' ) ) {
-
- /**
- * Foreground Color
- *
- * @param string $hex Color code in HEX format.
- * @return string Return foreground color depend on input HEX color.
- */
- function astra_get_foreground_color( $hex ) {
-
- // bail early if color's not set.
- if ( 'transparent' == $hex || 'false' == $hex || '#' == $hex || empty( $hex ) ) {
- return 'transparent';
- }
-
- // Get clean hex code.
- $hex = str_replace( '#', '', $hex );
-
- if ( 3 == strlen( $hex ) ) {
- $hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 );
- }
-
- if ( strpos( $hex, 'rgba' ) !== false ) {
-
- $rgba = preg_replace( '/[^0-9,]/', '', $hex );
- $rgba = explode( ',', $rgba );
-
- $hex = sprintf( '#%02x%02x%02x', $rgba[0], $rgba[1], $rgba[2] );
- }
-
- // Return if non hex.
- if ( ! ctype_xdigit( $hex ) ) {
- return $hex;
- }
-
- // Get r, g & b codes from hex code.
- $r = hexdec( substr( $hex, 0, 2 ) );
- $g = hexdec( substr( $hex, 2, 2 ) );
- $b = hexdec( substr( $hex, 4, 2 ) );
- $hex = ( ( $r * 299 ) + ( $g * 587 ) + ( $b * 114 ) ) / 1000;
-
- return 128 <= $hex ? '#000000' : '#ffffff';
- }
-}
-
-/**
- * Generate CSS
- */
-if ( ! function_exists( 'astra_css' ) ) {
-
- /**
- * Generate CSS
- *
- * @param mixed $value CSS value.
- * @param string $css_property CSS property.
- * @param string $selector CSS selector.
- * @param string $unit CSS property unit.
- * @return void Echo generated CSS.
- */
- function astra_css( $value = '', $css_property = '', $selector = '', $unit = '' ) {
-
- if ( $selector ) {
- if ( $css_property && $value ) {
-
- if ( '' != $unit ) {
- $value .= $unit;
- }
-
- $css = $selector;
- $css .= '{';
- $css .= ' ' . $css_property . ': ' . $value . ';';
- $css .= '}';
-
- echo $css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- }
- }
- }
-}
-
-/**
- * Get Font Size value
- */
-if ( ! function_exists( 'astra_responsive_font' ) ) {
-
- /**
- * Get Font CSS value
- *
- * @param array $font CSS value.
- * @param string $device CSS device.
- * @param string $default Default value.
- * @return mixed
- */
- function astra_responsive_font( $font, $device = 'desktop', $default = '' ) {
-
- if ( isset( $font[ $device ] ) && isset( $font[ $device . '-unit' ] ) ) {
- if ( '' != $default ) {
- $font_size = astra_get_css_value( $font[ $device ], $font[ $device . '-unit' ], $default );
- } else {
- $font_size = astra_get_font_css_value( $font[ $device ], $font[ $device . '-unit' ] );
- }
- } elseif ( is_numeric( $font ) ) {
- $font_size = astra_get_css_value( $font );
- } else {
- $font_size = ( ! is_array( $font ) ) ? $font : '';
- }
-
- return $font_size;
- }
-}
-
-/**
- * Get Font Size value
- */
-if ( ! function_exists( 'astra_get_font_css_value' ) ) {
-
- /**
- * Get Font CSS value
- *
- * Syntax:
- *
- * astra_get_font_css_value( VALUE, DEVICE, UNIT );
- *
- * E.g.
- *
- * astra_get_css_value( VALUE, 'desktop', '%' );
- * astra_get_css_value( VALUE, 'tablet' );
- * astra_get_css_value( VALUE, 'mobile' );
- *
- * @param string $value CSS value.
- * @param string $unit CSS unit.
- * @param string $device CSS device.
- * @return mixed CSS value depends on $unit & $device
- */
- function astra_get_font_css_value( $value, $unit = 'px', $device = 'desktop' ) {
-
- // If value is empty or 0 then return blank.
- if ( '' == $value || 0 == $value ) {
- return '';
- }
-
- $css_val = '';
-
- switch ( $unit ) {
- case 'em':
- case '%':
- $css_val = esc_attr( $value ) . $unit;
- break;
-
- case 'px':
- if ( is_numeric( $value ) || strpos( $value, 'px' ) ) {
- $value = intval( $value );
- $fonts = array();
- $body_font_size = astra_get_option( 'font-size-body' );
- $fonts['desktop'] = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15;
- $fonts['tablet'] = ( isset( $body_font_size['tablet'] ) && '' != $body_font_size['tablet'] ) ? $body_font_size['tablet'] : $fonts['desktop'];
- $fonts['mobile'] = ( isset( $body_font_size['mobile'] ) && '' != $body_font_size['mobile'] ) ? $body_font_size['mobile'] : $fonts['tablet'];
-
- if ( $fonts[ $device ] ) {
- $css_val = esc_attr( $value ) . 'px;font-size:' . ( esc_attr( $value ) / esc_attr( $fonts[ $device ] ) ) . 'rem';
- }
- } else {
- $css_val = esc_attr( $value );
- }
- }
-
- return $css_val;
- }
-}
-
-/**
- * Get Font family
- */
-if ( ! function_exists( 'astra_get_font_family' ) ) {
-
- /**
- * Get Font family
- *
- * Syntax:
- *
- * astra_get_font_family( VALUE, DEFAULT );
- *
- * E.g.
- * astra_get_font_family( VALUE, '' );
- *
- * @since 1.0.19
- *
- * @param string $value CSS value.
- * @return mixed CSS value depends on $unit
- */
- function astra_get_font_family( $value = '' ) {
- $system_fonts = Astra_Font_Families::get_system_fonts();
- if ( isset( $system_fonts[ $value ] ) && isset( $system_fonts[ $value ]['fallback'] ) ) {
- $value .= ',' . $system_fonts[ $value ]['fallback'];
- }
-
- return $value;
- }
-}
-
-
-/**
- * Get CSS value
- */
-if ( ! function_exists( 'astra_get_css_value' ) ) {
-
- /**
- * Get CSS value
- *
- * Syntax:
- *
- * astra_get_css_value( VALUE, UNIT );
- *
- * E.g.
- *
- * astra_get_css_value( VALUE, 'url' );
- * astra_get_css_value( VALUE, 'px' );
- * astra_get_css_value( VALUE, 'em' );
- *
- * @param string $value CSS value.
- * @param string $unit CSS unit.
- * @param string $default CSS default font.
- * @return mixed CSS value depends on $unit
- */
- function astra_get_css_value( $value = '', $unit = 'px', $default = '' ) {
-
- if ( '' == $value && '' == $default ) {
- return $value;
- }
-
- $css_val = '';
-
- switch ( $unit ) {
-
- case 'font':
- if ( 'inherit' != $value ) {
- $value = astra_get_font_family( $value );
- $css_val = $value;
- } elseif ( '' != $default ) {
- $css_val = $default;
- } else {
- $css_val = '';
- }
- break;
-
- case 'px':
- case '%':
- if ( 'inherit' === strtolower( $value ) || 'inherit' === strtolower( $default ) ) {
- return $value;
- }
-
- $value = ( '' != $value ) ? $value : $default;
- $css_val = esc_attr( $value ) . $unit;
- break;
-
- case 'url':
- $css_val = $unit . '(' . esc_url( $value ) . ')';
- break;
-
- case 'rem':
- if ( 'inherit' === strtolower( $value ) || 'inherit' === strtolower( $default ) ) {
- return $value;
- }
- if ( is_numeric( $value ) || strpos( $value, 'px' ) ) {
- $value = intval( $value );
- $body_font_size = astra_get_option( 'font-size-body' );
- if ( is_array( $body_font_size ) ) {
- $body_font_size_desktop = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15;
- } else {
- $body_font_size_desktop = ( '' != $body_font_size ) ? $body_font_size : 15;
- }
-
- if ( $body_font_size_desktop ) {
- $css_val = esc_attr( $value ) . 'px;font-size:' . ( esc_attr( $value ) / esc_attr( $body_font_size_desktop ) ) . $unit;
- }
- } else {
- $css_val = esc_attr( $value );
- }
-
- break;
-
- default:
- $value = ( '' != $value ) ? $value : $default;
- if ( '' != $value ) {
- $css_val = esc_attr( $value ) . $unit;
- }
- }
-
- return $css_val;
- }
-}
-
-/**
- * Adjust the background obj.
- */
-if ( ! function_exists( 'astra_get_background_obj' ) ) {
-
- /**
- * Adjust Brightness
- *
- * @param array $bg_obj Color code in HEX.
- *
- * @return array Color code in HEX.
- */
- function astra_get_background_obj( $bg_obj ) {
-
- $gen_bg_css = array();
-
- $bg_img = isset( $bg_obj['background-image'] ) ? $bg_obj['background-image'] : '';
- $bg_color = isset( $bg_obj['background-color'] ) ? $bg_obj['background-color'] : '';
- $bg_type = isset( $bg_obj['background-type'] ) ? $bg_obj['background-type'] : '';
-
- if ( '' !== $bg_type ) {
- switch ( $bg_type ) {
- case 'color':
- if ( '' !== $bg_img && '' !== $bg_color ) {
- $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');';
- } elseif ( '' === $bg_img ) {
- $gen_bg_css['background-color'] = $bg_color . ';';
- }
- break;
-
- case 'image':
- if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) {
- $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');';
- }
- if ( '' === $bg_color || is_numeric( strpos( $bg_color, 'linear-gradient' ) ) || is_numeric( strpos( $bg_color, 'radial-gradient' ) ) && '' !== $bg_img ) {
- $gen_bg_css['background-image'] = 'url(' . $bg_img . ');';
- }
- break;
-
- case 'gradient':
- if ( isset( $bg_color ) ) {
- $gen_bg_css['background-image'] = $bg_color . ';';
- }
- break;
-
- default:
- break;
- }
- } elseif ( '' !== $bg_color ) {
- $gen_bg_css['background-color'] = $bg_color . ';';
- }
-
- if ( '' !== $bg_img ) {
- if ( isset( $bg_obj['background-repeat'] ) ) {
- $gen_bg_css['background-repeat'] = esc_attr( $bg_obj['background-repeat'] );
- }
-
- if ( isset( $bg_obj['background-position'] ) ) {
- $gen_bg_css['background-position'] = esc_attr( $bg_obj['background-position'] );
- }
-
- if ( isset( $bg_obj['background-size'] ) ) {
- $gen_bg_css['background-size'] = esc_attr( $bg_obj['background-size'] );
- }
-
- if ( isset( $bg_obj['background-attachment'] ) ) {
- $gen_bg_css['background-attachment'] = esc_attr( $bg_obj['background-attachment'] );
- }
- }
-
- return $gen_bg_css;
- }
-}
-
-/**
- * Parse CSS
- */
-if ( ! function_exists( 'astra_parse_css' ) ) {
-
- /**
- * Parse CSS
- *
- * @param array $css_output Array of CSS.
- * @param string $min_media Min Media breakpoint.
- * @param string $max_media Max Media breakpoint.
- * @return string Generated CSS.
- */
- function astra_parse_css( $css_output = array(), $min_media = '', $max_media = '' ) {
-
- $parse_css = '';
- if ( is_array( $css_output ) && count( $css_output ) > 0 ) {
-
- foreach ( $css_output as $selector => $properties ) {
-
- if ( null === $properties ) {
- break;
- }
-
- if ( ! count( $properties ) ) {
- continue;
- }
-
- $temp_parse_css = $selector . '{';
- $properties_added = 0;
-
- foreach ( $properties as $property => $value ) {
-
- if ( '' == $value && 0 !== $value ) {
- continue;
- }
-
- $properties_added++;
- $temp_parse_css .= $property . ':' . $value . ';';
- }
-
- $temp_parse_css .= '}';
-
- if ( $properties_added > 0 ) {
- $parse_css .= $temp_parse_css;
- }
- }
-
- if ( '' != $parse_css && ( '' !== $min_media || '' !== $max_media ) ) {
-
- $media_css = '@media ';
- $min_media_css = '';
- $max_media_css = '';
- $media_separator = '';
-
- if ( '' !== $min_media ) {
- $min_media_css = '(min-width:' . $min_media . 'px)';
- }
- if ( '' !== $max_media ) {
- $max_media_css = '(max-width:' . $max_media . 'px)';
- }
- if ( '' !== $min_media && '' !== $max_media ) {
- $media_separator = ' and ';
- }
-
- $media_css .= $min_media_css . $media_separator . $max_media_css . '{' . $parse_css . '}';
-
- return $media_css;
- }
- }
-
- return $parse_css;
- }
-}
-
-/**
- * Return Theme options.
- */
-if ( ! function_exists( 'astra_get_option' ) ) {
-
- /**
- * Return Theme options.
- *
- * @param string $option Option key.
- * @param string $default Option default value.
- * @param string $deprecated Option default value.
- * @return Mixed Return option value.
- */
- function astra_get_option( $option, $default = '', $deprecated = '' ) {
-
- if ( '' != $deprecated ) {
- $default = $deprecated;
- }
-
- $theme_options = Astra_Theme_Options::get_options();
-
- /**
- * Filter the options array for Astra Settings.
- *
- * @since 1.0.20
- * @var Array
- */
- $theme_options = apply_filters( 'astra_get_option_array', $theme_options, $option, $default );
-
- $value = ( isset( $theme_options[ $option ] ) && '' !== $theme_options[ $option ] ) ? $theme_options[ $option ] : $default;
-
- /**
- * Dynamic filter astra_get_option_$option.
- * $option is the name of the Astra Setting, Refer Astra_Theme_Options::defaults() for option names from the theme.
- *
- * @since 1.0.20
- * @var Mixed.
- */
- return apply_filters( "astra_get_option_{$option}", $value, $option, $default );
- }
-}
-
-if ( ! function_exists( 'astra_update_option' ) ) {
-
- /**
- * Update Theme options.
- *
- * @param string $option option key.
- * @param Mixed $value option value.
- * @return void
- */
- function astra_update_option( $option, $value ) {
-
- do_action( "astra_before_update_option_{$option}", $value, $option );
-
- // Get all customizer options.
- $theme_options = get_option( ASTRA_THEME_SETTINGS );
-
- // Update value in options array.
- $theme_options[ $option ] = $value;
-
- update_option( ASTRA_THEME_SETTINGS, $theme_options );
-
- do_action( "astra_after_update_option_{$option}", $value, $option );
- }
-}
-
-if ( ! function_exists( 'astra_delete_option' ) ) {
-
- /**
- * Update Theme options.
- *
- * @param string $option option key.
- * @return void
- */
- function astra_delete_option( $option ) {
-
- do_action( "astra_before_delete_option_{$option}", $option );
-
- // Get all customizer options.
- $theme_options = get_option( ASTRA_THEME_SETTINGS );
-
- // Update value in options array.
- unset( $theme_options[ $option ] );
-
- update_option( ASTRA_THEME_SETTINGS, $theme_options );
-
- do_action( "astra_after_delete_option_{$option}", $option );
- }
-}
-
-/**
- * Return Theme options from postmeta.
- */
-if ( ! function_exists( 'astra_get_option_meta' ) ) {
-
- /**
- * Return Theme options from postmeta.
- *
- * @param string $option_id Option ID.
- * @param string $default Option default value.
- * @param boolean $only_meta Get only meta value.
- * @param string $extension Is value from extension.
- * @param string $post_id Get value from specific post by post ID.
- * @return Mixed Return option value.
- */
- function astra_get_option_meta( $option_id, $default = '', $only_meta = false, $extension = '', $post_id = '' ) {
-
- $post_id = ( '' != $post_id ) ? $post_id : astra_get_post_id();
-
- $value = astra_get_option( $option_id, $default );
-
- // Get value from option 'post-meta'.
- if ( is_singular() || ( is_home() && ! is_front_page() ) ) {
-
- $value = get_post_meta( $post_id, $option_id, true );
-
- if ( empty( $value ) || 'default' == $value ) {
-
- if ( true === $only_meta ) {
- return false;
- }
-
- $value = astra_get_option( $option_id, $default );
- }
- }
-
- /**
- * Dynamic filter astra_get_option_meta_$option.
- * $option_id is the name of the Astra Meta Setting.
- *
- * @since 1.0.20
- * @var Mixed.
- */
- return apply_filters( "astra_get_option_meta_{$option_id}", $value, $default, $default );
- }
-}
-
-/**
- * Helper function to get the current post id.
- */
-if ( ! function_exists( 'astra_get_post_id' ) ) {
-
- /**
- * Get post ID.
- *
- * @param string $post_id_override Get override post ID.
- * @return number Post ID.
- */
- function astra_get_post_id( $post_id_override = '' ) {
-
- if ( null == Astra_Theme_Options::$post_id ) {
- global $post;
-
- $post_id = 0;
-
- if ( is_home() ) {
- $post_id = get_option( 'page_for_posts' );
- } elseif ( is_archive() ) {
- global $wp_query;
- $post_id = $wp_query->get_queried_object_id();
- } elseif ( isset( $post->ID ) && ! is_search() && ! is_category() ) {
- $post_id = $post->ID;
- }
-
- Astra_Theme_Options::$post_id = $post_id;
- }
-
- return apply_filters( 'astra_get_post_id', Astra_Theme_Options::$post_id, $post_id_override );
- }
-}
-
-
-/**
- * Display classes for primary div
- */
-if ( ! function_exists( 'astra_primary_class' ) ) {
-
- /**
- * Display classes for primary div
- *
- * @param string|array $class One or more classes to add to the class list.
- * @return void Echo classes.
- */
- function astra_primary_class( $class = '' ) {
-
- // Separates classes with a single space, collates classes for body element.
- echo 'class="' . esc_attr( join( ' ', astra_get_primary_class( $class ) ) ) . '"';
- }
-}
-
-/**
- * Retrieve the classes for the primary element as an array.
- */
-if ( ! function_exists( 'astra_get_primary_class' ) ) {
-
- /**
- * Retrieve the classes for the primary element as an array.
- *
- * @param string|array $class One or more classes to add to the class list.
- * @return array Return array of classes.
- */
- function astra_get_primary_class( $class = '' ) {
-
- // array of class names.
- $classes = array();
-
- // default class for content area.
- $classes[] = 'content-area';
-
- // primary base class.
- $classes[] = 'primary';
-
- if ( ! empty( $class ) ) {
- if ( ! is_array( $class ) ) {
- $class = preg_split( '#\s+#', $class );
- }
- $classes = array_merge( $classes, $class );
- } else {
-
- // Ensure that we always coerce class to being an array.
- $class = array();
- }
-
- // Filter primary div class names.
- $classes = apply_filters( 'astra_primary_class', $classes, $class );
-
- $classes = array_map( 'sanitize_html_class', $classes );
-
- return array_unique( $classes );
- }
-}
-
-/**
- * Display classes for secondary div
- */
-if ( ! function_exists( 'astra_secondary_class' ) ) {
-
- /**
- * Retrieve the classes for the secondary element as an array.
- *
- * @param string|array $class One or more classes to add to the class list.
- * @return void echo classes.
- */
- function astra_secondary_class( $class = '' ) {
-
- // Separates classes with a single space, collates classes for body element.
- echo 'class="' . esc_attr( join( ' ', astra_get_secondary_class( $class ) ) ) . '"';
- }
-}
-
-/**
- * Retrieve the classes for the secondary element as an array.
- */
-if ( ! function_exists( 'astra_get_secondary_class' ) ) {
-
- /**
- * Retrieve the classes for the secondary element as an array.
- *
- * @param string|array $class One or more classes to add to the class list.
- * @return array Return array of classes.
- */
- function astra_get_secondary_class( $class = '' ) {
-
- // array of class names.
- $classes = array();
-
- // default class from widget area.
- $classes[] = 'widget-area';
-
- // secondary base class.
- $classes[] = 'secondary';
-
- if ( ! empty( $class ) ) {
- if ( ! is_array( $class ) ) {
- $class = preg_split( '#\s+#', $class );
- }
- $classes = array_merge( $classes, $class );
- } else {
-
- // Ensure that we always coerce class to being an array.
- $class = array();
- }
-
- // Filter secondary div class names.
- $classes = apply_filters( 'astra_secondary_class', $classes, $class );
-
- $classes = array_map( 'sanitize_html_class', $classes );
-
- return array_unique( $classes );
- }
-}
-
-/**
- * Get post format
- */
-if ( ! function_exists( 'astra_get_post_format' ) ) {
-
- /**
- * Get post format
- *
- * @param string $post_format_override Override post formate.
- * @return string Return post format.
- */
- function astra_get_post_format( $post_format_override = '' ) {
-
- if ( ( is_home() ) || is_archive() ) {
- $post_format = 'blog';
- } else {
- $post_format = get_post_format();
- }
-
- return apply_filters( 'astra_get_post_format', $post_format, $post_format_override );
- }
-}
-
-/**
- * Wrapper function for get_the_title() for blog post.
- */
-if ( ! function_exists( 'astra_the_post_title' ) ) {
-
- /**
- * Wrapper function for get_the_title() for blog post.
- *
- * Displays title only if the page title bar is disabled.
- *
- * @since 1.0.15
- * @param string $before Optional. Content to prepend to the title.
- * @param string $after Optional. Content to append to the title.
- * @param int $post_id Optional, default to 0. Post id.
- * @param bool $echo Optional, default to true.Whether to display or return.
- * @return string|void String if $echo parameter is false.
- */
- function astra_the_post_title( $before = '', $after = '', $post_id = 0, $echo = true ) {
-
- $enabled = apply_filters( 'astra_the_post_title_enabled', true );
- if ( $enabled ) {
-
- $title = astra_get_the_title( $post_id );
- $before = apply_filters( 'astra_the_post_title_before', $before );
- $after = apply_filters( 'astra_the_post_title_after', $after );
-
- // This will work same as `the_title` function but with Custom Title if exits.
- if ( $echo ) {
- echo $before . $title . $after; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- } else {
- return $before . $title . $after;
- }
- }
- }
-}
-
-/**
- * Wrapper function for the_title()
- */
-if ( ! function_exists( 'astra_the_title' ) ) {
-
- /**
- * Wrapper function for the_title()
- *
- * Displays title only if the page title bar is disabled.
- *
- * @param string $before Optional. Content to prepend to the title.
- * @param string $after Optional. Content to append to the title.
- * @param int $post_id Optional, default to 0. Post id.
- * @param bool $echo Optional, default to true.Whether to display or return.
- * @return string|void String if $echo parameter is false.
- */
- function astra_the_title( $before = '', $after = '', $post_id = 0, $echo = true ) {
-
- $title = '';
- $blog_post_title = astra_get_option( 'blog-post-structure' );
- $single_post_title = astra_get_option( 'blog-single-post-structure' );
-
- if ( ( ! is_singular() && in_array( 'title-meta', $blog_post_title ) ) || ( is_single() && in_array( 'single-title-meta', $single_post_title ) ) || is_page() ) {
- if ( apply_filters( 'astra_the_title_enabled', true ) ) {
-
- $title = astra_get_the_title( $post_id );
- $before = apply_filters( 'astra_the_title_before', $before );
- $after = apply_filters( 'astra_the_title_after', $after );
-
- $title = $before . $title . $after;
- }
- }
-
- // This will work same as `the_title` function but with Custom Title if exits.
- if ( $echo ) {
- echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- } else {
- return $title;
- }
- }
-}
-
-/**
- * Wrapper function for get_the_title()
- */
-if ( ! function_exists( 'astra_get_the_title' ) ) {
-
- /**
- * Wrapper function for get_the_title()
- *
- * Return title for Title Bar and Normal Title.
- *
- * @param int $post_id Optional, default to 0. Post id.
- * @param bool $echo Optional, default to false. Whether to display or return.
- * @return string|void String if $echo parameter is false.
- */
- function astra_get_the_title( $post_id = 0, $echo = false ) {
-
- $title = '';
- if ( $post_id || is_singular() ) {
- $title = get_the_title( $post_id );
- } else {
- if ( is_front_page() && is_home() ) {
- // Default homepage.
- $title = apply_filters( 'astra_the_default_home_page_title', esc_html__( 'Home', 'astra' ) );
- } elseif ( is_home() ) {
- // blog page.
- $title = apply_filters( 'astra_the_blog_home_page_title', get_the_title( get_option( 'page_for_posts', true ) ) );
- } elseif ( is_404() ) {
- // for 404 page - title always display.
- $title = apply_filters( 'astra_the_404_page_title', esc_html__( 'This page doesn\'t seem to exist.', 'astra' ) );
-
- // for search page - title always display.
- } elseif ( is_search() ) {
-
- /* translators: 1: search string */
- $title = apply_filters( 'astra_the_search_page_title', sprintf( __( 'Search Results for: %s', 'astra' ), '<span>' . get_search_query() . '</span>' ) );
-
- } elseif ( class_exists( 'WooCommerce' ) && is_shop() ) {
-
- $title = woocommerce_page_title( false );
-
- } elseif ( is_archive() ) {
-
- $title = get_the_archive_title();
-
- }
- }
-
- $title = apply_filters( 'astra_the_title', $title, $post_id );
-
- // This will work same as `get_the_title` function but with Custom Title if exits.
- if ( $echo ) {
- echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- } else {
- return $title;
- }
- }
-}
-
-/**
- * Archive Page Title
- */
-if ( ! function_exists( 'astra_archive_page_info' ) ) {
-
- /**
- * Wrapper function for the_title()
- *
- * Displays title only if the page title bar is disabled.
- */
- function astra_archive_page_info() {
-
- if ( apply_filters( 'astra_the_title_enabled', true ) ) {
-
- // Author.
- if ( is_author() ) { ?>
-
- <section class="ast-author-box ast-archive-description">
- <div class="ast-author-bio">
- <?php do_action( 'astra_before_archive_title' ); ?>
- <h1 class='page-title ast-archive-title'><?php echo get_the_author(); ?></h1>
- <?php do_action( 'astra_after_archive_title' ); ?>
- <p><?php echo wp_kses_post( get_the_author_meta( 'description' ) ); ?></p>
- <?php do_action( 'astra_after_archive_description' ); ?>
- </div>
- <div class="ast-author-avatar">
- <?php echo get_avatar( get_the_author_meta( 'email' ), 120 ); ?>
- </div>
- </section>
-
- <?php
-
- // Category.
- } elseif ( is_category() ) {
- ?>
-
- <section class="ast-archive-description">
- <?php do_action( 'astra_before_archive_title' ); ?>
- <h1 class="page-title ast-archive-title"><?php echo single_cat_title(); ?></h1>
- <?php do_action( 'astra_after_archive_title' ); ?>
- <?php echo wp_kses_post( wpautop( get_the_archive_description() ) ); ?>
- <?php do_action( 'astra_after_archive_description' ); ?>
- </section>
-
- <?php
-
- // Tag.
- } elseif ( is_tag() ) {
- ?>
-
- <section class="ast-archive-description">
- <?php do_action( 'astra_before_archive_title' ); ?>
- <h1 class="page-title ast-archive-title"><?php echo single_tag_title(); ?></h1>
- <?php do_action( 'astra_after_archive_title' ); ?>
- <?php echo wp_kses_post( wpautop( get_the_archive_description() ) ); ?>
- <?php do_action( 'astra_after_archive_description' ); ?>
- </section>
-
- <?php
-
- // Search.
- } elseif ( is_search() ) {
- ?>
-
- <section class="ast-archive-description">
- <?php do_action( 'astra_before_archive_title' ); ?>
- <?php
- /* translators: 1: search string */
- $title = apply_filters( 'astra_the_search_page_title', sprintf( __( 'Search Results for: %s', 'astra' ), '<span>' . get_search_query() . '</span>' ) );
- ?>
- <h1 class="page-title ast-archive-title"> <?php echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> </h1>
- <?php do_action( 'astra_after_archive_title' ); ?>
- </section>
-
- <?php
-
- // Other.
- } else {
- ?>
-
- <section class="ast-archive-description">
- <?php do_action( 'astra_before_archive_title' ); ?>
- <?php the_archive_title( '<h1 class="page-title ast-archive-title">', '</h1>' ); ?>
- <?php do_action( 'astra_after_archive_title' ); ?>
- <?php echo wp_kses_post( wpautop( get_the_archive_description() ) ); ?>
- <?php do_action( 'astra_after_archive_description' ); ?>
- </section>
-
- <?php
- }
- }
- }
-
- add_action( 'astra_archive_header', 'astra_archive_page_info' );
-}
-
-/**
- * Adjust the HEX color brightness
- */
-if ( ! function_exists( 'astra_adjust_brightness' ) ) {
-
- /**
- * Adjust Brightness
- *
- * @param string $hex Color code in HEX.
- * @param number $steps brightness value.
- * @param string $type brightness is reverse or default.
- * @return string Color code in HEX.
- */
- function astra_adjust_brightness( $hex, $steps, $type ) {
-
- // Get rgb vars.
- $hex = str_replace( '#', '', $hex );
-
- // Return if non hex.
- if ( ! ctype_xdigit( $hex ) ) {
- return $hex;
- }
-
- $shortcode_atts = array(
- 'r' => hexdec( substr( $hex, 0, 2 ) ),
- 'g' => hexdec( substr( $hex, 2, 2 ) ),
- 'b' => hexdec( substr( $hex, 4, 2 ) ),
- );
-
- // Should we darken the color?
- if ( 'reverse' == $type && $shortcode_atts['r'] + $shortcode_atts['g'] + $shortcode_atts['b'] > 382 ) {
- $steps = -$steps;
- } elseif ( 'darken' == $type ) {
- $steps = -$steps;
- }
-
- // Build the new color.
- $steps = max( -255, min( 255, $steps ) );
-
- $shortcode_atts['r'] = max( 0, min( 255, $shortcode_atts['r'] + $steps ) );
- $shortcode_atts['g'] = max( 0, min( 255, $shortcode_atts['g'] + $steps ) );
- $shortcode_atts['b'] = max( 0, min( 255, $shortcode_atts['b'] + $steps ) );
-
- $r_hex = str_pad( dechex( $shortcode_atts['r'] ), 2, '0', STR_PAD_LEFT );
- $g_hex = str_pad( dechex( $shortcode_atts['g'] ), 2, '0', STR_PAD_LEFT );
- $b_hex = str_pad( dechex( $shortcode_atts['b'] ), 2, '0', STR_PAD_LEFT );
-
- return '#' . $r_hex . $g_hex . $b_hex;
- }
-} // End if.
-
-/**
- * Convert colors from HEX to RGBA
- */
-if ( ! function_exists( 'astra_hex_to_rgba' ) ) :
-
- /**
- * Convert colors from HEX to RGBA
- *
- * @param string $color Color code in HEX.
- * @param boolean $opacity Color code opacity.
- * @return string Color code in RGB or RGBA.
- */
- function astra_hex_to_rgba( $color, $opacity = false ) {
-
- $default = 'rgb(0,0,0)';
-
- // Return default if no color provided.
- if ( empty( $color ) ) {
- return $default;
- }
-
- // Sanitize $color if "#" is provided.
- if ( '#' == $color[0] ) {
- $color = substr( $color, 1 );
- }
-
- // Check if color has 6 or 3 characters and get values.
- if ( 6 == strlen( $color ) ) {
- $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
- } elseif ( 3 == strlen( $color ) ) {
- $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
- } else {
- return $default;
- }
-
- // Convert HEX to RGB.
- $rgb = array_map( 'hexdec', $hex );
-
- // Check if opacity is set(RGBA or RGB).
- if ( $opacity ) {
- if ( 1 < abs( $opacity ) ) {
- $opacity = 1.0;
- }
- $output = 'rgba(' . implode( ',', $rgb ) . ',' . $opacity . ')';
- } else {
- $output = 'rgb(' . implode( ',', $rgb ) . ')';
- }
-
- // Return RGB(a) color string.
- return $output;
- }
-
-endif;
-
-
-if ( ! function_exists( 'astra_enable_page_builder_compatibility' ) ) :
-
- /**
- * Allow filter to enable/disable page builder compatibility.
- *
- * @see https://wpastra.com/docs/recommended-settings-beaver-builder-astra/
- * @see https://wpastra.com/docs/recommended-settings-for-elementor/
- *
- * @since 1.2.2
- * @return bool True - If the page builder compatibility is enabled. False - IF the page builder compatibility is disabled.
- */
- function astra_enable_page_builder_compatibility() {
- return apply_filters( 'astra_enable_page_builder_compatibility', true );
- }
-
-endif;
-
-
-if ( ! function_exists( 'astra_get_pro_url' ) ) :
- /**
- * Returns an URL with utm tags
- * the admin settings page.
- *
- * @param string $url URL fo the site.
- * @param string $source utm source.
- * @param string $medium utm medium.
- * @param string $campaign utm campaign.
- * @return mixed
- */
- function astra_get_pro_url( $url, $source = '', $medium = '', $campaign = '' ) {
-
- $astra_pro_url = trailingslashit( $url );
-
- // Set up our URL if we have a source.
- if ( isset( $source ) ) {
- $astra_pro_url = add_query_arg( 'utm_source', sanitize_text_field( $source ), $url );
- }
- // Set up our URL if we have a medium.
- if ( isset( $medium ) ) {
- $astra_pro_url = add_query_arg( 'utm_medium', sanitize_text_field( $medium ), $url );
- }
- // Set up our URL if we have a campaign.
- if ( isset( $campaign ) ) {
- $astra_pro_url = add_query_arg( 'utm_campaign', sanitize_text_field( $campaign ), $url );
- }
-
- return esc_url( apply_filters( 'astra_get_pro_url', $astra_pro_url, $url ) );
- }
-
-endif;
-
-
-/**
- * Search Form
- */
-if ( ! function_exists( 'astra_get_search_form' ) ) :
- /**
- * Display search form.
- *
- * @param bool $echo Default to echo and not return the form.
- * @return string|void String when $echo is false.
- */
- function astra_get_search_form( $echo = true ) {
-
- $form = get_search_form(
- array(
- 'input_placeholder' => apply_filters( 'astra_search_field_placeholder', esc_attr_x( 'Search &hellip;', 'placeholder', 'astra' ) ),
- 'data_attributes' => apply_filters( 'astra_search_field_toggle_data_attrs', '' ),
- 'input_value' => get_search_query(),
- 'show_input_submit' => false,
- )
- );
-
- /**
- * Filters the HTML output of the search form.
- *
- * @param string $form The search form HTML output.
- */
- $result = apply_filters( 'astra_get_search_form', $form );
-
- if ( null === $result ) {
- $result = $form;
- }
-
- if ( $echo ) {
- echo $result; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- } else {
- return $result;
- }
- }
-
-endif;
-
-/**
- * Check if we're being delivered AMP
- *
- * @return bool
- */
-function astra_is_amp_endpoint() {
- return function_exists( 'is_amp_endpoint' ) && is_amp_endpoint();
-}
-
-/*
- * Get Responsive Spacing
- */
-if ( ! function_exists( 'astra_responsive_spacing' ) ) {
-
- /**
- * Get Spacing value
- *
- * @param array $option CSS value.
- * @param string $side top | bottom | left | right.
- * @param string $device CSS device.
- * @param string $default Default value.
- * @param string $prefix Prefix value.
- * @return mixed
- */
- function astra_responsive_spacing( $option, $side = '', $device = 'desktop', $default = '', $prefix = '' ) {
-
- if ( isset( $option[ $device ][ $side ] ) && isset( $option[ $device . '-unit' ] ) ) {
- $spacing = astra_get_css_value( $option[ $device ][ $side ], $option[ $device . '-unit' ], $default );
- } elseif ( is_numeric( $option ) ) {
- $spacing = astra_get_css_value( $option );
- } else {
- $spacing = ( ! is_array( $option ) ) ? $option : '';
- }
-
- if ( '' !== $prefix && '' !== $spacing ) {
- return $prefix . $spacing;
- }
- return $spacing;
- }
-}
-
-/**
- * Get the tablet breakpoint value.
- *
- * @param string $min min.
- * @param string $max max.
- *
- * @since 2.4.0
- *
- * @return number $breakpoint.
- */
-function astra_get_tablet_breakpoint( $min = '', $max = '' ) {
-
- $update_breakpoint = astra_get_option( 'can-update-theme-tablet-breakpoint', true );
-
- // Change default for new users.
- $default = ( true === $update_breakpoint ) ? 921 : 768;
-
- $header_breakpoint = apply_filters( 'astra_tablet_breakpoint', $default );
-
- if ( '' !== $min ) {
- $header_breakpoint = $header_breakpoint - $min;
- } elseif ( '' !== $max ) {
- $header_breakpoint = $header_breakpoint + $max;
- }
-
- return absint( $header_breakpoint );
-}
-
-/**
- * Get the mobile breakpoint value.
- *
- * @param string $min min.
- * @param string $max max.
- *
- * @since 2.4.0
- *
- * @return number header_breakpoint.
- */
-function astra_get_mobile_breakpoint( $min = '', $max = '' ) {
-
- $header_breakpoint = apply_filters( 'astra_mobile_breakpoint', 544 );
-
- if ( '' !== $min ) {
- $header_breakpoint = $header_breakpoint - $min;
- } elseif ( '' !== $max ) {
- $header_breakpoint = $header_breakpoint + $max;
- }
-
- return absint( $header_breakpoint );
-}
-
-/*
- * Apply CSS for the element
- */
-if ( ! function_exists( 'astra_color_responsive_css' ) ) {
-
- /**
- * Astra Responsive Colors
- *
- * @param array $setting Responsive colors.
- * @param string $css_property CSS property.
- * @param string $selector CSS selector.
- * @return string Dynamic responsive CSS.
- */
- function astra_color_responsive_css( $setting, $css_property, $selector ) {
- $css = '';
- if ( isset( $setting['desktop'] ) && ! empty( $setting['desktop'] ) ) {
- $css .= $selector . '{' . $css_property . ':' . esc_attr( $setting['desktop'] ) . ';}';
- }
- if ( isset( $setting['tablet'] ) && ! empty( $setting['tablet'] ) ) {
- $css .= '@media (max-width:' . astra_get_tablet_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['tablet'] ) . ';} }';
- }
- if ( isset( $setting['mobile'] ) && ! empty( $setting['mobile'] ) ) {
- $css .= '@media (max-width:' . astra_get_mobile_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['mobile'] ) . ';} }';
- }
- return $css;
- }
-}
-
-if ( ! function_exists( 'astra_check_is_bb_themer_layout' ) ) :
-
- /**
- * Check if layout is bb themer's layout
- */
- function astra_check_is_bb_themer_layout() {
-
- $is_layout = false;
-
- $post_type = get_post_type();
- $post_id = get_the_ID();
-
- if ( 'fl-theme-layout' === $post_type && $post_id ) {
-
- $is_layout = true;
- }
-
- return $is_layout;
- }
-
-endif;
-
-
-if ( ! function_exists( 'astra_is_white_labelled' ) ) :
-
- /**
- * Check if white label option is enabled in astra pro plugin
- */
- function astra_is_white_labelled() {
-
- if ( is_callable( 'Astra_Ext_White_Label_Markup::show_branding' ) && ! Astra_Ext_White_Label_Markup::show_branding() ) {
- return apply_filters( 'astra_is_white_labelled', true );
- }
-
- return apply_filters( 'astra_is_white_labelled', false );
- }
-
-endif;
-
-/**
- * Get the value for font-display property.
- *
- * @since 1.8.6
- * @return string
- */
-function astra_get_fonts_display_property() {
- return apply_filters( 'astra_fonts_display_property', 'fallback' );
-}
-
-/**
- * Return Theme options from database.
- *
- * @param string $option Option key.
- * @param string $default Option default value.
- * @param string $deprecated Option default value.
- * @return Mixed Return option value.
- */
-function astra_get_db_option( $option, $default = '', $deprecated = '' ) {
-
- if ( '' != $deprecated ) {
- $default = $deprecated;
- }
-
- $theme_options = Astra_Theme_Options::get_db_options();
-
- /**
- * Filter the options array for Astra Settings.
- *
- * @since 1.0.20
- * @var Array
- */
- $theme_options = apply_filters( 'astra_get_db_option_array', $theme_options, $option, $default );
-
- $value = ( isset( $theme_options[ $option ] ) && '' !== $theme_options[ $option ] ) ? $theme_options[ $option ] : $default;
-
- /**
- * Dynamic filter astra_get_option_$option.
- * $option is the name of the Astra Setting, Refer Astra_Theme_Options::defaults() for option names from the theme.
- *
- * @since 1.0.20
- * @var Mixed.
- */
- return apply_filters( "astra_get_db_option_{$option}", $value, $option, $default );
-}
-
-/**
- * Generate Responsive Background Color CSS.
- *
- * @param array $bg_obj_res array of background object.
- * @param string $device CSS for which device.
- * @return array
- */
-function astra_get_responsive_background_obj( $bg_obj_res, $device ) {
-
- $gen_bg_css = array();
-
- if ( ! is_array( $bg_obj_res ) ) {
- return;
- }
-
- $bg_obj = $bg_obj_res[ $device ];
- $bg_img = isset( $bg_obj['background-image'] ) ? $bg_obj['background-image'] : '';
- $bg_tab_img = isset( $bg_obj_res['tablet']['background-image'] ) ? $bg_obj_res['tablet']['background-image'] : '';
- $bg_desk_img = isset( $bg_obj_res['desktop']['background-image'] ) ? $bg_obj_res['desktop']['background-image'] : '';
- $bg_color = isset( $bg_obj['background-color'] ) ? $bg_obj['background-color'] : '';
- $tablet_css = ( isset( $bg_obj_res['tablet']['background-image'] ) && $bg_obj_res['tablet']['background-image'] ) ? true : false;
- $desktop_css = ( isset( $bg_obj_res['desktop']['background-image'] ) && $bg_obj_res['desktop']['background-image'] ) ? true : false;
-
- $bg_type = ( isset( $bg_obj['background-type'] ) && $bg_obj['background-type'] ) ? $bg_obj['background-type'] : '';
-
- if ( '' !== $bg_type ) {
- switch ( $bg_type ) {
- case 'color':
- if ( '' !== $bg_img && '' !== $bg_color ) {
- $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');';
- } elseif ( 'mobile' === $device ) {
- if ( $desktop_css ) {
- $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_desk_img . ');';
- } elseif ( $tablet_css ) {
- $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_tab_img . ');';
- } else {
- $gen_bg_css['background-color'] = $bg_color . ';';
- $gen_bg_css['background-image'] = 'none;';
- }
- } elseif ( 'tablet' === $device ) {
- if ( $desktop_css ) {
- $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_desk_img . ');';
- } else {
- $gen_bg_css['background-color'] = $bg_color . ';';
- $gen_bg_css['background-image'] = 'none;';
- }
- } elseif ( '' === $bg_img ) {
- $gen_bg_css['background-color'] = $bg_color . ';';
- $gen_bg_css['background-image'] = 'none;';
- }
- break;
-
- case 'image':
- if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) {
- $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');';
- }
- if ( '' === $bg_color || is_numeric( strpos( $bg_color, 'linear-gradient' ) ) || is_numeric( strpos( $bg_color, 'radial-gradient' ) ) && '' !== $bg_img ) {
- $gen_bg_css['background-image'] = 'url(' . $bg_img . ');';
- }
- break;
-
- case 'gradient':
- if ( isset( $bg_color ) ) {
- $gen_bg_css['background-image'] = $bg_color . ';';
- }
- break;
-
- default:
- break;
- }
- } elseif ( '' !== $bg_color ) {
- $gen_bg_css['background-color'] = $bg_color . ';';
- }
-
- if ( '' !== $bg_img ) {
- if ( isset( $bg_obj['background-repeat'] ) ) {
- $gen_bg_css['background-repeat'] = esc_attr( $bg_obj['background-repeat'] );
- }
-
- if ( isset( $bg_obj['background-position'] ) ) {
- $gen_bg_css['background-position'] = esc_attr( $bg_obj['background-position'] );
- }
-
- if ( isset( $bg_obj['background-size'] ) ) {
- $gen_bg_css['background-size'] = esc_attr( $bg_obj['background-size'] );
- }
-
- if ( isset( $bg_obj['background-attachment'] ) ) {
- $gen_bg_css['background-attachment'] = esc_attr( $bg_obj['background-attachment'] );
- }
- }
-
- return $gen_bg_css;
-}
-
-/**
- * Common function to check is pagination is enabled on current page.
- *
- * @since 3.0.1
- * @return boolean
- */
-function is_astra_pagination_enabled() {
- global $wp_query;
-
- return ( $wp_query->max_num_pages > 1 && apply_filters( 'astra_pagination_enabled', true ) );
-}
-
-/**
- * Verify is current post comments are enabled or not for applying dynamic CSS.
- *
- * @since 3.0.1
- * @return boolean
- */
-function is_current_post_comment_enabled() {
- return ( is_singular() && comments_open() );
-}
+<?php
+/**
+ * Functions for Astra Theme.
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+/**
+ * Foreground Color
+ */
+if ( ! function_exists( 'astra_get_foreground_color' ) ) {
+
+ /**
+ * Foreground Color
+ *
+ * @param string $hex Color code in HEX format.
+ * @return string Return foreground color depend on input HEX color.
+ */
+ function astra_get_foreground_color( $hex ) {
+
+ // bail early if color's not set.
+ if ( 'transparent' == $hex || 'false' == $hex || '#' == $hex || empty( $hex ) ) {
+ return 'transparent';
+ }
+
+ // Get clean hex code.
+ $hex = str_replace( '#', '', $hex );
+
+ if ( 3 == strlen( $hex ) ) {
+ $hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 );
+ }
+
+ if ( strpos( $hex, 'rgba' ) !== false ) {
+
+ $rgba = preg_replace( '/[^0-9,]/', '', $hex );
+ $rgba = explode( ',', $rgba );
+
+ $hex = sprintf( '#%02x%02x%02x', $rgba[0], $rgba[1], $rgba[2] );
+ }
+
+ // Return if non hex.
+ if ( ! ctype_xdigit( $hex ) ) {
+ return $hex;
+ }
+
+ // Get r, g & b codes from hex code.
+ $r = hexdec( substr( $hex, 0, 2 ) );
+ $g = hexdec( substr( $hex, 2, 2 ) );
+ $b = hexdec( substr( $hex, 4, 2 ) );
+ $hex = ( ( $r * 299 ) + ( $g * 587 ) + ( $b * 114 ) ) / 1000;
+
+ return 128 <= $hex ? '#000000' : '#ffffff';
+ }
+}
+
+/**
+ * Generate CSS
+ */
+if ( ! function_exists( 'astra_css' ) ) {
+
+ /**
+ * Generate CSS
+ *
+ * @param mixed $value CSS value.
+ * @param string $css_property CSS property.
+ * @param string $selector CSS selector.
+ * @param string $unit CSS property unit.
+ * @return void Echo generated CSS.
+ */
+ function astra_css( $value = '', $css_property = '', $selector = '', $unit = '' ) {
+
+ if ( $selector ) {
+ if ( $css_property && $value ) {
+
+ if ( '' != $unit ) {
+ $value .= $unit;
+ }
+
+ $css = $selector;
+ $css .= '{';
+ $css .= ' ' . $css_property . ': ' . $value . ';';
+ $css .= '}';
+
+ echo $css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ }
+ }
+ }
+}
+
+/**
+ * Get Font Size value
+ */
+if ( ! function_exists( 'astra_responsive_font' ) ) {
+
+ /**
+ * Get Font CSS value
+ *
+ * @param array $font CSS value.
+ * @param string $device CSS device.
+ * @param string $default Default value.
+ * @return mixed
+ */
+ function astra_responsive_font( $font, $device = 'desktop', $default = '' ) {
+
+ if ( isset( $font[ $device ] ) && isset( $font[ $device . '-unit' ] ) ) {
+ if ( '' != $default ) {
+ $font_size = astra_get_css_value( $font[ $device ], $font[ $device . '-unit' ], $default );
+ } else {
+ $font_size = astra_get_font_css_value( $font[ $device ], $font[ $device . '-unit' ] );
+ }
+ } elseif ( is_numeric( $font ) ) {
+ $font_size = astra_get_css_value( $font );
+ } else {
+ $font_size = ( ! is_array( $font ) ) ? $font : '';
+ }
+
+ return $font_size;
+ }
+}
+
+/**
+ * Get Font Size value
+ */
+if ( ! function_exists( 'astra_get_font_css_value' ) ) {
+
+ /**
+ * Get Font CSS value
+ *
+ * Syntax:
+ *
+ * astra_get_font_css_value( VALUE, DEVICE, UNIT );
+ *
+ * E.g.
+ *
+ * astra_get_css_value( VALUE, 'desktop', '%' );
+ * astra_get_css_value( VALUE, 'tablet' );
+ * astra_get_css_value( VALUE, 'mobile' );
+ *
+ * @param string $value CSS value.
+ * @param string $unit CSS unit.
+ * @param string $device CSS device.
+ * @return mixed CSS value depends on $unit & $device
+ */
+ function astra_get_font_css_value( $value, $unit = 'px', $device = 'desktop' ) {
+
+ // If value is empty or 0 then return blank.
+ if ( '' == $value || 0 == $value ) {
+ return '';
+ }
+
+ $css_val = '';
+
+ switch ( $unit ) {
+ case 'em':
+ case '%':
+ $css_val = esc_attr( $value ) . $unit;
+ break;
+
+ case 'px':
+ if ( is_numeric( $value ) || strpos( $value, 'px' ) ) {
+ $value = intval( $value );
+ $fonts = array();
+ $body_font_size = astra_get_option( 'font-size-body' );
+ $fonts['desktop'] = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15;
+ $fonts['tablet'] = ( isset( $body_font_size['tablet'] ) && '' != $body_font_size['tablet'] ) ? $body_font_size['tablet'] : $fonts['desktop'];
+ $fonts['mobile'] = ( isset( $body_font_size['mobile'] ) && '' != $body_font_size['mobile'] ) ? $body_font_size['mobile'] : $fonts['tablet'];
+
+ if ( $fonts[ $device ] ) {
+ $css_val = esc_attr( $value ) . 'px;font-size:' . ( esc_attr( $value ) / esc_attr( $fonts[ $device ] ) ) . 'rem';
+ }
+ } else {
+ $css_val = esc_attr( $value );
+ }
+ }
+
+ return $css_val;
+ }
+}
+
+/**
+ * Get Font family
+ */
+if ( ! function_exists( 'astra_get_font_family' ) ) {
+
+ /**
+ * Get Font family
+ *
+ * Syntax:
+ *
+ * astra_get_font_family( VALUE, DEFAULT );
+ *
+ * E.g.
+ * astra_get_font_family( VALUE, '' );
+ *
+ * @since 1.0.19
+ *
+ * @param string $value CSS value.
+ * @return mixed CSS value depends on $unit
+ */
+ function astra_get_font_family( $value = '' ) {
+ $system_fonts = Astra_Font_Families::get_system_fonts();
+ if ( isset( $system_fonts[ $value ] ) && isset( $system_fonts[ $value ]['fallback'] ) ) {
+ $value .= ',' . $system_fonts[ $value ]['fallback'];
+ }
+
+ return $value;
+ }
+}
+
+
+/**
+ * Get CSS value
+ */
+if ( ! function_exists( 'astra_get_css_value' ) ) {
+
+ /**
+ * Get CSS value
+ *
+ * Syntax:
+ *
+ * astra_get_css_value( VALUE, UNIT );
+ *
+ * E.g.
+ *
+ * astra_get_css_value( VALUE, 'url' );
+ * astra_get_css_value( VALUE, 'px' );
+ * astra_get_css_value( VALUE, 'em' );
+ *
+ * @param string $value CSS value.
+ * @param string $unit CSS unit.
+ * @param string $default CSS default font.
+ * @return mixed CSS value depends on $unit
+ */
+ function astra_get_css_value( $value = '', $unit = 'px', $default = '' ) {
+
+ if ( '' == $value && '' == $default ) {
+ return $value;
+ }
+
+ $css_val = '';
+
+ switch ( $unit ) {
+
+ case 'font':
+ if ( 'inherit' != $value ) {
+ $value = astra_get_font_family( $value );
+ $css_val = $value;
+ } elseif ( '' != $default ) {
+ $css_val = $default;
+ } else {
+ $css_val = '';
+ }
+ break;
+
+ case 'px':
+ case '%':
+ if ( 'inherit' === strtolower( $value ) || 'inherit' === strtolower( $default ) ) {
+ return $value;
+ }
+
+ $value = ( '' != $value ) ? $value : $default;
+ $css_val = esc_attr( $value ) . $unit;
+ break;
+
+ case 'url':
+ $css_val = $unit . '(' . esc_url( $value ) . ')';
+ break;
+
+ case 'rem':
+ if ( 'inherit' === strtolower( $value ) || 'inherit' === strtolower( $default ) ) {
+ return $value;
+ }
+ if ( is_numeric( $value ) || strpos( $value, 'px' ) ) {
+ $value = intval( $value );
+ $body_font_size = astra_get_option( 'font-size-body' );
+ if ( is_array( $body_font_size ) ) {
+ $body_font_size_desktop = ( isset( $body_font_size['desktop'] ) && '' != $body_font_size['desktop'] ) ? $body_font_size['desktop'] : 15;
+ } else {
+ $body_font_size_desktop = ( '' != $body_font_size ) ? $body_font_size : 15;
+ }
+
+ if ( $body_font_size_desktop ) {
+ $css_val = esc_attr( $value ) . 'px;font-size:' . ( esc_attr( $value ) / esc_attr( $body_font_size_desktop ) ) . $unit;
+ }
+ } else {
+ $css_val = esc_attr( $value );
+ }
+
+ break;
+
+ default:
+ $value = ( '' != $value ) ? $value : $default;
+ if ( '' != $value ) {
+ $css_val = esc_attr( $value ) . $unit;
+ }
+ }
+
+ return $css_val;
+ }
+}
+
+/**
+ * Adjust the background obj.
+ */
+if ( ! function_exists( 'astra_get_background_obj' ) ) {
+
+ /**
+ * Adjust Brightness
+ *
+ * @param array $bg_obj Color code in HEX.
+ *
+ * @return array Color code in HEX.
+ */
+ function astra_get_background_obj( $bg_obj ) {
+
+ $gen_bg_css = array();
+
+ $bg_img = isset( $bg_obj['background-image'] ) ? $bg_obj['background-image'] : '';
+ $bg_color = isset( $bg_obj['background-color'] ) ? $bg_obj['background-color'] : '';
+ $bg_type = isset( $bg_obj['background-type'] ) ? $bg_obj['background-type'] : '';
+
+ if ( '' !== $bg_type ) {
+ switch ( $bg_type ) {
+ case 'color':
+ if ( '' !== $bg_img && '' !== $bg_color ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');';
+ } elseif ( '' === $bg_img ) {
+ $gen_bg_css['background-color'] = $bg_color . ';';
+ }
+ break;
+
+ case 'image':
+ if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');';
+ }
+ if ( '' === $bg_color || is_numeric( strpos( $bg_color, 'linear-gradient' ) ) || is_numeric( strpos( $bg_color, 'radial-gradient' ) ) && '' !== $bg_img ) {
+ $gen_bg_css['background-image'] = 'url(' . $bg_img . ');';
+ }
+ break;
+
+ case 'gradient':
+ if ( isset( $bg_color ) ) {
+ $gen_bg_css['background-image'] = $bg_color . ';';
+ }
+ break;
+
+ default:
+ break;
+ }
+ } elseif ( '' !== $bg_color ) {
+ $gen_bg_css['background-color'] = $bg_color . ';';
+ }
+
+ if ( '' !== $bg_img ) {
+ if ( isset( $bg_obj['background-repeat'] ) ) {
+ $gen_bg_css['background-repeat'] = esc_attr( $bg_obj['background-repeat'] );
+ }
+
+ if ( isset( $bg_obj['background-position'] ) ) {
+ $gen_bg_css['background-position'] = esc_attr( $bg_obj['background-position'] );
+ }
+
+ if ( isset( $bg_obj['background-size'] ) ) {
+ $gen_bg_css['background-size'] = esc_attr( $bg_obj['background-size'] );
+ }
+
+ if ( isset( $bg_obj['background-attachment'] ) ) {
+ $gen_bg_css['background-attachment'] = esc_attr( $bg_obj['background-attachment'] );
+ }
+ }
+
+ return $gen_bg_css;
+ }
+}
+
+/**
+ * Parse CSS
+ */
+if ( ! function_exists( 'astra_parse_css' ) ) {
+
+ /**
+ * Parse CSS
+ *
+ * @param array $css_output Array of CSS.
+ * @param string $min_media Min Media breakpoint.
+ * @param string $max_media Max Media breakpoint.
+ * @return string Generated CSS.
+ */
+ function astra_parse_css( $css_output = array(), $min_media = '', $max_media = '' ) {
+
+ $parse_css = '';
+ if ( is_array( $css_output ) && count( $css_output ) > 0 ) {
+
+ foreach ( $css_output as $selector => $properties ) {
+
+ if ( null === $properties ) {
+ break;
+ }
+
+ if ( ! count( $properties ) ) {
+ continue;
+ }
+
+ $temp_parse_css = $selector . '{';
+ $properties_added = 0;
+
+ foreach ( $properties as $property => $value ) {
+
+ if ( '' == $value && 0 !== $value ) {
+ continue;
+ }
+
+ $properties_added++;
+ $temp_parse_css .= $property . ':' . $value . ';';
+ }
+
+ $temp_parse_css .= '}';
+
+ if ( $properties_added > 0 ) {
+ $parse_css .= $temp_parse_css;
+ }
+ }
+
+ if ( '' != $parse_css && ( '' !== $min_media || '' !== $max_media ) ) {
+
+ $media_css = '@media ';
+ $min_media_css = '';
+ $max_media_css = '';
+ $media_separator = '';
+
+ if ( '' !== $min_media ) {
+ $min_media_css = '(min-width:' . $min_media . 'px)';
+ }
+ if ( '' !== $max_media ) {
+ $max_media_css = '(max-width:' . $max_media . 'px)';
+ }
+ if ( '' !== $min_media && '' !== $max_media ) {
+ $media_separator = ' and ';
+ }
+
+ $media_css .= $min_media_css . $media_separator . $max_media_css . '{' . $parse_css . '}';
+
+ return $media_css;
+ }
+ }
+
+ return $parse_css;
+ }
+}
+
+/**
+ * Return Theme options.
+ */
+if ( ! function_exists( 'astra_get_option' ) ) {
+
+ /**
+ * Return Theme options.
+ *
+ * @param string $option Option key.
+ * @param string $default Option default value.
+ * @param string $deprecated Option default value.
+ * @return Mixed Return option value.
+ */
+ function astra_get_option( $option, $default = '', $deprecated = '' ) {
+
+ if ( '' != $deprecated ) {
+ $default = $deprecated;
+ }
+
+ $theme_options = Astra_Theme_Options::get_options();
+
+ /**
+ * Filter the options array for Astra Settings.
+ *
+ * @since 1.0.20
+ * @var Array
+ */
+ $theme_options = apply_filters( 'astra_get_option_array', $theme_options, $option, $default );
+
+ $value = ( isset( $theme_options[ $option ] ) && '' !== $theme_options[ $option ] ) ? $theme_options[ $option ] : $default;
+
+ /**
+ * Dynamic filter astra_get_option_$option.
+ * $option is the name of the Astra Setting, Refer Astra_Theme_Options::defaults() for option names from the theme.
+ *
+ * @since 1.0.20
+ * @var Mixed.
+ */
+ return apply_filters( "astra_get_option_{$option}", $value, $option, $default );
+ }
+}
+
+if ( ! function_exists( 'astra_update_option' ) ) {
+
+ /**
+ * Update Theme options.
+ *
+ * @param string $option option key.
+ * @param Mixed $value option value.
+ * @return void
+ */
+ function astra_update_option( $option, $value ) {
+
+ do_action( "astra_before_update_option_{$option}", $value, $option );
+
+ // Get all customizer options.
+ $theme_options = get_option( ASTRA_THEME_SETTINGS );
+
+ // Update value in options array.
+ $theme_options[ $option ] = $value;
+
+ update_option( ASTRA_THEME_SETTINGS, $theme_options );
+
+ do_action( "astra_after_update_option_{$option}", $value, $option );
+ }
+}
+
+if ( ! function_exists( 'astra_delete_option' ) ) {
+
+ /**
+ * Update Theme options.
+ *
+ * @param string $option option key.
+ * @return void
+ */
+ function astra_delete_option( $option ) {
+
+ do_action( "astra_before_delete_option_{$option}", $option );
+
+ // Get all customizer options.
+ $theme_options = get_option( ASTRA_THEME_SETTINGS );
+
+ // Update value in options array.
+ unset( $theme_options[ $option ] );
+
+ update_option( ASTRA_THEME_SETTINGS, $theme_options );
+
+ do_action( "astra_after_delete_option_{$option}", $option );
+ }
+}
+
+/**
+ * Return Theme options from postmeta.
+ */
+if ( ! function_exists( 'astra_get_option_meta' ) ) {
+
+ /**
+ * Return Theme options from postmeta.
+ *
+ * @param string $option_id Option ID.
+ * @param string $default Option default value.
+ * @param boolean $only_meta Get only meta value.
+ * @param string $extension Is value from extension.
+ * @param string $post_id Get value from specific post by post ID.
+ * @return Mixed Return option value.
+ */
+ function astra_get_option_meta( $option_id, $default = '', $only_meta = false, $extension = '', $post_id = '' ) {
+
+ $post_id = ( '' != $post_id ) ? $post_id : astra_get_post_id();
+
+ $value = astra_get_option( $option_id, $default );
+
+ // Get value from option 'post-meta'.
+ if ( is_singular() || ( is_home() && ! is_front_page() ) ) {
+
+ $value = get_post_meta( $post_id, $option_id, true );
+
+ if ( empty( $value ) || 'default' == $value ) {
+
+ if ( true === $only_meta ) {
+ return false;
+ }
+
+ $value = astra_get_option( $option_id, $default );
+ }
+ }
+
+ /**
+ * Dynamic filter astra_get_option_meta_$option.
+ * $option_id is the name of the Astra Meta Setting.
+ *
+ * @since 1.0.20
+ * @var Mixed.
+ */
+ return apply_filters( "astra_get_option_meta_{$option_id}", $value, $default, $default );
+ }
+}
+
+/**
+ * Helper function to get the current post id.
+ */
+if ( ! function_exists( 'astra_get_post_id' ) ) {
+
+ /**
+ * Get post ID.
+ *
+ * @param string $post_id_override Get override post ID.
+ * @return number Post ID.
+ */
+ function astra_get_post_id( $post_id_override = '' ) {
+
+ if ( null == Astra_Theme_Options::$post_id ) {
+ global $post;
+
+ $post_id = 0;
+
+ if ( is_home() ) {
+ $post_id = get_option( 'page_for_posts' );
+ } elseif ( is_archive() ) {
+ global $wp_query;
+ $post_id = $wp_query->get_queried_object_id();
+ } elseif ( isset( $post->ID ) && ! is_search() && ! is_category() ) {
+ $post_id = $post->ID;
+ }
+
+ Astra_Theme_Options::$post_id = $post_id;
+ }
+
+ return apply_filters( 'astra_get_post_id', Astra_Theme_Options::$post_id, $post_id_override );
+ }
+}
+
+
+/**
+ * Display classes for primary div
+ */
+if ( ! function_exists( 'astra_primary_class' ) ) {
+
+ /**
+ * Display classes for primary div
+ *
+ * @param string|array $class One or more classes to add to the class list.
+ * @return void Echo classes.
+ */
+ function astra_primary_class( $class = '' ) {
+
+ // Separates classes with a single space, collates classes for body element.
+ echo 'class="' . esc_attr( join( ' ', astra_get_primary_class( $class ) ) ) . '"';
+ }
+}
+
+/**
+ * Retrieve the classes for the primary element as an array.
+ */
+if ( ! function_exists( 'astra_get_primary_class' ) ) {
+
+ /**
+ * Retrieve the classes for the primary element as an array.
+ *
+ * @param string|array $class One or more classes to add to the class list.
+ * @return array Return array of classes.
+ */
+ function astra_get_primary_class( $class = '' ) {
+
+ // array of class names.
+ $classes = array();
+
+ // default class for content area.
+ $classes[] = 'content-area';
+
+ // primary base class.
+ $classes[] = 'primary';
+
+ if ( ! empty( $class ) ) {
+ if ( ! is_array( $class ) ) {
+ $class = preg_split( '#\s+#', $class );
+ }
+ $classes = array_merge( $classes, $class );
+ } else {
+
+ // Ensure that we always coerce class to being an array.
+ $class = array();
+ }
+
+ // Filter primary div class names.
+ $classes = apply_filters( 'astra_primary_class', $classes, $class );
+
+ $classes = array_map( 'sanitize_html_class', $classes );
+
+ return array_unique( $classes );
+ }
+}
+
+/**
+ * Display classes for secondary div
+ */
+if ( ! function_exists( 'astra_secondary_class' ) ) {
+
+ /**
+ * Retrieve the classes for the secondary element as an array.
+ *
+ * @param string|array $class One or more classes to add to the class list.
+ * @return void echo classes.
+ */
+ function astra_secondary_class( $class = '' ) {
+
+ // Separates classes with a single space, collates classes for body element.
+ echo 'class="' . esc_attr( join( ' ', astra_get_secondary_class( $class ) ) ) . '"';
+ }
+}
+
+/**
+ * Retrieve the classes for the secondary element as an array.
+ */
+if ( ! function_exists( 'astra_get_secondary_class' ) ) {
+
+ /**
+ * Retrieve the classes for the secondary element as an array.
+ *
+ * @param string|array $class One or more classes to add to the class list.
+ * @return array Return array of classes.
+ */
+ function astra_get_secondary_class( $class = '' ) {
+
+ // array of class names.
+ $classes = array();
+
+ // default class from widget area.
+ $classes[] = 'widget-area';
+
+ // secondary base class.
+ $classes[] = 'secondary';
+
+ if ( ! empty( $class ) ) {
+ if ( ! is_array( $class ) ) {
+ $class = preg_split( '#\s+#', $class );
+ }
+ $classes = array_merge( $classes, $class );
+ } else {
+
+ // Ensure that we always coerce class to being an array.
+ $class = array();
+ }
+
+ // Filter secondary div class names.
+ $classes = apply_filters( 'astra_secondary_class', $classes, $class );
+
+ $classes = array_map( 'sanitize_html_class', $classes );
+
+ return array_unique( $classes );
+ }
+}
+
+/**
+ * Get post format
+ */
+if ( ! function_exists( 'astra_get_post_format' ) ) {
+
+ /**
+ * Get post format
+ *
+ * @param string $post_format_override Override post formate.
+ * @return string Return post format.
+ */
+ function astra_get_post_format( $post_format_override = '' ) {
+
+ if ( ( is_home() ) || is_archive() ) {
+ $post_format = 'blog';
+ } else {
+ $post_format = get_post_format();
+ }
+
+ return apply_filters( 'astra_get_post_format', $post_format, $post_format_override );
+ }
+}
+
+/**
+ * Wrapper function for get_the_title() for blog post.
+ */
+if ( ! function_exists( 'astra_the_post_title' ) ) {
+
+ /**
+ * Wrapper function for get_the_title() for blog post.
+ *
+ * Displays title only if the page title bar is disabled.
+ *
+ * @since 1.0.15
+ * @param string $before Optional. Content to prepend to the title.
+ * @param string $after Optional. Content to append to the title.
+ * @param int $post_id Optional, default to 0. Post id.
+ * @param bool $echo Optional, default to true.Whether to display or return.
+ * @return string|void String if $echo parameter is false.
+ */
+ function astra_the_post_title( $before = '', $after = '', $post_id = 0, $echo = true ) {
+
+ $enabled = apply_filters( 'astra_the_post_title_enabled', true );
+ if ( $enabled ) {
+
+ $title = astra_get_the_title( $post_id );
+ $before = apply_filters( 'astra_the_post_title_before', $before );
+ $after = apply_filters( 'astra_the_post_title_after', $after );
+
+ // This will work same as `the_title` function but with Custom Title if exits.
+ if ( $echo ) {
+ echo $before . $title . $after; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ } else {
+ return $before . $title . $after;
+ }
+ }
+ }
+}
+
+/**
+ * Wrapper function for the_title()
+ */
+if ( ! function_exists( 'astra_the_title' ) ) {
+
+ /**
+ * Wrapper function for the_title()
+ *
+ * Displays title only if the page title bar is disabled.
+ *
+ * @param string $before Optional. Content to prepend to the title.
+ * @param string $after Optional. Content to append to the title.
+ * @param int $post_id Optional, default to 0. Post id.
+ * @param bool $echo Optional, default to true.Whether to display or return.
+ * @return string|void String if $echo parameter is false.
+ */
+ function astra_the_title( $before = '', $after = '', $post_id = 0, $echo = true ) {
+
+ $title = '';
+ $blog_post_title = astra_get_option( 'blog-post-structure' );
+ $single_post_title = astra_get_option( 'blog-single-post-structure' );
+
+ if ( ( ! is_singular() && in_array( 'title-meta', $blog_post_title ) ) || ( is_single() && in_array( 'single-title-meta', $single_post_title ) ) || is_page() ) {
+ if ( apply_filters( 'astra_the_title_enabled', true ) ) {
+
+ $title = astra_get_the_title( $post_id );
+ $before = apply_filters( 'astra_the_title_before', $before );
+ $after = apply_filters( 'astra_the_title_after', $after );
+
+ $title = $before . $title . $after;
+ }
+ }
+
+ // This will work same as `the_title` function but with Custom Title if exits.
+ if ( $echo ) {
+ echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ } else {
+ return $title;
+ }
+ }
+}
+
+/**
+ * Wrapper function for get_the_title()
+ */
+if ( ! function_exists( 'astra_get_the_title' ) ) {
+
+ /**
+ * Wrapper function for get_the_title()
+ *
+ * Return title for Title Bar and Normal Title.
+ *
+ * @param int $post_id Optional, default to 0. Post id.
+ * @param bool $echo Optional, default to false. Whether to display or return.
+ * @return string|void String if $echo parameter is false.
+ */
+ function astra_get_the_title( $post_id = 0, $echo = false ) {
+
+ $title = '';
+ if ( $post_id || is_singular() ) {
+ $title = get_the_title( $post_id );
+ } else {
+ if ( is_front_page() && is_home() ) {
+ // Default homepage.
+ $title = apply_filters( 'astra_the_default_home_page_title', esc_html__( 'Home', 'astra' ) );
+ } elseif ( is_home() ) {
+ // blog page.
+ $title = apply_filters( 'astra_the_blog_home_page_title', get_the_title( get_option( 'page_for_posts', true ) ) );
+ } elseif ( is_404() ) {
+ // for 404 page - title always display.
+ $title = apply_filters( 'astra_the_404_page_title', esc_html__( 'This page doesn\'t seem to exist.', 'astra' ) );
+
+ // for search page - title always display.
+ } elseif ( is_search() ) {
+
+ /* translators: 1: search string */
+ $title = apply_filters( 'astra_the_search_page_title', sprintf( __( 'Search Results for: %s', 'astra' ), '<span>' . get_search_query() . '</span>' ) );
+
+ } elseif ( class_exists( 'WooCommerce' ) && is_shop() ) {
+
+ $title = woocommerce_page_title( false );
+
+ } elseif ( is_archive() ) {
+
+ $title = get_the_archive_title();
+
+ }
+ }
+
+ $title = apply_filters( 'astra_the_title', $title, $post_id );
+
+ // This will work same as `get_the_title` function but with Custom Title if exits.
+ if ( $echo ) {
+ echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ } else {
+ return $title;
+ }
+ }
+}
+
+/**
+ * Archive Page Title
+ */
+if ( ! function_exists( 'astra_archive_page_info' ) ) {
+
+ /**
+ * Wrapper function for the_title()
+ *
+ * Displays title only if the page title bar is disabled.
+ */
+ function astra_archive_page_info() {
+
+ if ( apply_filters( 'astra_the_title_enabled', true ) ) {
+
+ // Author.
+ if ( is_author() ) { ?>
+
+ <section class="ast-author-box ast-archive-description">
+ <div class="ast-author-bio">
+ <?php do_action( 'astra_before_archive_title' ); ?>
+ <h1 class='page-title ast-archive-title'><?php echo get_the_author(); ?></h1>
+ <?php do_action( 'astra_after_archive_title' ); ?>
+ <p><?php echo wp_kses_post( get_the_author_meta( 'description' ) ); ?></p>
+ <?php do_action( 'astra_after_archive_description' ); ?>
+ </div>
+ <div class="ast-author-avatar">
+ <?php echo get_avatar( get_the_author_meta( 'email' ), 120 ); ?>
+ </div>
+ </section>
+
+ <?php
+
+ // Category.
+ } elseif ( is_category() ) {
+ ?>
+
+ <section class="ast-archive-description">
+ <?php do_action( 'astra_before_archive_title' ); ?>
+ <h1 class="page-title ast-archive-title"><?php echo single_cat_title(); ?></h1>
+ <?php do_action( 'astra_after_archive_title' ); ?>
+ <?php echo wp_kses_post( wpautop( get_the_archive_description() ) ); ?>
+ <?php do_action( 'astra_after_archive_description' ); ?>
+ </section>
+
+ <?php
+
+ // Tag.
+ } elseif ( is_tag() ) {
+ ?>
+
+ <section class="ast-archive-description">
+ <?php do_action( 'astra_before_archive_title' ); ?>
+ <h1 class="page-title ast-archive-title"><?php echo single_tag_title(); ?></h1>
+ <?php do_action( 'astra_after_archive_title' ); ?>
+ <?php echo wp_kses_post( wpautop( get_the_archive_description() ) ); ?>
+ <?php do_action( 'astra_after_archive_description' ); ?>
+ </section>
+
+ <?php
+
+ // Search.
+ } elseif ( is_search() ) {
+ ?>
+
+ <section class="ast-archive-description">
+ <?php do_action( 'astra_before_archive_title' ); ?>
+ <?php
+ /* translators: 1: search string */
+ $title = apply_filters( 'astra_the_search_page_title', sprintf( __( 'Search Results for: %s', 'astra' ), '<span>' . get_search_query() . '</span>' ) );
+ ?>
+ <h1 class="page-title ast-archive-title"> <?php echo $title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> </h1>
+ <?php do_action( 'astra_after_archive_title' ); ?>
+ </section>
+
+ <?php
+
+ // Other.
+ } else {
+ ?>
+
+ <section class="ast-archive-description">
+ <?php do_action( 'astra_before_archive_title' ); ?>
+ <?php the_archive_title( '<h1 class="page-title ast-archive-title">', '</h1>' ); ?>
+ <?php do_action( 'astra_after_archive_title' ); ?>
+ <?php echo wp_kses_post( wpautop( get_the_archive_description() ) ); ?>
+ <?php do_action( 'astra_after_archive_description' ); ?>
+ </section>
+
+ <?php
+ }
+ }
+ }
+
+ add_action( 'astra_archive_header', 'astra_archive_page_info' );
+}
+
+/**
+ * Adjust the HEX color brightness
+ */
+if ( ! function_exists( 'astra_adjust_brightness' ) ) {
+
+ /**
+ * Adjust Brightness
+ *
+ * @param string $hex Color code in HEX.
+ * @param number $steps brightness value.
+ * @param string $type brightness is reverse or default.
+ * @return string Color code in HEX.
+ */
+ function astra_adjust_brightness( $hex, $steps, $type ) {
+
+ // Get rgb vars.
+ $hex = str_replace( '#', '', $hex );
+
+ // Return if non hex.
+ if ( ! ctype_xdigit( $hex ) ) {
+ return $hex;
+ }
+
+ $shortcode_atts = array(
+ 'r' => hexdec( substr( $hex, 0, 2 ) ),
+ 'g' => hexdec( substr( $hex, 2, 2 ) ),
+ 'b' => hexdec( substr( $hex, 4, 2 ) ),
+ );
+
+ // Should we darken the color?
+ if ( 'reverse' == $type && $shortcode_atts['r'] + $shortcode_atts['g'] + $shortcode_atts['b'] > 382 ) {
+ $steps = -$steps;
+ } elseif ( 'darken' == $type ) {
+ $steps = -$steps;
+ }
+
+ // Build the new color.
+ $steps = max( -255, min( 255, $steps ) );
+
+ $shortcode_atts['r'] = max( 0, min( 255, $shortcode_atts['r'] + $steps ) );
+ $shortcode_atts['g'] = max( 0, min( 255, $shortcode_atts['g'] + $steps ) );
+ $shortcode_atts['b'] = max( 0, min( 255, $shortcode_atts['b'] + $steps ) );
+
+ $r_hex = str_pad( dechex( $shortcode_atts['r'] ), 2, '0', STR_PAD_LEFT );
+ $g_hex = str_pad( dechex( $shortcode_atts['g'] ), 2, '0', STR_PAD_LEFT );
+ $b_hex = str_pad( dechex( $shortcode_atts['b'] ), 2, '0', STR_PAD_LEFT );
+
+ return '#' . $r_hex . $g_hex . $b_hex;
+ }
+} // End if.
+
+/**
+ * Convert colors from HEX to RGBA
+ */
+if ( ! function_exists( 'astra_hex_to_rgba' ) ) :
+
+ /**
+ * Convert colors from HEX to RGBA
+ *
+ * @param string $color Color code in HEX.
+ * @param boolean $opacity Color code opacity.
+ * @return string Color code in RGB or RGBA.
+ */
+ function astra_hex_to_rgba( $color, $opacity = false ) {
+
+ $default = 'rgb(0,0,0)';
+
+ // Return default if no color provided.
+ if ( empty( $color ) ) {
+ return $default;
+ }
+
+ // Sanitize $color if "#" is provided.
+ if ( '#' == $color[0] ) {
+ $color = substr( $color, 1 );
+ }
+
+ // Check if color has 6 or 3 characters and get values.
+ if ( 6 == strlen( $color ) ) {
+ $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
+ } elseif ( 3 == strlen( $color ) ) {
+ $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
+ } else {
+ return $default;
+ }
+
+ // Convert HEX to RGB.
+ $rgb = array_map( 'hexdec', $hex );
+
+ // Check if opacity is set(RGBA or RGB).
+ if ( $opacity ) {
+ if ( 1 < abs( $opacity ) ) {
+ $opacity = 1.0;
+ }
+ $output = 'rgba(' . implode( ',', $rgb ) . ',' . $opacity . ')';
+ } else {
+ $output = 'rgb(' . implode( ',', $rgb ) . ')';
+ }
+
+ // Return RGB(a) color string.
+ return $output;
+ }
+
+endif;
+
+
+if ( ! function_exists( 'astra_enable_page_builder_compatibility' ) ) :
+
+ /**
+ * Allow filter to enable/disable page builder compatibility.
+ *
+ * @see https://wpastra.com/docs/recommended-settings-beaver-builder-astra/
+ * @see https://wpastra.com/docs/recommended-settings-for-elementor/
+ *
+ * @since 1.2.2
+ * @return bool True - If the page builder compatibility is enabled. False - IF the page builder compatibility is disabled.
+ */
+ function astra_enable_page_builder_compatibility() {
+ return apply_filters( 'astra_enable_page_builder_compatibility', true );
+ }
+
+endif;
+
+
+if ( ! function_exists( 'astra_get_pro_url' ) ) :
+ /**
+ * Returns an URL with utm tags
+ * the admin settings page.
+ *
+ * @param string $url URL fo the site.
+ * @param string $source utm source.
+ * @param string $medium utm medium.
+ * @param string $campaign utm campaign.
+ * @return mixed
+ */
+ function astra_get_pro_url( $url, $source = '', $medium = '', $campaign = '' ) {
+
+ $astra_pro_url = trailingslashit( $url );
+
+ // Set up our URL if we have a source.
+ if ( isset( $source ) ) {
+ $astra_pro_url = add_query_arg( 'utm_source', sanitize_text_field( $source ), $url );
+ }
+ // Set up our URL if we have a medium.
+ if ( isset( $medium ) ) {
+ $astra_pro_url = add_query_arg( 'utm_medium', sanitize_text_field( $medium ), $url );
+ }
+ // Set up our URL if we have a campaign.
+ if ( isset( $campaign ) ) {
+ $astra_pro_url = add_query_arg( 'utm_campaign', sanitize_text_field( $campaign ), $url );
+ }
+
+ return esc_url( apply_filters( 'astra_get_pro_url', $astra_pro_url, $url ) );
+ }
+
+endif;
+
+
+/**
+ * Search Form
+ */
+if ( ! function_exists( 'astra_get_search_form' ) ) :
+ /**
+ * Display search form.
+ *
+ * @param bool $echo Default to echo and not return the form.
+ * @return string|void String when $echo is false.
+ */
+ function astra_get_search_form( $echo = true ) {
+
+ $form = get_search_form(
+ array(
+ 'input_placeholder' => apply_filters( 'astra_search_field_placeholder', esc_attr_x( 'Search &hellip;', 'placeholder', 'astra' ) ),
+ 'data_attributes' => apply_filters( 'astra_search_field_toggle_data_attrs', '' ),
+ 'input_value' => get_search_query(),
+ 'show_input_submit' => false,
+ )
+ );
+
+ /**
+ * Filters the HTML output of the search form.
+ *
+ * @param string $form The search form HTML output.
+ */
+ $result = apply_filters( 'astra_get_search_form', $form );
+
+ if ( null === $result ) {
+ $result = $form;
+ }
+
+ if ( $echo ) {
+ echo $result; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ } else {
+ return $result;
+ }
+ }
+
+endif;
+
+/**
+ * Check if we're being delivered AMP
+ *
+ * @return bool
+ */
+function astra_is_amp_endpoint() {
+ return function_exists( 'is_amp_endpoint' ) && is_amp_endpoint();
+}
+
+/*
+ * Get Responsive Spacing
+ */
+if ( ! function_exists( 'astra_responsive_spacing' ) ) {
+
+ /**
+ * Get Spacing value
+ *
+ * @param array $option CSS value.
+ * @param string $side top | bottom | left | right.
+ * @param string $device CSS device.
+ * @param string $default Default value.
+ * @param string $prefix Prefix value.
+ * @return mixed
+ */
+ function astra_responsive_spacing( $option, $side = '', $device = 'desktop', $default = '', $prefix = '' ) {
+
+ if ( isset( $option[ $device ][ $side ] ) && isset( $option[ $device . '-unit' ] ) ) {
+ $spacing = astra_get_css_value( $option[ $device ][ $side ], $option[ $device . '-unit' ], $default );
+ } elseif ( is_numeric( $option ) ) {
+ $spacing = astra_get_css_value( $option );
+ } else {
+ $spacing = ( ! is_array( $option ) ) ? $option : '';
+ }
+
+ if ( '' !== $prefix && '' !== $spacing ) {
+ return $prefix . $spacing;
+ }
+ return $spacing;
+ }
+}
+
+/**
+ * Get the tablet breakpoint value.
+ *
+ * @param string $min min.
+ * @param string $max max.
+ *
+ * @since 2.4.0
+ *
+ * @return number $breakpoint.
+ */
+function astra_get_tablet_breakpoint( $min = '', $max = '' ) {
+
+ $update_breakpoint = astra_get_option( 'can-update-theme-tablet-breakpoint', true );
+
+ // Change default for new users.
+ $default = ( true === $update_breakpoint ) ? 921 : 768;
+
+ $header_breakpoint = apply_filters( 'astra_tablet_breakpoint', $default );
+
+ if ( '' !== $min ) {
+ $header_breakpoint = $header_breakpoint - $min;
+ } elseif ( '' !== $max ) {
+ $header_breakpoint = $header_breakpoint + $max;
+ }
+
+ return absint( $header_breakpoint );
+}
+
+/**
+ * Get the mobile breakpoint value.
+ *
+ * @param string $min min.
+ * @param string $max max.
+ *
+ * @since 2.4.0
+ *
+ * @return number header_breakpoint.
+ */
+function astra_get_mobile_breakpoint( $min = '', $max = '' ) {
+
+ $header_breakpoint = apply_filters( 'astra_mobile_breakpoint', 544 );
+
+ if ( '' !== $min ) {
+ $header_breakpoint = $header_breakpoint - $min;
+ } elseif ( '' !== $max ) {
+ $header_breakpoint = $header_breakpoint + $max;
+ }
+
+ return absint( $header_breakpoint );
+}
+
+/*
+ * Apply CSS for the element
+ */
+if ( ! function_exists( 'astra_color_responsive_css' ) ) {
+
+ /**
+ * Astra Responsive Colors
+ *
+ * @param array $setting Responsive colors.
+ * @param string $css_property CSS property.
+ * @param string $selector CSS selector.
+ * @return string Dynamic responsive CSS.
+ */
+ function astra_color_responsive_css( $setting, $css_property, $selector ) {
+ $css = '';
+ if ( isset( $setting['desktop'] ) && ! empty( $setting['desktop'] ) ) {
+ $css .= $selector . '{' . $css_property . ':' . esc_attr( $setting['desktop'] ) . ';}';
+ }
+ if ( isset( $setting['tablet'] ) && ! empty( $setting['tablet'] ) ) {
+ $css .= '@media (max-width:' . astra_get_tablet_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['tablet'] ) . ';} }';
+ }
+ if ( isset( $setting['mobile'] ) && ! empty( $setting['mobile'] ) ) {
+ $css .= '@media (max-width:' . astra_get_mobile_breakpoint() . 'px) {' . $selector . '{' . $css_property . ':' . esc_attr( $setting['mobile'] ) . ';} }';
+ }
+ return $css;
+ }
+}
+
+if ( ! function_exists( 'astra_check_is_bb_themer_layout' ) ) :
+
+ /**
+ * Check if layout is bb themer's layout
+ */
+ function astra_check_is_bb_themer_layout() {
+
+ $is_layout = false;
+
+ $post_type = get_post_type();
+ $post_id = get_the_ID();
+
+ if ( 'fl-theme-layout' === $post_type && $post_id ) {
+
+ $is_layout = true;
+ }
+
+ return $is_layout;
+ }
+
+endif;
+
+
+if ( ! function_exists( 'astra_is_white_labelled' ) ) :
+
+ /**
+ * Check if white label option is enabled in astra pro plugin
+ */
+ function astra_is_white_labelled() {
+
+ if ( is_callable( 'Astra_Ext_White_Label_Markup::show_branding' ) && ! Astra_Ext_White_Label_Markup::show_branding() ) {
+ return apply_filters( 'astra_is_white_labelled', true );
+ }
+
+ return apply_filters( 'astra_is_white_labelled', false );
+ }
+
+endif;
+
+/**
+ * Get the value for font-display property.
+ *
+ * @since 1.8.6
+ * @return string
+ */
+function astra_get_fonts_display_property() {
+ return apply_filters( 'astra_fonts_display_property', 'fallback' );
+}
+
+/**
+ * Return Theme options from database.
+ *
+ * @param string $option Option key.
+ * @param string $default Option default value.
+ * @param string $deprecated Option default value.
+ * @return Mixed Return option value.
+ */
+function astra_get_db_option( $option, $default = '', $deprecated = '' ) {
+
+ if ( '' != $deprecated ) {
+ $default = $deprecated;
+ }
+
+ $theme_options = Astra_Theme_Options::get_db_options();
+
+ /**
+ * Filter the options array for Astra Settings.
+ *
+ * @since 1.0.20
+ * @var Array
+ */
+ $theme_options = apply_filters( 'astra_get_db_option_array', $theme_options, $option, $default );
+
+ $value = ( isset( $theme_options[ $option ] ) && '' !== $theme_options[ $option ] ) ? $theme_options[ $option ] : $default;
+
+ /**
+ * Dynamic filter astra_get_option_$option.
+ * $option is the name of the Astra Setting, Refer Astra_Theme_Options::defaults() for option names from the theme.
+ *
+ * @since 1.0.20
+ * @var Mixed.
+ */
+ return apply_filters( "astra_get_db_option_{$option}", $value, $option, $default );
+}
+
+/**
+ * Generate Responsive Background Color CSS.
+ *
+ * @param array $bg_obj_res array of background object.
+ * @param string $device CSS for which device.
+ * @return array
+ */
+function astra_get_responsive_background_obj( $bg_obj_res, $device ) {
+
+ $gen_bg_css = array();
+
+ if ( ! is_array( $bg_obj_res ) ) {
+ return;
+ }
+
+ $bg_obj = $bg_obj_res[ $device ];
+ $bg_img = isset( $bg_obj['background-image'] ) ? $bg_obj['background-image'] : '';
+ $bg_tab_img = isset( $bg_obj_res['tablet']['background-image'] ) ? $bg_obj_res['tablet']['background-image'] : '';
+ $bg_desk_img = isset( $bg_obj_res['desktop']['background-image'] ) ? $bg_obj_res['desktop']['background-image'] : '';
+ $bg_color = isset( $bg_obj['background-color'] ) ? $bg_obj['background-color'] : '';
+ $tablet_css = ( isset( $bg_obj_res['tablet']['background-image'] ) && $bg_obj_res['tablet']['background-image'] ) ? true : false;
+ $desktop_css = ( isset( $bg_obj_res['desktop']['background-image'] ) && $bg_obj_res['desktop']['background-image'] ) ? true : false;
+
+ $bg_type = ( isset( $bg_obj['background-type'] ) && $bg_obj['background-type'] ) ? $bg_obj['background-type'] : '';
+
+ if ( '' !== $bg_type ) {
+ switch ( $bg_type ) {
+ case 'color':
+ if ( '' !== $bg_img && '' !== $bg_color ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');';
+ } elseif ( 'mobile' === $device ) {
+ if ( $desktop_css ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_desk_img . ');';
+ } elseif ( $tablet_css ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_tab_img . ');';
+ } else {
+ $gen_bg_css['background-color'] = $bg_color . ';';
+ $gen_bg_css['background-image'] = 'none;';
+ }
+ } elseif ( 'tablet' === $device ) {
+ if ( $desktop_css ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_desk_img . ');';
+ } else {
+ $gen_bg_css['background-color'] = $bg_color . ';';
+ $gen_bg_css['background-image'] = 'none;';
+ }
+ } elseif ( '' === $bg_img ) {
+ $gen_bg_css['background-color'] = $bg_color . ';';
+ $gen_bg_css['background-image'] = 'none;';
+ }
+ break;
+
+ case 'image':
+ if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) {
+ $gen_bg_css['background-image'] = 'linear-gradient(to right, ' . $bg_color . ', ' . $bg_color . '), url(' . $bg_img . ');';
+ }
+ if ( '' === $bg_color || is_numeric( strpos( $bg_color, 'linear-gradient' ) ) || is_numeric( strpos( $bg_color, 'radial-gradient' ) ) && '' !== $bg_img ) {
+ $gen_bg_css['background-image'] = 'url(' . $bg_img . ');';
+ }
+ break;
+
+ case 'gradient':
+ if ( isset( $bg_color ) ) {
+ $gen_bg_css['background-image'] = $bg_color . ';';
+ }
+ break;
+
+ default:
+ break;
+ }
+ } elseif ( '' !== $bg_color ) {
+ $gen_bg_css['background-color'] = $bg_color . ';';
+ }
+
+ if ( '' !== $bg_img ) {
+ if ( isset( $bg_obj['background-repeat'] ) ) {
+ $gen_bg_css['background-repeat'] = esc_attr( $bg_obj['background-repeat'] );
+ }
+
+ if ( isset( $bg_obj['background-position'] ) ) {
+ $gen_bg_css['background-position'] = esc_attr( $bg_obj['background-position'] );
+ }
+
+ if ( isset( $bg_obj['background-size'] ) ) {
+ $gen_bg_css['background-size'] = esc_attr( $bg_obj['background-size'] );
+ }
+
+ if ( isset( $bg_obj['background-attachment'] ) ) {
+ $gen_bg_css['background-attachment'] = esc_attr( $bg_obj['background-attachment'] );
+ }
+ }
+
+ return $gen_bg_css;
+}
+
+/**
+ * Common function to check is pagination is enabled on current page.
+ *
+ * @since 3.0.1
+ * @return boolean
+ */
+function is_astra_pagination_enabled() {
+ global $wp_query;
+
+ return ( $wp_query->max_num_pages > 1 && apply_filters( 'astra_pagination_enabled', true ) );
+}
+
+/**
+ * Verify is current post comments are enabled or not for applying dynamic CSS.
+ *
+ * @since 3.0.1
+ * @return boolean
+ */
+function is_current_post_comment_enabled() {
+ return ( is_singular() && comments_open() );
+}
diff --git a/inc/core/deprecated/deprecated-filters.php b/inc/core/deprecated/deprecated-filters.php
index ae044ee..bd3da36 100644
--- a/inc/core/deprecated/deprecated-filters.php
+++ b/inc/core/deprecated/deprecated-filters.php
@@ -1,87 +1,87 @@
-<?php
-/**
- * Deprecated Filters of Astra Theme.
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.0.23
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-// Depreciating astra_color_palletes filter.
-add_filter( 'astra_color_palettes', 'astra_deprecated_color_palette', 10, 1 );
-
-/**
- * Astra Color Palettes
- *
- * @since 1.0.23
- * @param array $color_palette customizer color palettes.
- * @return array $color_palette updated customizer color palettes.
- */
-function astra_deprecated_color_palette( $color_palette ) {
-
- $color_palette = astra_apply_filters_deprecated( 'astra_color_palletes', array( $color_palette ), '1.0.22', 'astra_color_palettes', '' );
-
- return $color_palette;
-}
-
-
-// Deprecating astra_sigle_post_navigation_enabled filter.
-add_filter( 'astra_single_post_navigation_enabled', 'astra_deprecated_sigle_post_navigation_enabled', 10, 1 );
-
-/**
- * Astra Single Post Navigation
- *
- * @since 1.0.27
- * @param boolean $post_nav true | false.
- * @return boolean $post_nav true for enabled | false for disable.
- */
-function astra_deprecated_sigle_post_navigation_enabled( $post_nav ) {
-
- $post_nav = astra_apply_filters_deprecated( 'astra_sigle_post_navigation_enabled', array( $post_nav ), '1.0.27', 'astra_single_post_navigation_enabled', '' );
-
- return $post_nav;
-}
-
-// Deprecating astra_primary_header_main_rt_section filter.
-add_filter( 'astra_header_section_elements', 'astra_deprecated_primary_header_main_rt_section', 10, 2 );
-
-/**
- * Astra Header elements.
- *
- * @since 1.2.2
- * @param array $elements List of elements.
- * @param string $header Header section type.
- * @return array
- */
-function astra_deprecated_primary_header_main_rt_section( $elements, $header ) {
-
- $elements = astra_apply_filters_deprecated( 'astra_primary_header_main_rt_section', array( $elements, $header ), '1.2.2', 'astra_header_section_elements', '' );
-
- return $elements;
-}
-
-if ( ! function_exists( 'astra_apply_filters_deprecated' ) ) {
- /**
- * Astra Filter Deprecated
- *
- * @since 1.1.1
- * @param string $tag The name of the filter hook.
- * @param array $args Array of additional function arguments to be passed to apply_filters().
- * @param string $version The version of WordPress that deprecated the hook.
- * @param string $replacement Optional. The hook that should have been used. Default false.
- * @param string $message Optional. A message regarding the change. Default null.
- */
- function astra_apply_filters_deprecated( $tag, $args, $version, $replacement = false, $message = null ) {
- if ( function_exists( 'apply_filters_deprecated' ) ) { /* WP >= 4.6 */
- return apply_filters_deprecated( $tag, $args, $version, $replacement, $message );
- } else {
- return apply_filters_ref_array( $tag, $args );
- }
- }
-}
+<?php
+/**
+ * Deprecated Filters of Astra Theme.
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.23
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+// Depreciating astra_color_palletes filter.
+add_filter( 'astra_color_palettes', 'astra_deprecated_color_palette', 10, 1 );
+
+/**
+ * Astra Color Palettes
+ *
+ * @since 1.0.23
+ * @param array $color_palette customizer color palettes.
+ * @return array $color_palette updated customizer color palettes.
+ */
+function astra_deprecated_color_palette( $color_palette ) {
+
+ $color_palette = astra_apply_filters_deprecated( 'astra_color_palletes', array( $color_palette ), '1.0.22', 'astra_color_palettes', '' );
+
+ return $color_palette;
+}
+
+
+// Deprecating astra_sigle_post_navigation_enabled filter.
+add_filter( 'astra_single_post_navigation_enabled', 'astra_deprecated_sigle_post_navigation_enabled', 10, 1 );
+
+/**
+ * Astra Single Post Navigation
+ *
+ * @since 1.0.27
+ * @param boolean $post_nav true | false.
+ * @return boolean $post_nav true for enabled | false for disable.
+ */
+function astra_deprecated_sigle_post_navigation_enabled( $post_nav ) {
+
+ $post_nav = astra_apply_filters_deprecated( 'astra_sigle_post_navigation_enabled', array( $post_nav ), '1.0.27', 'astra_single_post_navigation_enabled', '' );
+
+ return $post_nav;
+}
+
+// Deprecating astra_primary_header_main_rt_section filter.
+add_filter( 'astra_header_section_elements', 'astra_deprecated_primary_header_main_rt_section', 10, 2 );
+
+/**
+ * Astra Header elements.
+ *
+ * @since 1.2.2
+ * @param array $elements List of elements.
+ * @param string $header Header section type.
+ * @return array
+ */
+function astra_deprecated_primary_header_main_rt_section( $elements, $header ) {
+
+ $elements = astra_apply_filters_deprecated( 'astra_primary_header_main_rt_section', array( $elements, $header ), '1.2.2', 'astra_header_section_elements', '' );
+
+ return $elements;
+}
+
+if ( ! function_exists( 'astra_apply_filters_deprecated' ) ) {
+ /**
+ * Astra Filter Deprecated
+ *
+ * @since 1.1.1
+ * @param string $tag The name of the filter hook.
+ * @param array $args Array of additional function arguments to be passed to apply_filters().
+ * @param string $version The version of WordPress that deprecated the hook.
+ * @param string $replacement Optional. The hook that should have been used. Default false.
+ * @param string $message Optional. A message regarding the change. Default null.
+ */
+ function astra_apply_filters_deprecated( $tag, $args, $version, $replacement = false, $message = null ) {
+ if ( function_exists( 'apply_filters_deprecated' ) ) { /* WP >= 4.6 */
+ return apply_filters_deprecated( $tag, $args, $version, $replacement, $message );
+ } else {
+ return apply_filters_ref_array( $tag, $args );
+ }
+ }
+}
diff --git a/inc/core/deprecated/deprecated-functions.php b/inc/core/deprecated/deprecated-functions.php
index 779d474..99dea01 100644
--- a/inc/core/deprecated/deprecated-functions.php
+++ b/inc/core/deprecated/deprecated-functions.php
@@ -1,145 +1,145 @@
-<?php
-/**
- * Deprecated Functions of Astra Theme.
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.0.23
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-if ( ! function_exists( 'astra_blog_post_thumbnai_and_title_order' ) ) :
-
- /**
- * Blog post thumbnail & title order
- *
- * @since 1.4.9
- * @deprecated 1.4.9 Use astra_blog_post_thumbnail_and_title_order()
- * @see astra_blog_post_thumbnail_and_title_order()
- *
- * @return void
- */
- function astra_blog_post_thumbnai_and_title_order() {
- _deprecated_function( __FUNCTION__, '1.4.9', 'astra_blog_post_thumbnail_and_title_order()' );
-
- astra_blog_post_thumbnail_and_title_order();
- }
-
-endif;
-
-if ( ! function_exists( 'get_astra_secondary_class' ) ) :
-
- /**
- * Retrieve the classes for the secondary element as an array.
- *
- * @since 1.5.2
- * @deprecated 1.5.2 Use astra_get_secondary_class()
- * @param string|array $class One or more classes to add to the class list.
- * @see astra_get_secondary_class()
- *
- * @return array
- */
- function get_astra_secondary_class( $class = '' ) {
- _deprecated_function( __FUNCTION__, '1.5.2', 'astra_get_secondary_class()' );
-
- return astra_get_secondary_class( $class );
- }
-
-endif;
-
-if ( ! function_exists( 'deprecated_astra_color_palette' ) ) :
-
- /**
- * Depreciating astra_color_palletes filter.
- *
- * @since 1.5.2
- * @deprecated 1.5.2 Use astra_deprecated_color_palette()
- * @param array $color_palette customizer color palettes.
- * @see astra_deprecated_color_palette()
- *
- * @return array
- */
- function deprecated_astra_color_palette( $color_palette ) {
- _deprecated_function( __FUNCTION__, '1.5.2', 'astra_deprecated_color_palette()' );
-
- return astra_deprecated_color_palette( $color_palette );
- }
-
-endif;
-
-if ( ! function_exists( 'deprecated_astra_sigle_post_navigation_enabled' ) ) :
-
- /**
- * Deprecating astra_sigle_post_navigation_enabled filter.
- *
- * @since 1.5.2
- * @deprecated 1.5.2 Use astra_deprecated_sigle_post_navigation_enabled()
- * @param boolean $post_nav true | false.
- * @see astra_deprecated_sigle_post_navigation_enabled()
- *
- * @return array
- */
- function deprecated_astra_sigle_post_navigation_enabled( $post_nav ) {
- _deprecated_function( __FUNCTION__, '1.5.2', 'astra_deprecated_sigle_post_navigation_enabled()' );
-
- return astra_deprecated_sigle_post_navigation_enabled( $post_nav );
- }
-
-endif;
-
-if ( ! function_exists( 'deprecated_astra_primary_header_main_rt_section' ) ) :
-
- /**
- * Deprecating astra_primary_header_main_rt_section filter.
- *
- * @since 1.5.2
- * @deprecated 1.5.2 Use astra_deprecated_primary_header_main_rt_section()
- * @param array $elements List of elements.
- * @param string $header Header section type.
- * @see astra_deprecated_primary_header_main_rt_section()
- *
- * @return array
- */
- function deprecated_astra_primary_header_main_rt_section( $elements, $header ) {
- _deprecated_function( __FUNCTION__, '1.5.2', 'astra_deprecated_primary_header_main_rt_section()' );
-
- return astra_deprecated_primary_header_main_rt_section( $elements, $header );
- }
-
-endif;
-
-if ( ! function_exists( 'astar' ) ) :
-
- /**
- * Get a specific property of an array without needing to check if that property exists.
- *
- * @since 1.5.2
- * @deprecated 1.5.2 Use astra_get_prop()
- * @param array $array Array from which the property's value should be retrieved.
- * @param string $prop Name of the property to be retrieved.
- * @param string $default Optional. Value that should be returned if the property is not set or empty. Defaults to null.
- * @see astra_get_prop()
- *
- * @return null|string|mixed The value
- */
- function astar( $array, $prop, $default = null ) {
- return astra_get_prop( $array, $prop, $default );
- }
-
-endif;
-
-/**
- * Check if we're being delivered AMP.
- *
- * @return bool
- */
-function astra_is_emp_endpoint() {
- _deprecated_function( __FUNCTION__, '2.0.1', 'astra_is_amp_endpoint()' );
-
- return astra_is_amp_endpoint();
-}
+<?php
+/**
+ * Deprecated Functions of Astra Theme.
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.23
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+if ( ! function_exists( 'astra_blog_post_thumbnai_and_title_order' ) ) :
+
+ /**
+ * Blog post thumbnail & title order
+ *
+ * @since 1.4.9
+ * @deprecated 1.4.9 Use astra_blog_post_thumbnail_and_title_order()
+ * @see astra_blog_post_thumbnail_and_title_order()
+ *
+ * @return void
+ */
+ function astra_blog_post_thumbnai_and_title_order() {
+ _deprecated_function( __FUNCTION__, '1.4.9', 'astra_blog_post_thumbnail_and_title_order()' );
+
+ astra_blog_post_thumbnail_and_title_order();
+ }
+
+endif;
+
+if ( ! function_exists( 'get_astra_secondary_class' ) ) :
+
+ /**
+ * Retrieve the classes for the secondary element as an array.
+ *
+ * @since 1.5.2
+ * @deprecated 1.5.2 Use astra_get_secondary_class()
+ * @param string|array $class One or more classes to add to the class list.
+ * @see astra_get_secondary_class()
+ *
+ * @return array
+ */
+ function get_astra_secondary_class( $class = '' ) {
+ _deprecated_function( __FUNCTION__, '1.5.2', 'astra_get_secondary_class()' );
+
+ return astra_get_secondary_class( $class );
+ }
+
+endif;
+
+if ( ! function_exists( 'deprecated_astra_color_palette' ) ) :
+
+ /**
+ * Depreciating astra_color_palletes filter.
+ *
+ * @since 1.5.2
+ * @deprecated 1.5.2 Use astra_deprecated_color_palette()
+ * @param array $color_palette customizer color palettes.
+ * @see astra_deprecated_color_palette()
+ *
+ * @return array
+ */
+ function deprecated_astra_color_palette( $color_palette ) {
+ _deprecated_function( __FUNCTION__, '1.5.2', 'astra_deprecated_color_palette()' );
+
+ return astra_deprecated_color_palette( $color_palette );
+ }
+
+endif;
+
+if ( ! function_exists( 'deprecated_astra_sigle_post_navigation_enabled' ) ) :
+
+ /**
+ * Deprecating astra_sigle_post_navigation_enabled filter.
+ *
+ * @since 1.5.2
+ * @deprecated 1.5.2 Use astra_deprecated_sigle_post_navigation_enabled()
+ * @param boolean $post_nav true | false.
+ * @see astra_deprecated_sigle_post_navigation_enabled()
+ *
+ * @return array
+ */
+ function deprecated_astra_sigle_post_navigation_enabled( $post_nav ) {
+ _deprecated_function( __FUNCTION__, '1.5.2', 'astra_deprecated_sigle_post_navigation_enabled()' );
+
+ return astra_deprecated_sigle_post_navigation_enabled( $post_nav );
+ }
+
+endif;
+
+if ( ! function_exists( 'deprecated_astra_primary_header_main_rt_section' ) ) :
+
+ /**
+ * Deprecating astra_primary_header_main_rt_section filter.
+ *
+ * @since 1.5.2
+ * @deprecated 1.5.2 Use astra_deprecated_primary_header_main_rt_section()
+ * @param array $elements List of elements.
+ * @param string $header Header section type.
+ * @see astra_deprecated_primary_header_main_rt_section()
+ *
+ * @return array
+ */
+ function deprecated_astra_primary_header_main_rt_section( $elements, $header ) {
+ _deprecated_function( __FUNCTION__, '1.5.2', 'astra_deprecated_primary_header_main_rt_section()' );
+
+ return astra_deprecated_primary_header_main_rt_section( $elements, $header );
+ }
+
+endif;
+
+if ( ! function_exists( 'astar' ) ) :
+
+ /**
+ * Get a specific property of an array without needing to check if that property exists.
+ *
+ * @since 1.5.2
+ * @deprecated 1.5.2 Use astra_get_prop()
+ * @param array $array Array from which the property's value should be retrieved.
+ * @param string $prop Name of the property to be retrieved.
+ * @param string $default Optional. Value that should be returned if the property is not set or empty. Defaults to null.
+ * @see astra_get_prop()
+ *
+ * @return null|string|mixed The value
+ */
+ function astar( $array, $prop, $default = null ) {
+ return astra_get_prop( $array, $prop, $default );
+ }
+
+endif;
+
+/**
+ * Check if we're being delivered AMP.
+ *
+ * @return bool
+ */
+function astra_is_emp_endpoint() {
+ _deprecated_function( __FUNCTION__, '2.0.1', 'astra_is_amp_endpoint()' );
+
+ return astra_is_amp_endpoint();
+}
diff --git a/inc/core/deprecated/deprecated-hooks.php b/inc/core/deprecated/deprecated-hooks.php
index 0f2943d..b0f62be 100644
--- a/inc/core/deprecated/deprecated-hooks.php
+++ b/inc/core/deprecated/deprecated-hooks.php
@@ -1,34 +1,34 @@
-<?php
-/**
- * Deprecated Hooks of Astra Theme.
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.0.23
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-if ( ! function_exists( 'astra_do_action_deprecated' ) ) {
- /**
- * Astra Filter Deprecated
- *
- * @since 1.1.1
- * @param string $tag The name of the filter hook.
- * @param array $args Array of additional function arguments to be passed to apply_filters().
- * @param string $version The version of WordPress that deprecated the hook.
- * @param string $replacement Optional. The hook that should have been used. Default false.
- * @param string $message Optional. A message regarding the change. Default null.
- */
- function astra_do_action_deprecated( $tag, $args, $version, $replacement = false, $message = null ) {
- if ( function_exists( 'do_action_deprecated' ) ) { /* WP >= 4.6 */
- do_action_deprecated( $tag, $args, $version, $replacement, $message );
- } else {
- do_action_ref_array( $tag, $args );
- }
- }
-}
+<?php
+/**
+ * Deprecated Hooks of Astra Theme.
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.23
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+if ( ! function_exists( 'astra_do_action_deprecated' ) ) {
+ /**
+ * Astra Filter Deprecated
+ *
+ * @since 1.1.1
+ * @param string $tag The name of the filter hook.
+ * @param array $args Array of additional function arguments to be passed to apply_filters().
+ * @param string $version The version of WordPress that deprecated the hook.
+ * @param string $replacement Optional. The hook that should have been used. Default false.
+ * @param string $message Optional. A message regarding the change. Default null.
+ */
+ function astra_do_action_deprecated( $tag, $args, $version, $replacement = false, $message = null ) {
+ if ( function_exists( 'do_action_deprecated' ) ) { /* WP >= 4.6 */
+ do_action_deprecated( $tag, $args, $version, $replacement, $message );
+ } else {
+ do_action_ref_array( $tag, $args );
+ }
+ }
+}
diff --git a/inc/core/index.php b/inc/core/index.php
index 8b96815..820bcb9 100644
--- a/inc/core/index.php
+++ b/inc/core/index.php
@@ -1,9 +1,9 @@
-<?php
-/**
- * Index file
- *
- * @package Astra
- * @since Astra 1.0.0
- */
-
-/* Silence is golden, and we agree. */
+<?php
+/**
+ * Index file
+ *
+ * @package Astra
+ * @since Astra 1.0.0
+ */
+
+/* Silence is golden, and we agree. */
diff --git a/inc/core/sidebar-manager.php b/inc/core/sidebar-manager.php
index a191020..6dbdb8f 100644
--- a/inc/core/sidebar-manager.php
+++ b/inc/core/sidebar-manager.php
@@ -1,82 +1,82 @@
-<?php
-/**
- * Sidebar Manager functions
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.0.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-/**
- * Site Sidebar
- */
-if ( ! function_exists( 'astra_page_layout' ) ) {
-
- /**
- * Site Sidebar
- *
- * Default 'right sidebar' for overall site.
- */
- function astra_page_layout() {
-
- if ( is_singular() ) {
-
- // If post meta value is empty,
- // Then get the POST_TYPE sidebar.
- $layout = astra_get_option_meta( 'site-sidebar-layout', '', true );
-
- if ( empty( $layout ) ) {
-
- $post_type = get_post_type();
-
- if ( 'post' === $post_type || 'page' === $post_type || 'product' === $post_type ) {
- $layout = astra_get_option( 'single-' . get_post_type() . '-sidebar-layout' );
- }
-
- 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' );
- }
- }
- } else {
-
- if ( is_search() ) {
-
- // Check only post type archive option value.
- $layout = astra_get_option( 'archive-post-sidebar-layout' );
-
- 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' );
- }
- } else {
-
- $post_type = get_post_type();
- $layout = '';
-
- if ( 'post' === $post_type ) {
- $layout = astra_get_option( 'archive-' . get_post_type() . '-sidebar-layout' );
- }
-
- 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 apply_filters( 'astra_page_layout', $layout );
- }
-}
+<?php
+/**
+ * Sidebar Manager functions
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Site Sidebar
+ */
+if ( ! function_exists( 'astra_page_layout' ) ) {
+
+ /**
+ * Site Sidebar
+ *
+ * Default 'right sidebar' for overall site.
+ */
+ function astra_page_layout() {
+
+ if ( is_singular() ) {
+
+ // If post meta value is empty,
+ // Then get the POST_TYPE sidebar.
+ $layout = astra_get_option_meta( 'site-sidebar-layout', '', true );
+
+ if ( empty( $layout ) ) {
+
+ $post_type = get_post_type();
+
+ if ( 'post' === $post_type || 'page' === $post_type || 'product' === $post_type ) {
+ $layout = astra_get_option( 'single-' . get_post_type() . '-sidebar-layout' );
+ }
+
+ 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' );
+ }
+ }
+ } else {
+
+ if ( is_search() ) {
+
+ // Check only post type archive option value.
+ $layout = astra_get_option( 'archive-post-sidebar-layout' );
+
+ 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' );
+ }
+ } else {
+
+ $post_type = get_post_type();
+ $layout = '';
+
+ if ( 'post' === $post_type ) {
+ $layout = astra_get_option( 'archive-' . get_post_type() . '-sidebar-layout' );
+ }
+
+ 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 apply_filters( 'astra_page_layout', $layout );
+ }
+}
diff --git a/inc/core/theme-hooks.php b/inc/core/theme-hooks.php
index 562b79e..35b012b 100644
--- a/inc/core/theme-hooks.php
+++ b/inc/core/theme-hooks.php
@@ -1,499 +1,499 @@
-<?php
-/**
- * Theme Hook Alliance hook stub list.
- *
- * @see https://github.com/zamoose/themehookalliance
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.0.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-/**
- * Themes and Plugins can check for astra_hooks using current_theme_supports( 'astra_hooks', $hook )
- * to determine whether a theme declares itself to support this specific hook type.
- *
- * Example:
- * <code>
- * // Declare support for all hook types
- * add_theme_support( 'astra_hooks', array( 'all' ) );
- *
- * // Declare support for certain hook types only
- * add_theme_support( 'astra_hooks', array( 'header', 'content', 'footer' ) );
- * </code>
- */
-add_theme_support(
- 'astra_hooks',
- array(
-
- /**
- * As a Theme developer, use the 'all' parameter, to declare support for all
- * hook types.
- * Please make sure you then actually reference all the hooks in this file,
- * Plugin developers depend on it!
- */
- 'all',
-
- /**
- * Themes can also choose to only support certain hook types.
- * Please make sure you then actually reference all the hooks in this type
- * family.
- *
- * When the 'all' parameter was set, specific hook types do not need to be
- * added explicitly.
- */
- 'html',
- 'body',
- 'head',
- 'header',
- 'content',
- 'entry',
- 'comments',
- 'sidebars',
- 'sidebar',
- 'footer',
-
- /**
- * If/when WordPress Core implements similar methodology, Themes and Plugins
- * will be able to check whether the version of THA supplied by the theme
- * supports Core hooks.
- */
- )
-);
-
-/**
- * Determines, whether the specific hook type is actually supported.
- *
- * Plugin developers should always check for the support of a <strong>specific</strong>
- * hook type before hooking a callback function to a hook of this type.
- *
- * Example:
- * <code>
- * if ( current_theme_supports( 'astra_hooks', 'header' ) )
- * add_action( 'astra_head_top', 'prefix_header_top' );
- * </code>
- *
- * @param bool $bool true.
- * @param array $args The hook type being checked.
- * @param array $registered All registered hook types.
- *
- * @return bool
- */
-function astra_current_theme_supports( $bool, $args, $registered ) {
- return in_array( $args[0], $registered[0] ) || in_array( 'all', $registered[0] );
-}
-add_filter( 'current_theme_supports-astra_hooks', 'astra_current_theme_supports', 10, 3 );
-
-/**
- * HTML <html> hook
- * Special case, useful for <DOCTYPE>, etc.
- * $astra_supports[] = 'html;
- */
-function astra_html_before() {
- do_action( 'astra_html_before' );
-}
-/**
- * HTML <body> hooks
- * $astra_supports[] = 'body';
- */
-function astra_body_top() {
- do_action( 'astra_body_top' );
-}
-
-/**
- * Body Bottom
- */
-function astra_body_bottom() {
- do_action( 'astra_body_bottom' );
-}
-
-/**
- * HTML <head> hooks
- *
- * $astra_supports[] = 'head';
- */
-function astra_head_top() {
- do_action( 'astra_head_top' );
-}
-
-/**
- * Head Bottom
- */
-function astra_head_bottom() {
- do_action( 'astra_head_bottom' );
-}
-
-/**
- * Semantic <header> hooks
- *
- * $astra_supports[] = 'header';
- */
-function astra_header_before() {
- do_action( 'astra_header_before' );
-}
-
-/**
- * Site Header
- */
-function astra_header() {
- do_action( 'astra_header' );
-}
-
-/**
- * Masthead Top
- */
-function astra_masthead_top() {
- do_action( 'astra_masthead_top' );
-}
-
-/**
- * Masthead
- */
-function astra_masthead() {
- do_action( 'astra_masthead' );
-}
-
-/**
- * Masthead Bottom
- */
-function astra_masthead_bottom() {
- do_action( 'astra_masthead_bottom' );
-}
-
-/**
- * Header After
- */
-function astra_header_after() {
- do_action( 'astra_header_after' );
-}
-
-/**
- * Main Header bar top
- */
-function astra_main_header_bar_top() {
- do_action( 'astra_main_header_bar_top' );
-}
-
-/**
- * Main Header bar bottom
- */
-function astra_main_header_bar_bottom() {
- do_action( 'astra_main_header_bar_bottom' );
-}
-
-/**
- * Main Header Content
- */
-function astra_masthead_content() {
- do_action( 'astra_masthead_content' );
-}
-/**
- * Main toggle button before
- */
-function astra_masthead_toggle_buttons_before() {
- do_action( 'astra_masthead_toggle_buttons_before' );
-}
-
-/**
- * Main toggle buttons
- */
-function astra_masthead_toggle_buttons() {
- do_action( 'astra_masthead_toggle_buttons' );
-}
-
-/**
- * Main toggle button after
- */
-function astra_masthead_toggle_buttons_after() {
- do_action( 'astra_masthead_toggle_buttons_after' );
-}
-
-/**
- * Semantic <content> hooks
- *
- * $astra_supports[] = 'content';
- */
-function astra_content_before() {
- do_action( 'astra_content_before' );
-}
-
-/**
- * Content after
- */
-function astra_content_after() {
- do_action( 'astra_content_after' );
-}
-
-/**
- * Content top
- */
-function astra_content_top() {
- do_action( 'astra_content_top' );
-}
-
-/**
- * Content bottom
- */
-function astra_content_bottom() {
- do_action( 'astra_content_bottom' );
-}
-
-/**
- * Content while before
- */
-function astra_content_while_before() {
- do_action( 'astra_content_while_before' );
-}
-
-/**
- * Content loop
- */
-function astra_content_loop() {
- do_action( 'astra_content_loop' );
-}
-
-/**
- * Conten Page Loop.
- *
- * Called from page.php
- */
-function astra_content_page_loop() {
- do_action( 'astra_content_page_loop' );
-}
-
-/**
- * Content while after
- */
-function astra_content_while_after() {
- do_action( 'astra_content_while_after' );
-}
-
-/**
- * Semantic <entry> hooks
- *
- * $astra_supports[] = 'entry';
- */
-function astra_entry_before() {
- do_action( 'astra_entry_before' );
-}
-
-/**
- * Entry after
- */
-function astra_entry_after() {
- do_action( 'astra_entry_after' );
-}
-
-/**
- * Entry content before
- */
-function astra_entry_content_before() {
- do_action( 'astra_entry_content_before' );
-}
-
-/**
- * Entry content after
- */
-function astra_entry_content_after() {
- do_action( 'astra_entry_content_after' );
-}
-
-/**
- * Entry Top
- */
-function astra_entry_top() {
- do_action( 'astra_entry_top' );
-}
-
-/**
- * Entry bottom
- */
-function astra_entry_bottom() {
- do_action( 'astra_entry_bottom' );
-}
-
-/**
- * Single Post Header Before
- */
-function astra_single_header_before() {
- do_action( 'astra_single_header_before' );
-}
-
-/**
- * Single Post Header After
- */
-function astra_single_header_after() {
- do_action( 'astra_single_header_after' );
-}
-
-/**
- * Single Post Header Top
- */
-function astra_single_header_top() {
- do_action( 'astra_single_header_top' );
-}
-
-/**
- * Single Post Header Bottom
- */
-function astra_single_header_bottom() {
- do_action( 'astra_single_header_bottom' );
-}
-
-/**
- * Comments block hooks
- *
- * $astra_supports[] = 'comments';
- */
-function astra_comments_before() {
- do_action( 'astra_comments_before' );
-}
-
-/**
- * Comments after.
- */
-function astra_comments_after() {
- do_action( 'astra_comments_after' );
-}
-
-/**
- * Semantic <sidebar> hooks
- *
- * $astra_supports[] = 'sidebar';
- */
-function astra_sidebars_before() {
- do_action( 'astra_sidebars_before' );
-}
-
-/**
- * Sidebars after
- */
-function astra_sidebars_after() {
- do_action( 'astra_sidebars_after' );
-}
-
-/**
- * Semantic <footer> hooks
- *
- * $astra_supports[] = 'footer';
- */
-function astra_footer() {
- do_action( 'astra_footer' );
-}
-
-/**
- * Footer before
- */
-function astra_footer_before() {
- do_action( 'astra_footer_before' );
-}
-
-/**
- * Footer after
- */
-function astra_footer_after() {
- do_action( 'astra_footer_after' );
-}
-
-/**
- * Footer top
- */
-function astra_footer_content_top() {
- do_action( 'astra_footer_content_top' );
-}
-
-/**
- * Footer
- */
-function astra_footer_content() {
- do_action( 'astra_footer_content' );
-}
-
-/**
- * Footer bottom
- */
-function astra_footer_content_bottom() {
- do_action( 'astra_footer_content_bottom' );
-}
-
-/**
- * Archive header
- */
-function astra_archive_header() {
- do_action( 'astra_archive_header' );
-}
-
-/**
- * Pagination
- */
-function astra_pagination() {
- do_action( 'astra_pagination' );
-}
-
-/**
- * Entry content single
- */
-function astra_entry_content_single() {
- do_action( 'astra_entry_content_single' );
-}
-
-/**
- * 404
- */
-function astra_entry_content_404_page() {
- do_action( 'astra_entry_content_404_page' );
-}
-
-/**
- * Entry content blog
- */
-function astra_entry_content_blog() {
- do_action( 'astra_entry_content_blog' );
-}
-
-/**
- * Blog featured post section
- */
-function astra_blog_post_featured_format() {
- do_action( 'astra_blog_post_featured_format' );
-}
-
-/**
- * Primary Content Top
- */
-function astra_primary_content_top() {
- do_action( 'astra_primary_content_top' );
-}
-
-/**
- * Primary Content Bottom
- */
-function astra_primary_content_bottom() {
- do_action( 'astra_primary_content_bottom' );
-}
-
-/**
- * 404 Page content template action.
- */
-function astra_404_content_template() {
- do_action( 'astra_404_content_template' );
-}
-
-if ( ! function_exists( 'wp_body_open' ) ) {
-
- /**
- * Fire the wp_body_open action.
- * Adds backward compatibility for WordPress versions < 5.2
- *
- * @since 1.8.7
- */
- function wp_body_open() {
- do_action( 'wp_body_open' );
- }
-}
+<?php
+/**
+ * Theme Hook Alliance hook stub list.
+ *
+ * @see https://github.com/zamoose/themehookalliance
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Themes and Plugins can check for astra_hooks using current_theme_supports( 'astra_hooks', $hook )
+ * to determine whether a theme declares itself to support this specific hook type.
+ *
+ * Example:
+ * <code>
+ * // Declare support for all hook types
+ * add_theme_support( 'astra_hooks', array( 'all' ) );
+ *
+ * // Declare support for certain hook types only
+ * add_theme_support( 'astra_hooks', array( 'header', 'content', 'footer' ) );
+ * </code>
+ */
+add_theme_support(
+ 'astra_hooks',
+ array(
+
+ /**
+ * As a Theme developer, use the 'all' parameter, to declare support for all
+ * hook types.
+ * Please make sure you then actually reference all the hooks in this file,
+ * Plugin developers depend on it!
+ */
+ 'all',
+
+ /**
+ * Themes can also choose to only support certain hook types.
+ * Please make sure you then actually reference all the hooks in this type
+ * family.
+ *
+ * When the 'all' parameter was set, specific hook types do not need to be
+ * added explicitly.
+ */
+ 'html',
+ 'body',
+ 'head',
+ 'header',
+ 'content',
+ 'entry',
+ 'comments',
+ 'sidebars',
+ 'sidebar',
+ 'footer',
+
+ /**
+ * If/when WordPress Core implements similar methodology, Themes and Plugins
+ * will be able to check whether the version of THA supplied by the theme
+ * supports Core hooks.
+ */
+ )
+);
+
+/**
+ * Determines, whether the specific hook type is actually supported.
+ *
+ * Plugin developers should always check for the support of a <strong>specific</strong>
+ * hook type before hooking a callback function to a hook of this type.
+ *
+ * Example:
+ * <code>
+ * if ( current_theme_supports( 'astra_hooks', 'header' ) )
+ * add_action( 'astra_head_top', 'prefix_header_top' );
+ * </code>
+ *
+ * @param bool $bool true.
+ * @param array $args The hook type being checked.
+ * @param array $registered All registered hook types.
+ *
+ * @return bool
+ */
+function astra_current_theme_supports( $bool, $args, $registered ) {
+ return in_array( $args[0], $registered[0] ) || in_array( 'all', $registered[0] );
+}
+add_filter( 'current_theme_supports-astra_hooks', 'astra_current_theme_supports', 10, 3 );
+
+/**
+ * HTML <html> hook
+ * Special case, useful for <DOCTYPE>, etc.
+ * $astra_supports[] = 'html;
+ */
+function astra_html_before() {
+ do_action( 'astra_html_before' );
+}
+/**
+ * HTML <body> hooks
+ * $astra_supports[] = 'body';
+ */
+function astra_body_top() {
+ do_action( 'astra_body_top' );
+}
+
+/**
+ * Body Bottom
+ */
+function astra_body_bottom() {
+ do_action( 'astra_body_bottom' );
+}
+
+/**
+ * HTML <head> hooks
+ *
+ * $astra_supports[] = 'head';
+ */
+function astra_head_top() {
+ do_action( 'astra_head_top' );
+}
+
+/**
+ * Head Bottom
+ */
+function astra_head_bottom() {
+ do_action( 'astra_head_bottom' );
+}
+
+/**
+ * Semantic <header> hooks
+ *
+ * $astra_supports[] = 'header';
+ */
+function astra_header_before() {
+ do_action( 'astra_header_before' );
+}
+
+/**
+ * Site Header
+ */
+function astra_header() {
+ do_action( 'astra_header' );
+}
+
+/**
+ * Masthead Top
+ */
+function astra_masthead_top() {
+ do_action( 'astra_masthead_top' );
+}
+
+/**
+ * Masthead
+ */
+function astra_masthead() {
+ do_action( 'astra_masthead' );
+}
+
+/**
+ * Masthead Bottom
+ */
+function astra_masthead_bottom() {
+ do_action( 'astra_masthead_bottom' );
+}
+
+/**
+ * Header After
+ */
+function astra_header_after() {
+ do_action( 'astra_header_after' );
+}
+
+/**
+ * Main Header bar top
+ */
+function astra_main_header_bar_top() {
+ do_action( 'astra_main_header_bar_top' );
+}
+
+/**
+ * Main Header bar bottom
+ */
+function astra_main_header_bar_bottom() {
+ do_action( 'astra_main_header_bar_bottom' );
+}
+
+/**
+ * Main Header Content
+ */
+function astra_masthead_content() {
+ do_action( 'astra_masthead_content' );
+}
+/**
+ * Main toggle button before
+ */
+function astra_masthead_toggle_buttons_before() {
+ do_action( 'astra_masthead_toggle_buttons_before' );
+}
+
+/**
+ * Main toggle buttons
+ */
+function astra_masthead_toggle_buttons() {
+ do_action( 'astra_masthead_toggle_buttons' );
+}
+
+/**
+ * Main toggle button after
+ */
+function astra_masthead_toggle_buttons_after() {
+ do_action( 'astra_masthead_toggle_buttons_after' );
+}
+
+/**
+ * Semantic <content> hooks
+ *
+ * $astra_supports[] = 'content';
+ */
+function astra_content_before() {
+ do_action( 'astra_content_before' );
+}
+
+/**
+ * Content after
+ */
+function astra_content_after() {
+ do_action( 'astra_content_after' );
+}
+
+/**
+ * Content top
+ */
+function astra_content_top() {
+ do_action( 'astra_content_top' );
+}
+
+/**
+ * Content bottom
+ */
+function astra_content_bottom() {
+ do_action( 'astra_content_bottom' );
+}
+
+/**
+ * Content while before
+ */
+function astra_content_while_before() {
+ do_action( 'astra_content_while_before' );
+}
+
+/**
+ * Content loop
+ */
+function astra_content_loop() {
+ do_action( 'astra_content_loop' );
+}
+
+/**
+ * Conten Page Loop.
+ *
+ * Called from page.php
+ */
+function astra_content_page_loop() {
+ do_action( 'astra_content_page_loop' );
+}
+
+/**
+ * Content while after
+ */
+function astra_content_while_after() {
+ do_action( 'astra_content_while_after' );
+}
+
+/**
+ * Semantic <entry> hooks
+ *
+ * $astra_supports[] = 'entry';
+ */
+function astra_entry_before() {
+ do_action( 'astra_entry_before' );
+}
+
+/**
+ * Entry after
+ */
+function astra_entry_after() {
+ do_action( 'astra_entry_after' );
+}
+
+/**
+ * Entry content before
+ */
+function astra_entry_content_before() {
+ do_action( 'astra_entry_content_before' );
+}
+
+/**
+ * Entry content after
+ */
+function astra_entry_content_after() {
+ do_action( 'astra_entry_content_after' );
+}
+
+/**
+ * Entry Top
+ */
+function astra_entry_top() {
+ do_action( 'astra_entry_top' );
+}
+
+/**
+ * Entry bottom
+ */
+function astra_entry_bottom() {
+ do_action( 'astra_entry_bottom' );
+}
+
+/**
+ * Single Post Header Before
+ */
+function astra_single_header_before() {
+ do_action( 'astra_single_header_before' );
+}
+
+/**
+ * Single Post Header After
+ */
+function astra_single_header_after() {
+ do_action( 'astra_single_header_after' );
+}
+
+/**
+ * Single Post Header Top
+ */
+function astra_single_header_top() {
+ do_action( 'astra_single_header_top' );
+}
+
+/**
+ * Single Post Header Bottom
+ */
+function astra_single_header_bottom() {
+ do_action( 'astra_single_header_bottom' );
+}
+
+/**
+ * Comments block hooks
+ *
+ * $astra_supports[] = 'comments';
+ */
+function astra_comments_before() {
+ do_action( 'astra_comments_before' );
+}
+
+/**
+ * Comments after.
+ */
+function astra_comments_after() {
+ do_action( 'astra_comments_after' );
+}
+
+/**
+ * Semantic <sidebar> hooks
+ *
+ * $astra_supports[] = 'sidebar';
+ */
+function astra_sidebars_before() {
+ do_action( 'astra_sidebars_before' );
+}
+
+/**
+ * Sidebars after
+ */
+function astra_sidebars_after() {
+ do_action( 'astra_sidebars_after' );
+}
+
+/**
+ * Semantic <footer> hooks
+ *
+ * $astra_supports[] = 'footer';
+ */
+function astra_footer() {
+ do_action( 'astra_footer' );
+}
+
+/**
+ * Footer before
+ */
+function astra_footer_before() {
+ do_action( 'astra_footer_before' );
+}
+
+/**
+ * Footer after
+ */
+function astra_footer_after() {
+ do_action( 'astra_footer_after' );
+}
+
+/**
+ * Footer top
+ */
+function astra_footer_content_top() {
+ do_action( 'astra_footer_content_top' );
+}
+
+/**
+ * Footer
+ */
+function astra_footer_content() {
+ do_action( 'astra_footer_content' );
+}
+
+/**
+ * Footer bottom
+ */
+function astra_footer_content_bottom() {
+ do_action( 'astra_footer_content_bottom' );
+}
+
+/**
+ * Archive header
+ */
+function astra_archive_header() {
+ do_action( 'astra_archive_header' );
+}
+
+/**
+ * Pagination
+ */
+function astra_pagination() {
+ do_action( 'astra_pagination' );
+}
+
+/**
+ * Entry content single
+ */
+function astra_entry_content_single() {
+ do_action( 'astra_entry_content_single' );
+}
+
+/**
+ * 404
+ */
+function astra_entry_content_404_page() {
+ do_action( 'astra_entry_content_404_page' );
+}
+
+/**
+ * Entry content blog
+ */
+function astra_entry_content_blog() {
+ do_action( 'astra_entry_content_blog' );
+}
+
+/**
+ * Blog featured post section
+ */
+function astra_blog_post_featured_format() {
+ do_action( 'astra_blog_post_featured_format' );
+}
+
+/**
+ * Primary Content Top
+ */
+function astra_primary_content_top() {
+ do_action( 'astra_primary_content_top' );
+}
+
+/**
+ * Primary Content Bottom
+ */
+function astra_primary_content_bottom() {
+ do_action( 'astra_primary_content_bottom' );
+}
+
+/**
+ * 404 Page content template action.
+ */
+function astra_404_content_template() {
+ do_action( 'astra_404_content_template' );
+}
+
+if ( ! function_exists( 'wp_body_open' ) ) {
+
+ /**
+ * Fire the wp_body_open action.
+ * Adds backward compatibility for WordPress versions < 5.2
+ *
+ * @since 1.8.7
+ */
+ function wp_body_open() {
+ do_action( 'wp_body_open' );
+ }
+}
diff --git a/inc/core/view-general.php b/inc/core/view-general.php
index 7194851..bec5b92 100644
--- a/inc/core/view-general.php
+++ b/inc/core/view-general.php
@@ -1,45 +1,45 @@
-<?php
-/**
- * View General
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-?>
-
-<div class="ast-container ast-welcome">
- <div id="poststuff">
- <div id="post-body" class="columns-2">
- <div id="post-body-content">
- <!-- All WordPress Notices below header -->
- <h1 class="screen-reader-text"> <?php esc_html_e( 'Astra', 'astra' ); ?> </h1>
- <?php do_action( 'astra_welcome_page_content_before' ); ?>
-
- <?php do_action( 'astra_welcome_page_content' ); ?>
-
- <?php do_action( 'astra_welcome_page_content_after' ); ?>
- </div>
- <div class="postbox-container ast-sidebar" id="postbox-container-1">
- <div id="side-sortables">
- <?php do_action( 'astra_welcome_page_right_sidebar_before' ); ?>
-
- <?php do_action( 'astra_welcome_page_right_sidebar_content' ); ?>
-
- <?php do_action( 'astra_welcome_page_right_sidebar_after' ); ?>
- </div>
- </div>
- </div>
- <!-- /post-body -->
- <br class="clear">
- </div>
-
-
-</div>
+<?php
+/**
+ * View General
+ *
+ * @package Astra
+ * @author Astra
+ * @copyright Copyright (c) 2020, Astra
+ * @link https://wpastra.com/
+ * @since Astra 1.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+?>
+
+<div class="ast-container ast-welcome">
+ <div id="poststuff">
+ <div id="post-body" class="columns-2">
+ <div id="post-body-content">
+ <!-- All WordPress Notices below header -->
+ <h1 class="screen-reader-text"> <?php esc_html_e( 'Astra', 'astra' ); ?> </h1>
+ <?php do_action( 'astra_welcome_page_content_before' ); ?>
+
+ <?php do_action( 'astra_welcome_page_content' ); ?>
+
+ <?php do_action( 'astra_welcome_page_content_after' ); ?>
+ </div>
+ <div class="postbox-container ast-sidebar" id="postbox-container-1">
+ <div id="side-sortables">
+ <?php do_action( 'astra_welcome_page_right_sidebar_before' ); ?>
+
+ <?php do_action( 'astra_welcome_page_right_sidebar_content' ); ?>
+
+ <?php do_action( 'astra_welcome_page_right_sidebar_after' ); ?>
+ </div>
+ </div>
+ </div>
+ <!-- /post-body -->
+ <br class="clear">
+ </div>
+
+
+</div>