diff options
Diffstat (limited to 'inc/addons')
23 files changed, 7241 insertions, 7241 deletions
diff --git a/inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php b/inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php index 38bab04..4e3ef15 100644 --- a/inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php +++ b/inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php @@ -1,1402 +1,1402 @@ -<?php
-/**
- * Breadcrumb Trail - A breadcrumb menu script for WordPress.
- *
- * Breadcrumb Trail is a script for showing a breadcrumb trail for any type of page. It tries to
- * anticipate any type of structure and display the best possible trail that matches your site's
- * permalink structure. While not perfect, it attempts to fill in the gaps left by many other
- * breadcrumb scripts.
- *
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
- * General Public License as published by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
- * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * @package BreadcrumbTrail
- * @version 1.1.0
- * @author Justin Tadlock <justin@justintadlock.com>
- * @copyright Copyright (c) 2008 - 2017, Justin Tadlock
- * @link https://themehybrid.com/plugins/breadcrumb-trail
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-/**
- * Astra Get Breadcrumb
- *
- * Gets the basic Breadcrumb wrapper div & content
- *
- * @since 1.8.1
- * @param boolean $echo Whether to echo or not.
- * @return string
- */
-function astra_get_breadcrumb( $echo = true ) {
-
- if ( ! $echo ) {
- return '<div class="ast-breadcrumbs-wrapper">
- <div class="ast-breadcrumbs-inner">' .
- astra_get_selected_breadcrumb( $echo ) .
- '</div>
- </div>';
- }
-
- ?>
- <div class="ast-breadcrumbs-wrapper">
- <div class="ast-breadcrumbs-inner">
- <?php astra_get_selected_breadcrumb( $echo ); ?>
- </div>
- </div>
- <?php
-
-}
-
-/**
- * Get selected breadcrumb.
- * Returns or echo the breadcrumb depending upon the argument.
- *
- * @since 1.8.1
- * @access public
- * @param boolean $echo Whether to echo or not.
- * @return string Selected Breadcrumb.
- */
-function astra_get_selected_breadcrumb( $echo = true ) {
-
- $breadcrumb_source = astra_get_option( 'select-breadcrumb-source' );
-
- $breadcrumb_enable = is_callable( 'WPSEO_Options::get' ) ? WPSEO_Options::get( 'breadcrumbs-enable' ) : false;
- $wpseo_option = get_option( 'wpseo_internallinks' ) ? get_option( 'wpseo_internallinks' ) : $breadcrumb_enable;
- if ( ! is_array( $wpseo_option ) ) {
- unset( $wpseo_option );
- $wpseo_option = array(
- 'breadcrumbs-enable' => $breadcrumb_enable
- );
- }
-
- if ( function_exists( 'yoast_breadcrumb' ) && true === $wpseo_option['breadcrumbs-enable'] && $breadcrumb_source && 'yoast-seo-breadcrumbs' == $breadcrumb_source ) {
- // Check if breadcrumb is turned on from WPSEO option.
- return yoast_breadcrumb( '<div id="ast-breadcrumbs-yoast" >', '</div>', $echo );
- } elseif ( function_exists( 'bcn_display' ) && $breadcrumb_source && 'breadcrumb-navxt' == $breadcrumb_source ) {
-
- if( true === $echo ) {
- ?>
- <div class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">
- <?php bcn_display() ?>
- </div>
- <?php
- return;
- }
- // Check if breadcrumb is turned on from Breadcrumb NavXT plugin.
- return '<div class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">' . bcn_display( ! $echo ) . '</div>';
- } elseif ( function_exists( 'rank_math_the_breadcrumbs' ) && $breadcrumb_source && 'rank-math' == $breadcrumb_source ) {
- // Check if breadcrumb is turned on from Rank Math plugin.
- if ( ! $echo ) {
- ob_start();
- rank_math_the_breadcrumbs();
- return ob_get_clean();
- }
- rank_math_the_breadcrumbs();
- } else {
- // Load default Astra breadcrumb if none selected.
- return astra_get_breadcrumb_trail( $echo );
- }
-}
-
-
-/**
- * Deprecating astra_breadcrumb_trail function.
- *
- * @since 1.8.1
- * @deprecated 1.8.1 Use astra_get_breadcrumb()
- * @param array $args List of args.
- * @see astra_breadcrumb_trail()
- *
- * @return string new breadcrumb function.
- */
-function astra_breadcrumb_trail( $args = array() ) {
- _deprecated_function( __FUNCTION__, '1.8.1', 'astra_get_breadcrumb()' );
- astra_get_breadcrumb();
-}
-
-/**
- * Shows a breadcrumb for all types of pages. This is a wrapper function for the Breadcrumb_Trail class,
- * which should be used in theme templates.
- *
- * @since 1.8.1
- * @access public
- * @param boolean $echo Whether to echo or not.
- * @return string Selected Breadcrumb.
- */
-function astra_get_breadcrumb_trail( $echo = true ) {
-
- $defaults = array(
- 'before' => '<div class="ast-breadcrumbs">',
- 'after' => '</div>',
- 'show_browse' => false,
- 'echo' => $echo,
- );
-
- $args = apply_filters( 'astra_breadcrumb_trail_args', $defaults );
-
- $breadcrumb = apply_filters( 'astra_breadcrumb_trail_object', null, $args );
-
- if ( ! is_object( $breadcrumb ) ) {
- $breadcrumb = new Astra_Breadcrumb_Trail( $args );
- }
-
- return $breadcrumb->trail();
-}
-
-/**
- * Creates a breadcrumbs menu for the site based on the current page that's being viewed by the user.
- *
- * @since 0.6.0
- * @access public
- */
-class Astra_Breadcrumb_Trail {
-
- /**
- * Array of items belonging to the current breadcrumb trail.
- *
- * @since 0.1.0
- * @access public
- * @var array
- */
- public $items = array();
-
- /**
- * Arguments used to build the breadcrumb trail.
- *
- * @since 0.1.0
- * @access public
- * @var array
- */
- public $args = array();
-
- /**
- * Array of text labels.
- *
- * @since 1.0.0
- * @access public
- * @var array
- */
- public $labels = array();
-
- /**
- * Array of post types (key) and taxonomies (value) to use for single post views.
- *
- * @since 1.0.0
- * @access public
- * @var array
- */
- public $post_taxonomy = array();
-
- /* ====== Magic Methods ====== */
-
- /**
- * Magic method to use in case someone tries to output the layout object as a string.
- * We'll just return the trail HTML.
- *
- * @since 1.0.0
- * @access public
- * @return string
- */
- public function __toString() {
- return $this->trail();
- }
-
- /**
- * Sets up the breadcrumb trail properties. Calls the `Breadcrumb_Trail::add_items()` method
- * to create the array of breadcrumb items.
- *
- * @since 0.6.0
- * @access public
- * @param array $args {
- * @type string $container Container HTML element. nav|div
- * @type string $before String to output before breadcrumb menu.
- * @type string $after String to output after breadcrumb menu.
- * @type string $browse_tag The HTML tag to use to wrap the "Browse" header text.
- * @type string $list_tag The HTML tag to use for the list wrapper.
- * @type string $item_tag The HTML tag to use for the item wrapper.
- * @type bool $show_on_front Whether to show when `is_front_page()`.
- * @type bool $network Whether to link to the network main site (multisite only).
- * @type bool $show_title Whether to show the title (last item) in the trail.
- * @type bool $show_browse Whether to show the breadcrumb menu header.
- * @type array $labels Text labels. @see Breadcrumb_Trail::set_labels()
- * @type array $post_taxonomy Taxonomies to use for post types. @see Breadcrumb_Trail::set_post_taxonomy()
- * @type bool $echo Whether to print or return the breadcrumbs.
- * }
- * @return void
- */
- public function __construct( $args = array() ) {
-
- $defaults = array(
- 'container' => 'nav',
- 'before' => '',
- 'after' => '',
- 'browse_tag' => 'h2',
- 'list_tag' => 'ul',
- 'item_tag' => 'li',
- 'show_on_front' => true,
- 'network' => false,
- 'show_title' => true,
- 'show_browse' => true,
- 'labels' => array(),
- 'post_taxonomy' => array(),
- 'echo' => true,
- 'schema' => true,
- );
-
- // Parse the arguments with the deaults.
- $this->args = apply_filters( 'astra_breadcrumb_trail_args', wp_parse_args( $args, $defaults ) );
-
- // Set the labels and post taxonomy properties.
- $this->set_labels();
- $this->set_post_taxonomy();
-
- // Let's find some items to add to the trail!
- $this->add_items();
- }
-
- /* ====== Public Methods ====== */
-
- /**
- * Formats the HTML output for the breadcrumb trail.
- *
- * @since 0.6.0
- * @access public
- * @return string
- */
- public function trail() {
-
- // Set up variables that we'll need.
- $breadcrumb = '';
- $item_count = count( $this->items );
- $item_position = 0;
- $meta = '';
-
- if ( 2 > $item_count ) {
- $this->args['schema'] = false;
- }
-
- // Connect the breadcrumb trail if there are items in the trail.
- if ( 0 < $item_count ) {
-
- // Add 'browse' label if it should be shown.
- if ( true === $this->args['show_browse'] ) {
-
- $breadcrumb .= sprintf(
- '<%1$s class="trail-browse">%2$s</%1$s>',
- tag_escape( $this->args['browse_tag'] ),
- $this->labels['browse']
- );
- }
-
- // Open the unordered list.
- $breadcrumb .= sprintf(
- '<%1$s class="trail-items" %2$s>',
- tag_escape( $this->args['list_tag'] ),
- ( $this->args['schema'] ? 'itemscope itemtype="http://schema.org/BreadcrumbList"' : '' )
- );
-
- if ( $this->args['schema'] ) {
- // Add the number of items and item list order schema.
- $breadcrumb .= sprintf( '<meta content="%1$d" %2$s />', absint( $item_count ), astra_attr(
- 'breadcrumb-trail-items-num-meta',
- array(
- 'name' => 'numberOfItems',
- 'class' => '',
- )
- ) );
- $breadcrumb .= '<meta ' . astra_attr(
- 'breadcrumb-trail-items-list-meta',
- array(
- 'class' => '',
- 'name' => 'itemListOrder',
- 'content' => 'Ascending',
- )
- ) . '/>';
- }
-
- // Loop through the items and add them to the list.
- foreach ( $this->items as $item ) {
-
- // Iterate the item position.
- ++$item_position;
-
- // Check if the item is linked.
- preg_match( '/(<a.*?>)(.*?)(<\/a>)/i', $item, $matches );
-
- // Wrap the item text with appropriate itemprop.
- $item = ! empty( $matches ) ? sprintf( '%s<span %s>%s</span>%s', $matches[1], $this->args['schema'] ? 'itemprop="name"' : '', $matches[2], $matches[3] ) : sprintf( '<span>%s</span>', $item );
-
- // Wrap the item with its itemprop.
- $item = ( ! empty( $matches ) && $this->args['schema'] )
- ? preg_replace( '/(<a.*?)([\'"])>/i', '$1$2 itemprop=$2item$2>', $item )
- : sprintf( '<span>%s</span>', $item );
-
- // Add list item classes.
- $item_class = 'trail-item';
- $item_schema_attr = 'itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"';
-
- if ( 1 === $item_position && 1 < $item_count ) {
- $item_class .= ' trail-begin';
- } elseif ( $item_count === $item_position ) {
- $item_class .= ' trail-end';
- $item_schema_attr = '';
- }
-
- // Create list item attributes.
- $attributes = $this->args['schema'] ? $item_schema_attr : '';
-
- $attributes .= ' class="' . $item_class . '"';
-
- if ( $this->args['schema'] ) {
- // Build the meta position HTML.
- $meta = sprintf( '<meta itemprop="position" content="%s" />', absint( $item_position ) );
- }
-
- if ( $item_count === $item_position ) {
- $meta = '';
- }
-
- // Build the list item.
- $breadcrumb .= sprintf( '<%1$s %2$s>%3$s%4$s</%1$s>', tag_escape( $this->args['item_tag'] ),$attributes, $item, $meta );
- }
-
- // Close the unordered list.
- $breadcrumb .= sprintf( '</%s>', tag_escape( $this->args['list_tag'] ) );
-
- // Wrap the breadcrumb trail.
- $breadcrumb = sprintf(
- '<%1$s role="navigation" aria-label="%2$s" class="breadcrumb-trail breadcrumbs" >%3$s%4$s%5$s</%1$s>',
- tag_escape( $this->args['container'] ),
- esc_attr( $this->labels['aria_label'] ),
- $this->args['before'],
- $breadcrumb,
- $this->args['after']
- );
- }
-
- // Allow developers to filter the breadcrumb trail HTML.
- $breadcrumb = apply_filters( 'astra_breadcrumb_trail', $breadcrumb, $this->args );
-
- if ( false === $this->args['echo'] ) {
- return $breadcrumb;
- }
-
- echo $breadcrumb;
- }
-
- /* ====== Protected Methods ====== */
-
- /**
- * Sets the labels property. Parses the inputted labels array with the defaults.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function set_labels() {
-
- $defaults = array(
- 'browse' => esc_html__( 'Browse:', 'astra' ),
- 'aria_label' => esc_attr_x( 'Breadcrumbs', 'breadcrumbs aria label', 'astra' ),
- 'home' => esc_html__( 'Home', 'astra' ),
- 'error_404' => esc_html__( '404 Not Found', 'astra' ),
- 'archives' => esc_html__( 'Archives', 'astra' ),
- // Translators: %s is the search query.
- 'search' => esc_html__( 'Search results for: %s', 'astra' ),
- // Translators: %s is the page number.
- 'paged' => esc_html__( 'Page %s', 'astra' ),
- // Translators: %s is the page number.
- 'paged_comments' => esc_html__( 'Comment Page %s', 'astra' ),
- // Translators: Minute archive title. %s is the minute time format.
- 'archive_minute' => esc_html__( 'Minute %s', 'astra' ),
- // Translators: Weekly archive title. %s is the week date format.
- 'archive_week' => esc_html__( 'Week %s', 'astra' ),
-
- // "%s" is replaced with the translated date/time format.
- 'archive_minute_hour' => '%s',
- 'archive_hour' => '%s',
- 'archive_day' => '%s',
- 'archive_month' => '%s',
- 'archive_year' => '%s',
- );
-
- $this->labels = apply_filters( 'astra_breadcrumb_trail_labels', wp_parse_args( $this->args['labels'], $defaults ) );
- }
-
- /**
- * Sets the `$post_taxonomy` property. This is an array of post types (key) and taxonomies (value).
- * The taxonomy's terms are shown on the singular post view if set.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function set_post_taxonomy() {
-
- $defaults = array();
-
- // If post permalink is set to `%postname%`, use the `category` taxonomy.
- if ( '%postname%' === trim( get_option( 'permalink_structure' ), '/' ) ) {
- $defaults['post'] = 'category';
- }
-
- $this->post_taxonomy = apply_filters( 'astra_breadcrumb_trail_post_taxonomy', wp_parse_args( $this->args['post_taxonomy'], $defaults ) );
- }
-
- /**
- * Runs through the various WordPress conditional tags to check the current page being viewed. Once
- * a condition is met, a specific method is launched to add items to the `$items` array.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_items() {
-
- // If viewing the front page.
- if ( is_front_page() ) {
- $this->add_front_page_items();
- }
-
- // If not viewing the front page.
- else {
-
- // Add the network and site home links.
- $this->add_network_home_link();
- $this->add_site_home_link();
-
- // If viewing the home/blog page.
- if ( is_home() ) {
- $this->add_blog_items();
- }
-
- // If viewing a single post.
- elseif ( is_singular() ) {
- $this->add_singular_items();
- }
-
- // If viewing an archive page.
- elseif ( is_archive() ) {
-
- if ( is_post_type_archive() ) {
- $this->add_post_type_archive_items();
- }
- elseif ( is_category() || is_tag() || is_tax() ) {
- $this->add_term_archive_items();
- }
- elseif ( is_author() ) {
- $this->add_user_archive_items();
- }
- elseif ( get_query_var( 'minute' ) && get_query_var( 'hour' ) ) {
- $this->add_minute_hour_archive_items();
- }
- elseif ( get_query_var( 'minute' ) ) {
- $this->add_minute_archive_items();
- }
- elseif ( get_query_var( 'hour' ) ) {
- $this->add_hour_archive_items();
- }
- elseif ( is_day() ) {
- $this->add_day_archive_items();
- }
- elseif ( get_query_var( 'w' ) ) {
- $this->add_week_archive_items();
- }
- elseif ( is_month() ) {
- $this->add_month_archive_items();
- }
- elseif ( is_year() ) {
- $this->add_year_archive_items();
- }
- else {
- $this->add_default_archive_items();
- }
- }
-
- // If viewing a search results page.
- elseif ( is_search() ) {
- $this->add_search_items();
- }
-
- // If viewing the 404 page.
- elseif ( is_404() ) {
- $this->add_404_items();
- }
- }
-
- // Add paged items if they exist.
- $this->add_paged_items();
-
- // Allow developers to overwrite the items for the breadcrumb trail.
- $this->items = array_unique( apply_filters( 'astra_breadcrumb_trail_items', $this->items, $this->args ) );
- }
-
- /**
- * Gets front items based on $wp_rewrite->front.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_rewrite_front_items() {
- global $wp_rewrite;
-
- if ( $wp_rewrite->front ) {
- $this->add_path_parents( $wp_rewrite->front );
- }
- }
-
- /**
- * Adds the page/paged number to the items array.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_paged_items() {
-
- // If viewing a paged singular post.
- if ( is_singular() && 1 < get_query_var( 'page' ) && true === $this->args['show_title'] ) {
- $this->items[] = sprintf( $this->labels['paged'], number_format_i18n( absint( get_query_var( 'page' ) ) ) );
- }
- // If viewing a singular post with paged comments.
- elseif ( is_singular() && get_option( 'page_comments' ) && 1 < get_query_var( 'cpage' ) ) {
- $this->items[] = sprintf( $this->labels['paged_comments'], number_format_i18n( absint( get_query_var( 'cpage' ) ) ) );
- }
- // If viewing a paged archive-type page.
- elseif ( is_paged() && true === $this->args['show_title'] ) {
- $this->items[] = sprintf( $this->labels['paged'], number_format_i18n( absint( get_query_var( 'paged' ) ) ) );
- }
- }
-
- /**
- * Adds the network (all sites) home page link to the items array.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_network_home_link() {
-
- if ( is_multisite() && ! is_main_site() && true === $this->args['network'] ) {
- $this->items[] = sprintf( '<a href="%s" rel="home">%s</a>', esc_url( network_home_url() ), $this->labels['home'] );
- }
- }
-
- /**
- * Adds the current site's home page link to the items array.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_site_home_link() {
-
- $network = is_multisite() && ! is_main_site() && true === $this->args['network'];
- $label = $network ? get_bloginfo( 'name' ) : $this->labels['home'];
- $rel = $network ? '' : ' rel="home"';
-
- $this->items[] = sprintf( '<a href="%s"%s>%s</a>', esc_url( user_trailingslashit( home_url() ) ), $rel, $label );
- }
-
- /**
- * Adds items for the front page to the items array.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_front_page_items() {
-
- // Only show front items if the 'show_on_front' argument is set to 'true'.
- if ( true === $this->args['show_on_front'] || is_paged() || ( is_singular() && 1 < get_query_var( 'page' ) ) ) {
-
- // Add network home link.
- $this->add_network_home_link();
-
- // If on a paged view, add the site home link.
- if ( is_paged() ) {
- $this->add_site_home_link();
- }
- // If on the main front page, add the network home title.
- elseif ( true === $this->args['show_title'] ) {
- $this->items[] = is_multisite() && true === $this->args['network'] ? get_bloginfo( 'name' ) : $this->labels['home'];
- }
- }
- }
-
- /**
- * Adds items for the posts page (i.e., is_home()) to the items array.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_blog_items() {
-
- // Get the post ID and post.
- $post_id = get_queried_object_id();
- $post = get_post( $post_id );
-
- // If the post has parents, add them to the trail.
- if ( 0 < $post->post_parent ) {
- $this->add_post_parents( $post->post_parent );
- }
- // Get the page title.
- $title = get_the_title( $post_id );
-
- // Add the posts page item.
- if ( is_paged() ) {
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_permalink( $post_id ) ), $title );
- }
- elseif ( $title && true === $this->args['show_title'] ) {
- $this->items[] = $title;
- }
- }
-
- /**
- * Adds singular post items to the items array.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_singular_items() {
-
- // Get the queried post.
- $post = get_queried_object();
- $post_id = get_queried_object_id();
-
- // If the post has a parent, follow the parent trail.
- if ( 0 < $post->post_parent ) {
- $this->add_post_parents( $post->post_parent );
- }
- // If the post doesn't have a parent, get its hierarchy based off the post type.
- else {
- $this->add_post_hierarchy( $post_id );
- }
- // Display terms for specific post type taxonomy if requested.
- if ( ! empty( $this->post_taxonomy[ $post->post_type ] ) ) {
- $this->add_post_terms( $post_id, $this->post_taxonomy[ $post->post_type ] );
- }
- // End with the post title.
- if ( $post_title = single_post_title( '', false ) ) {
-
- if ( ( 1 < get_query_var( 'page' ) || is_paged() ) || ( get_option( 'page_comments' ) && 1 < absint( get_query_var( 'cpage' ) ) ) ) {
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_permalink( $post_id ) ), $post_title );
- }
- elseif ( true === $this->args['show_title'] ) {
- $this->items[] = $post_title;
- }
- }
- }
-
- /**
- * Adds the items to the trail items array for taxonomy term archives.
- *
- * @since 1.0.0
- * @access protected
- * @global object $wp_rewrite
- * @return void
- */
- protected function add_term_archive_items() {
- global $wp_rewrite;
-
- // Get some taxonomy and term variables.
- $term = get_queried_object();
- $taxonomy = get_taxonomy( $term->taxonomy );
- $done_post_type = false;
-
- // If there are rewrite rules for the taxonomy.
- if ( false !== $taxonomy->rewrite ) {
-
- // If 'with_front' is true, dd $wp_rewrite->front to the trail.
- if ( $taxonomy->rewrite['with_front'] && $wp_rewrite->front ) {
- $this->add_rewrite_front_items();
- }
- // Get parent pages by path if they exist.
- $this->add_path_parents( $taxonomy->rewrite['slug'] );
-
- // Add post type archive if its 'has_archive' matches the taxonomy rewrite 'slug'.
- if ( $taxonomy->rewrite['slug'] ) {
-
- $slug = trim( $taxonomy->rewrite['slug'], '/' );
-
- // Deals with the situation if the slug has a '/' between multiple
- // strings. For example, "movies/genres" where "movies" is the post
- // type archive.
- $matches = explode( '/', $slug );
-
- // If matches are found for the path.
- if ( isset( $matches ) ) {
-
- // Reverse the array of matches to search for posts in the proper order.
- $matches = array_reverse( $matches );
-
- // Loop through each of the path matches.
- foreach ( $matches as $match ) {
-
-
- // Get public post types that match the rewrite slug.
- $post_types = $this->get_post_types_by_slug( $match );
-
- if ( ! empty( $post_types ) ) {
-
- $post_type_object = $post_types[0];
-
- // Add support for a non-standard label of 'archive_title' (special use case).
- $label = ! empty( $post_type_object->labels->archive_title ) ? $post_type_object->labels->archive_title : $post_type_object->labels->name;
-
- // Core filter hook.
- $label = apply_filters( 'post_type_archive_title', $label, $post_type_object->name );
-
- // Add the post type archive link to the trail.
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_post_type_archive_link( $post_type_object->name ) ), $label );
-
- $done_post_type = true;
-
- // Break out of the loop.
- break;
- }
- }
- }
- }
- }
-
- // If there's a single post type for the taxonomy, use it.
- if ( false === $done_post_type && 1 === count( $taxonomy->object_type ) && post_type_exists( $taxonomy->object_type[0] ) ) {
-
- // If the post type is 'post'.
- if ( 'post' === $taxonomy->object_type[0] ) {
- $post_id = get_option( 'page_for_posts' );
-
- if ( 'posts' !== get_option( 'show_on_front' ) && 0 < $post_id ) {
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_permalink( $post_id ) ), get_the_title( $post_id ) );
- }
- // If the post type is not 'post'.
- } else {
- $post_type_object = get_post_type_object( $taxonomy->object_type[0] );
-
- $label = ! empty( $post_type_object->labels->archive_title ) ? $post_type_object->labels->archive_title : $post_type_object->labels->name;
-
- // Core filter hook.
- $label = apply_filters( 'post_type_archive_title', $label, $post_type_object->name );
-
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_post_type_archive_link( $post_type_object->name ) ), $label );
- }
- }
-
- // If the taxonomy is hierarchical, list its parent terms.
- if ( is_taxonomy_hierarchical( $term->taxonomy ) && $term->parent ) {
- $this->add_term_parents( $term->parent, $term->taxonomy );
- }
- // Add the term name to the trail end.
- if ( is_paged() ){
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_term_link( $term, $term->taxonomy ) ), single_term_title( '', false ) );
- }
- elseif ( true === $this->args['show_title'] ) {
- $this->items[] = single_term_title( '', false );
- }
- }
-
- /**
- * Adds the items to the trail items array for post type archives.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_post_type_archive_items() {
-
- // Get the post type object.
- $post_type_object = get_post_type_object( get_query_var( 'post_type' ) );
-
- if ( false !== $post_type_object->rewrite ) {
-
- // If 'with_front' is true, add $wp_rewrite->front to the trail.
- if ( $post_type_object->rewrite['with_front'] ) {
- $this->add_rewrite_front_items();
- }
- // If there's a rewrite slug, check for parents.
- if ( ! empty( $post_type_object->rewrite['slug'] ) ) {
- $this->add_path_parents( $post_type_object->rewrite['slug'] );
- }
- }
-
- // Add the post type [plural] name to the trail end.
- if ( is_paged() || is_author() ) {
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_post_type_archive_link( $post_type_object->name ) ), post_type_archive_title( '', false ) );
- }
- elseif ( true === $this->args['show_title'] ) {
- $this->items[] = post_type_archive_title( '', false );
- }
- // If viewing a post type archive by author.
- if ( is_author() ) {
- $this->add_user_archive_items();
- }
- }
-
- /**
- * Adds the items to the trail items array for user (author) archives.
- *
- * @since 1.0.0
- * @access protected
- * @global object $wp_rewrite
- * @return void
- */
- protected function add_user_archive_items() {
- global $wp_rewrite;
-
- // Add $wp_rewrite->front to the trail.
- $this->add_rewrite_front_items();
-
- // Get the user ID.
- $user_id = get_query_var( 'author' );
-
- // If $author_base exists, check for parent pages.
- if ( ! empty( $wp_rewrite->author_base ) && ! is_post_type_archive() ) {
- $this->add_path_parents( $wp_rewrite->author_base );
- }
- // Add the author's display name to the trail end.
- if ( is_paged() ) {
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_author_posts_url( $user_id ) ), get_the_author_meta( 'display_name', $user_id ) );
- }
- elseif ( true === $this->args['show_title'] ) {
- $this->items[] = get_the_author_meta( 'display_name', $user_id );
- }
- }
-
- /**
- * Adds the items to the trail items array for minute + hour archives.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_minute_hour_archive_items() {
-
- // Add $wp_rewrite->front to the trail.
- $this->add_rewrite_front_items();
-
- // Add the minute + hour item.
- if ( true === $this->args['show_title'] ) {
- $this->items[] = sprintf( $this->labels['archive_minute_hour'], get_the_time( esc_html_x( 'g:i a', 'minute and hour archives time format', 'astra' ) ) );
- }
- }
-
- /**
- * Adds the items to the trail items array for minute archives.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_minute_archive_items() {
-
- // Add $wp_rewrite->front to the trail.
- $this->add_rewrite_front_items();
-
- // Add the minute item.
- if ( true === $this->args['show_title'] ) {
- $this->items[] = sprintf( $this->labels['archive_minute'], get_the_time( esc_html_x( 'i', 'minute archives time format', 'astra' ) ) );
- }
- }
-
- /**
- * Adds the items to the trail items array for hour archives.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_hour_archive_items() {
-
- // Add $wp_rewrite->front to the trail.
- $this->add_rewrite_front_items();
-
- // Add the hour item.
- if ( true === $this->args['show_title'] ) {
- $this->items[] = sprintf( $this->labels['archive_hour'], get_the_time( esc_html_x( 'g a', 'hour archives time format', 'astra' ) ) );
- }
- }
-
- /**
- * Adds the items to the trail items array for day archives.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_day_archive_items() {
-
- // Add $wp_rewrite->front to the trail.
- $this->add_rewrite_front_items();
-
- // Get year, month, and day.
- $year = sprintf( $this->labels['archive_year'], get_the_time( esc_html_x( 'Y', 'yearly archives date format', 'astra' ) ) );
- $month = sprintf( $this->labels['archive_month'], get_the_time( esc_html_x( 'F', 'monthly archives date format', 'astra' ) ) );
- $day = sprintf( $this->labels['archive_day'], get_the_time( esc_html_x( 'j', 'daily archives date format', 'astra' ) ) );
-
- // Add the year and month items.
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_year_link( get_the_time( 'Y' ) ) ), $year );
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_month_link( get_the_time( 'Y' ), get_the_time( 'm' ) ) ), $month );
-
- // Add the day item.
- if ( is_paged() ) {
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_day_link( get_the_time( 'Y' ) ), get_the_time( 'm' ), get_the_time( 'd' ) ), $day );
- }
- elseif ( true === $this->args['show_title'] ) {
- $this->items[] = $day;
- }
- }
-
- /**
- * Adds the items to the trail items array for week archives.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_week_archive_items() {
-
- // Add $wp_rewrite->front to the trail.
- $this->add_rewrite_front_items();
-
- // Get the year and week.
- $year = sprintf( $this->labels['archive_year'], get_the_time( esc_html_x( 'Y', 'yearly archives date format', 'astra' ) ) );
- $week = sprintf( $this->labels['archive_week'], get_the_time( esc_html_x( 'W', 'weekly archives date format', 'astra' ) ) );
-
- // Add the year item.
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_year_link( get_the_time( 'Y' ) ) ), $year );
-
- // Add the week item.
- if ( is_paged() ) {
- $this->items[] = esc_url( get_archives_link( add_query_arg( array( 'm' => get_the_time( 'Y' ), 'w' => get_the_time( 'W' ) ), home_url() ), $week, false ) );
- }
- elseif ( true === $this->args['show_title'] ) {
- $this->items[] = $week;
- }
- }
-
- /**
- * Adds the items to the trail items array for month archives.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_month_archive_items() {
-
- // Add $wp_rewrite->front to the trail.
- $this->add_rewrite_front_items();
-
- // Get the year and month.
- $year = sprintf( $this->labels['archive_year'], get_the_time( esc_html_x( 'Y', 'yearly archives date format', 'astra' ) ) );
- $month = sprintf( $this->labels['archive_month'], get_the_time( esc_html_x( 'F', 'monthly archives date format', 'astra' ) ) );
-
- // Add the year item.
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_year_link( get_the_time( 'Y' ) ) ), $year );
-
- // Add the month item.
- if ( is_paged() ) {
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_month_link( get_the_time( 'Y' ), get_the_time( 'm' ) ) ), $month );
- }
- elseif ( true === $this->args['show_title'] ) {
- $this->items[] = $month;
- }
- }
-
- /**
- * Adds the items to the trail items array for year archives.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_year_archive_items() {
-
- // Add $wp_rewrite->front to the trail.
- $this->add_rewrite_front_items();
-
- // Get the year.
- $year = sprintf( $this->labels['archive_year'], get_the_time( esc_html_x( 'Y', 'yearly archives date format', 'astra' ) ) );
-
- // Add the year item.
- if ( is_paged() ) {
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_year_link( get_the_time( 'Y' ) ) ), $year );
- }
- elseif ( true === $this->args['show_title'] ) {
- $this->items[] = $year;
- }
- }
-
- /**
- * Adds the items to the trail items array for archives that don't have a more specific method
- * defined in this class.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_default_archive_items() {
-
- // If this is a date-/time-based archive, add $wp_rewrite->front to the trail.
- if ( is_date() || is_time() ) {
- $this->add_rewrite_front_items();
- }
- if ( true === $this->args['show_title'] ) {
- $this->items[] = $this->labels['archives'];
- }
- }
-
- /**
- * Adds the items to the trail items array for search results.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_search_items() {
-
- if ( is_paged() ) {
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_search_link() ), sprintf( $this->labels['search'], get_search_query() ) );
- }
- elseif ( true === $this->args['show_title'] ) {
- $this->items[] = sprintf( $this->labels['search'], get_search_query() );
- }
- }
-
- /**
- * Adds the items to the trail items array for 404 pages.
- *
- * @since 1.0.0
- * @access protected
- * @return void
- */
- protected function add_404_items() {
-
- if ( true === $this->args['show_title'] ) {
- $this->items[] = $this->labels['error_404'];
- }
- }
-
- /**
- * Adds a specific post's parents to the items array.
- *
- * @since 1.0.0
- * @access protected
- * @param int $post_id
- * @return void
- */
- protected function add_post_parents( $post_id ) {
- $parents = array();
-
- while ( $post_id ) {
-
- // Get the post by ID.
- $post = get_post( $post_id );
-
- // If we hit a page that's set as the front page, bail.
- if ( 'page' == $post->post_type && 'page' == get_option( 'show_on_front' ) && $post_id == get_option( 'page_on_front' ) ) {
- break;
- }
- // Add the formatted post link to the array of parents.
- $parents[] = sprintf( '<a href="%s">%s</a>', esc_url( get_permalink( $post_id ) ), get_the_title( $post_id ) );
-
- // If there's no longer a post parent, break out of the loop.
- if ( 0 >= $post->post_parent ) {
- break;
- }
- // Change the post ID to the parent post to continue looping.
- $post_id = $post->post_parent;
- }
-
- // Get the post hierarchy based off the final parent post.
- $this->add_post_hierarchy( $post_id );
-
- // Display terms for specific post type taxonomy if requested.
- if ( ! empty( $this->post_taxonomy[ $post->post_type ] ) ) {
- $this->add_post_terms( $post_id, $this->post_taxonomy[ $post->post_type ] );
- }
- // Merge the parent items into the items array.
- $this->items = array_merge( $this->items, array_reverse( $parents ) );
- }
-
- /**
- * Adds a specific post's hierarchy to the items array. The hierarchy is determined by post type's
- * rewrite arguments and whether it has an archive page.
- *
- * @since 1.0.0
- * @access protected
- * @param int $post_id
- * @return void
- */
- protected function add_post_hierarchy( $post_id ) {
-
- // Get the post type.
- $post_type = get_post_type( $post_id );
- $post_type_object = get_post_type_object( $post_type );
-
- // If this is the 'post' post type, get the rewrite front items and map the rewrite tags.
- if ( 'post' === $post_type ) {
-
- // Add $wp_rewrite->front to the trail.
- $this->add_rewrite_front_items();
-
- // Map the rewrite tags.
- $this->map_rewrite_tags( $post_id, get_option( 'permalink_structure' ) );
- }
-
- // If the post type has rewrite rules.
- elseif ( false !== $post_type_object->rewrite ) {
-
- // If 'with_front' is true, add $wp_rewrite->front to the trail.
- if ( $post_type_object->rewrite['with_front'] ) {
- $this->add_rewrite_front_items();
- }
- // If there's a path, check for parents.
- if ( ! empty( $post_type_object->rewrite['slug'] ) ) {
- $this->add_path_parents( $post_type_object->rewrite['slug'] );
- }
- }
-
- // If there's an archive page, add it to the trail.
- if ( $post_type_object->has_archive ) {
-
- // Add support for a non-standard label of 'archive_title' (special use case).
- $label = ! empty( $post_type_object->labels->archive_title ) ? $post_type_object->labels->archive_title : $post_type_object->labels->name;
-
- // Core filter hook.
- $label = apply_filters( 'post_type_archive_title', $label, $post_type_object->name );
-
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_post_type_archive_link( $post_type ) ), $label );
- }
-
- // Map the rewrite tags if there's a `%` in the slug.
- if ( 'post' !== $post_type && ! empty( $post_type_object->rewrite['slug'] ) && false !== strpos( $post_type_object->rewrite['slug'], '%' ) ) {
- $this->map_rewrite_tags( $post_id, $post_type_object->rewrite['slug'] );
- }
- }
-
- /**
- * Gets post types by slug. This is needed because the get_post_types() function doesn't exactly
- * match the 'has_archive' argument when it's set as a string instead of a boolean.
- *
- * @since 0.6.0
- * @access protected
- * @param int $slug The post type archive slug to search for.
- * @return void
- */
- protected function get_post_types_by_slug( $slug ) {
-
- $return = array();
-
- $post_types = get_post_types( array(), 'objects' );
-
- foreach ( $post_types as $type ) {
-
- if ( $slug === $type->has_archive || ( true === $type->has_archive && $slug === $type->rewrite['slug'] ) ) {
- $return[] = $type;
- }
- }
-
- return $return;
- }
-
- /**
- * Adds a post's terms from a specific taxonomy to the items array.
- *
- * @since 1.0.0
- * @access protected
- * @param int $post_id The ID of the post to get the terms for.
- * @param string $taxonomy The taxonomy to get the terms from.
- * @return void
- */
- protected function add_post_terms( $post_id, $taxonomy ) {
-
-
- // Get the post categories.
- $terms = get_the_terms( $post_id, $taxonomy );
-
- // Check that categories were returned.
- if ( $terms && ! is_wp_error( $terms ) ) {
-
- // Sort the terms by ID and get the first category.
- if ( function_exists( 'wp_list_sort' ) ) {
- $terms = wp_list_sort( $terms, 'term_id' );
- }
- else {
- usort( $terms, '_usort_terms_by_ID' );
- }
- $term = get_term( $terms[0], $taxonomy );
-
- // If the category has a parent, add the hierarchy to the trail.
- if ( 0 < $term->parent ) {
- $this->add_term_parents( $term->parent, $taxonomy );
- }
- // Add the category archive link to the trail.
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_term_link( $term, $taxonomy ) ), $term->name );
- }
- }
-
- /**
- * Get parent posts by path. Currently, this method only supports getting parents of the 'page'
- * post type. The goal of this function is to create a clear path back to home given what would
- * normally be a "ghost" directory. If any page matches the given path, it'll be added.
- *
- * @since 1.0.0
- * @access protected
- * @param string $path The path (slug) to search for posts by.
- * @return void
- */
- function add_path_parents( $path ) {
-
- // Trim '/' off $path in case we just got a simple '/' instead of a real path.
- $path = trim( $path, '/' );
-
- // If there's no path, return.
- if ( empty( $path ) ) {
- return;
- }
- // Get parent post by the path.
- $post = get_page_by_path( $path );
-
- if ( ! empty( $post ) ) {
- $this->add_post_parents( $post->ID );
- }
-
- elseif ( is_null( $post ) ) {
-
- // Separate post names into separate paths by '/'.
- $path = trim( $path, '/' );
- preg_match_all( "/\/.*?\z/", $path, $matches );
-
- // If matches are found for the path.
- if ( isset( $matches ) ) {
-
- // Reverse the array of matches to search for posts in the proper order.
- $matches = array_reverse( $matches );
-
- // Loop through each of the path matches.
- foreach ( $matches as $match ) {
-
- // If a match is found.
- if ( isset( $match[0] ) ) {
-
- // Get the parent post by the given path.
- $path = str_replace( $match[0], '', $path );
- $post = get_page_by_path( trim( $path, '/' ) );
-
- // If a parent post is found, set the $post_id and break out of the loop.
- if ( ! empty( $post ) && 0 < $post->ID ) {
- $this->add_post_parents( $post->ID );
- break;
- }
- }
- }
- }
- }
- }
-
- /**
- * Searches for term parents of hierarchical taxonomies. This function is similar to the WordPress
- * function get_category_parents() but handles any type of taxonomy.
- *
- * @since 1.0.0
- * @param int $term_id ID of the term to get the parents of.
- * @param string $taxonomy Name of the taxonomy for the given term.
- * @return void
- */
- function add_term_parents( $term_id, $taxonomy ) {
-
- // Set up some default arrays.
- $parents = array();
-
- // While there is a parent ID, add the parent term link to the $parents array.
- while ( $term_id ) {
-
- // Get the parent term.
- $term = get_term( $term_id, $taxonomy );
-
- // Add the formatted term link to the array of parent terms.
- $parents[] = sprintf( '<a href="%s">%s</a>', esc_url( get_term_link( $term, $taxonomy ) ), $term->name );
-
- // Set the parent term's parent as the parent ID.
- $term_id = $term->parent;
- }
-
- // If we have parent terms, reverse the array to put them in the proper order for the trail.
- if ( ! empty( $parents ) ) {
- $this->items = array_merge( $this->items, array_reverse( $parents ) );
- }
- }
-
- /**
- * Turns %tag% from permalink structures into usable links for the breadcrumb trail. This feels kind of
- * hackish for now because we're checking for specific %tag% examples and only doing it for the 'post'
- * post type. In the future, maybe it'll handle a wider variety of possibilities, especially for custom post
- * types.
- *
- * @since 0.6.0
- * @access protected
- * @param int $post_id ID of the post whose parents we want.
- * @param string $path Path of a potential parent page.
- * @param array $args Mixed arguments for the menu.
- * @return array
- */
- protected function map_rewrite_tags( $post_id, $path ) {
-
- $post = get_post( $post_id );
-
- // Trim '/' from both sides of the $path.
- $path = trim( $path, '/' );
-
- // Split the $path into an array of strings.
- $matches = explode( '/', $path );
-
- // If matches are found for the path.
- if ( is_array( $matches ) ) {
-
- // Loop through each of the matches, adding each to the $trail array.
- foreach ( $matches as $match ) {
-
- // Trim any '/' from the $match.
- $tag = trim( $match, '/' );
-
- // If using the %year% tag, add a link to the yearly archive.
- if ( '%year%' == $tag ) {
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_year_link( get_the_time( 'Y', $post_id ) ) ), sprintf( $this->labels['archive_year'], get_the_time( esc_html_x( 'Y', 'yearly archives date format', 'astra' ) ) ) );
- }
- // If using the %monthnum% tag, add a link to the monthly archive.
- elseif ( '%monthnum%' == $tag ) {
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_month_link( get_the_time( 'Y', $post_id ), get_the_time( 'm', $post_id ) ) ), sprintf( $this->labels['archive_month'], get_the_time( esc_html_x( 'F', 'monthly archives date format', 'astra' ) ) ) );
- }
- // If using the %day% tag, add a link to the daily archive.
- elseif ( '%day%' == $tag ) {
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_day_link( get_the_time( 'Y', $post_id ), get_the_time( 'm', $post_id ), get_the_time( 'd', $post_id ) ) ), sprintf( $this->labels['archive_day'], get_the_time( esc_html_x( 'j', 'daily archives date format', 'astra' ) ) ) );
- }
- // If using the %author% tag, add a link to the post author archive.
- elseif ( '%author%' == $tag ) {
- $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_author_posts_url( $post->post_author ) ), get_the_author_meta( 'display_name', $post->post_author ) );
- }
- // If using the %category% tag, add a link to the first category archive to match permalinks.
- elseif ( taxonomy_exists( trim( $tag, '%' ) ) ) {
-
- // Force override terms in this post type.
- $this->post_taxonomy[ $post->post_type ] = false;
-
- // Add the post categories.
- $this->add_post_terms( $post_id, trim( $tag, '%' ) );
- }
- }
- }
- }
+<?php +/** + * Breadcrumb Trail - A breadcrumb menu script for WordPress. + * + * Breadcrumb Trail is a script for showing a breadcrumb trail for any type of page. It tries to + * anticipate any type of structure and display the best possible trail that matches your site's + * permalink structure. While not perfect, it attempts to fill in the gaps left by many other + * breadcrumb scripts. + * + * This program is free software; you can redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @package BreadcrumbTrail + * @version 1.1.0 + * @author Justin Tadlock <justin@justintadlock.com> + * @copyright Copyright (c) 2008 - 2017, Justin Tadlock + * @link https://themehybrid.com/plugins/breadcrumb-trail + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Astra Get Breadcrumb + * + * Gets the basic Breadcrumb wrapper div & content + * + * @since 1.8.1 + * @param boolean $echo Whether to echo or not. + * @return string + */ +function astra_get_breadcrumb( $echo = true ) { + + if ( ! $echo ) { + return '<div class="ast-breadcrumbs-wrapper"> + <div class="ast-breadcrumbs-inner">' . + astra_get_selected_breadcrumb( $echo ) . + '</div> + </div>'; + } + + ?> + <div class="ast-breadcrumbs-wrapper"> + <div class="ast-breadcrumbs-inner"> + <?php astra_get_selected_breadcrumb( $echo ); ?> + </div> + </div> + <?php + +} + +/** + * Get selected breadcrumb. + * Returns or echo the breadcrumb depending upon the argument. + * + * @since 1.8.1 + * @access public + * @param boolean $echo Whether to echo or not. + * @return string Selected Breadcrumb. + */ +function astra_get_selected_breadcrumb( $echo = true ) { + + $breadcrumb_source = astra_get_option( 'select-breadcrumb-source' ); + + $breadcrumb_enable = is_callable( 'WPSEO_Options::get' ) ? WPSEO_Options::get( 'breadcrumbs-enable' ) : false; + $wpseo_option = get_option( 'wpseo_internallinks' ) ? get_option( 'wpseo_internallinks' ) : $breadcrumb_enable; + if ( ! is_array( $wpseo_option ) ) { + unset( $wpseo_option ); + $wpseo_option = array( + 'breadcrumbs-enable' => $breadcrumb_enable + ); + } + + if ( function_exists( 'yoast_breadcrumb' ) && true === $wpseo_option['breadcrumbs-enable'] && $breadcrumb_source && 'yoast-seo-breadcrumbs' == $breadcrumb_source ) { + // Check if breadcrumb is turned on from WPSEO option. + return yoast_breadcrumb( '<div id="ast-breadcrumbs-yoast" >', '</div>', $echo ); + } elseif ( function_exists( 'bcn_display' ) && $breadcrumb_source && 'breadcrumb-navxt' == $breadcrumb_source ) { + + if( true === $echo ) { + ?> + <div class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/"> + <?php bcn_display() ?> + </div> + <?php + return; + } + // Check if breadcrumb is turned on from Breadcrumb NavXT plugin. + return '<div class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">' . bcn_display( ! $echo ) . '</div>'; + } elseif ( function_exists( 'rank_math_the_breadcrumbs' ) && $breadcrumb_source && 'rank-math' == $breadcrumb_source ) { + // Check if breadcrumb is turned on from Rank Math plugin. + if ( ! $echo ) { + ob_start(); + rank_math_the_breadcrumbs(); + return ob_get_clean(); + } + rank_math_the_breadcrumbs(); + } else { + // Load default Astra breadcrumb if none selected. + return astra_get_breadcrumb_trail( $echo ); + } +} + + +/** + * Deprecating astra_breadcrumb_trail function. + * + * @since 1.8.1 + * @deprecated 1.8.1 Use astra_get_breadcrumb() + * @param array $args List of args. + * @see astra_breadcrumb_trail() + * + * @return string new breadcrumb function. + */ +function astra_breadcrumb_trail( $args = array() ) { + _deprecated_function( __FUNCTION__, '1.8.1', 'astra_get_breadcrumb()' ); + astra_get_breadcrumb(); +} + +/** + * Shows a breadcrumb for all types of pages. This is a wrapper function for the Breadcrumb_Trail class, + * which should be used in theme templates. + * + * @since 1.8.1 + * @access public + * @param boolean $echo Whether to echo or not. + * @return string Selected Breadcrumb. + */ +function astra_get_breadcrumb_trail( $echo = true ) { + + $defaults = array( + 'before' => '<div class="ast-breadcrumbs">', + 'after' => '</div>', + 'show_browse' => false, + 'echo' => $echo, + ); + + $args = apply_filters( 'astra_breadcrumb_trail_args', $defaults ); + + $breadcrumb = apply_filters( 'astra_breadcrumb_trail_object', null, $args ); + + if ( ! is_object( $breadcrumb ) ) { + $breadcrumb = new Astra_Breadcrumb_Trail( $args ); + } + + return $breadcrumb->trail(); +} + +/** + * Creates a breadcrumbs menu for the site based on the current page that's being viewed by the user. + * + * @since 0.6.0 + * @access public + */ +class Astra_Breadcrumb_Trail { + + /** + * Array of items belonging to the current breadcrumb trail. + * + * @since 0.1.0 + * @access public + * @var array + */ + public $items = array(); + + /** + * Arguments used to build the breadcrumb trail. + * + * @since 0.1.0 + * @access public + * @var array + */ + public $args = array(); + + /** + * Array of text labels. + * + * @since 1.0.0 + * @access public + * @var array + */ + public $labels = array(); + + /** + * Array of post types (key) and taxonomies (value) to use for single post views. + * + * @since 1.0.0 + * @access public + * @var array + */ + public $post_taxonomy = array(); + + /* ====== Magic Methods ====== */ + + /** + * Magic method to use in case someone tries to output the layout object as a string. + * We'll just return the trail HTML. + * + * @since 1.0.0 + * @access public + * @return string + */ + public function __toString() { + return $this->trail(); + } + + /** + * Sets up the breadcrumb trail properties. Calls the `Breadcrumb_Trail::add_items()` method + * to create the array of breadcrumb items. + * + * @since 0.6.0 + * @access public + * @param array $args { + * @type string $container Container HTML element. nav|div + * @type string $before String to output before breadcrumb menu. + * @type string $after String to output after breadcrumb menu. + * @type string $browse_tag The HTML tag to use to wrap the "Browse" header text. + * @type string $list_tag The HTML tag to use for the list wrapper. + * @type string $item_tag The HTML tag to use for the item wrapper. + * @type bool $show_on_front Whether to show when `is_front_page()`. + * @type bool $network Whether to link to the network main site (multisite only). + * @type bool $show_title Whether to show the title (last item) in the trail. + * @type bool $show_browse Whether to show the breadcrumb menu header. + * @type array $labels Text labels. @see Breadcrumb_Trail::set_labels() + * @type array $post_taxonomy Taxonomies to use for post types. @see Breadcrumb_Trail::set_post_taxonomy() + * @type bool $echo Whether to print or return the breadcrumbs. + * } + * @return void + */ + public function __construct( $args = array() ) { + + $defaults = array( + 'container' => 'nav', + 'before' => '', + 'after' => '', + 'browse_tag' => 'h2', + 'list_tag' => 'ul', + 'item_tag' => 'li', + 'show_on_front' => true, + 'network' => false, + 'show_title' => true, + 'show_browse' => true, + 'labels' => array(), + 'post_taxonomy' => array(), + 'echo' => true, + 'schema' => true, + ); + + // Parse the arguments with the deaults. + $this->args = apply_filters( 'astra_breadcrumb_trail_args', wp_parse_args( $args, $defaults ) ); + + // Set the labels and post taxonomy properties. + $this->set_labels(); + $this->set_post_taxonomy(); + + // Let's find some items to add to the trail! + $this->add_items(); + } + + /* ====== Public Methods ====== */ + + /** + * Formats the HTML output for the breadcrumb trail. + * + * @since 0.6.0 + * @access public + * @return string + */ + public function trail() { + + // Set up variables that we'll need. + $breadcrumb = ''; + $item_count = count( $this->items ); + $item_position = 0; + $meta = ''; + + if ( 2 > $item_count ) { + $this->args['schema'] = false; + } + + // Connect the breadcrumb trail if there are items in the trail. + if ( 0 < $item_count ) { + + // Add 'browse' label if it should be shown. + if ( true === $this->args['show_browse'] ) { + + $breadcrumb .= sprintf( + '<%1$s class="trail-browse">%2$s</%1$s>', + tag_escape( $this->args['browse_tag'] ), + $this->labels['browse'] + ); + } + + // Open the unordered list. + $breadcrumb .= sprintf( + '<%1$s class="trail-items" %2$s>', + tag_escape( $this->args['list_tag'] ), + ( $this->args['schema'] ? 'itemscope itemtype="http://schema.org/BreadcrumbList"' : '' ) + ); + + if ( $this->args['schema'] ) { + // Add the number of items and item list order schema. + $breadcrumb .= sprintf( '<meta content="%1$d" %2$s />', absint( $item_count ), astra_attr( + 'breadcrumb-trail-items-num-meta', + array( + 'name' => 'numberOfItems', + 'class' => '', + ) + ) ); + $breadcrumb .= '<meta ' . astra_attr( + 'breadcrumb-trail-items-list-meta', + array( + 'class' => '', + 'name' => 'itemListOrder', + 'content' => 'Ascending', + ) + ) . '/>'; + } + + // Loop through the items and add them to the list. + foreach ( $this->items as $item ) { + + // Iterate the item position. + ++$item_position; + + // Check if the item is linked. + preg_match( '/(<a.*?>)(.*?)(<\/a>)/i', $item, $matches ); + + // Wrap the item text with appropriate itemprop. + $item = ! empty( $matches ) ? sprintf( '%s<span %s>%s</span>%s', $matches[1], $this->args['schema'] ? 'itemprop="name"' : '', $matches[2], $matches[3] ) : sprintf( '<span>%s</span>', $item ); + + // Wrap the item with its itemprop. + $item = ( ! empty( $matches ) && $this->args['schema'] ) + ? preg_replace( '/(<a.*?)([\'"])>/i', '$1$2 itemprop=$2item$2>', $item ) + : sprintf( '<span>%s</span>', $item ); + + // Add list item classes. + $item_class = 'trail-item'; + $item_schema_attr = 'itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"'; + + if ( 1 === $item_position && 1 < $item_count ) { + $item_class .= ' trail-begin'; + } elseif ( $item_count === $item_position ) { + $item_class .= ' trail-end'; + $item_schema_attr = ''; + } + + // Create list item attributes. + $attributes = $this->args['schema'] ? $item_schema_attr : ''; + + $attributes .= ' class="' . $item_class . '"'; + + if ( $this->args['schema'] ) { + // Build the meta position HTML. + $meta = sprintf( '<meta itemprop="position" content="%s" />', absint( $item_position ) ); + } + + if ( $item_count === $item_position ) { + $meta = ''; + } + + // Build the list item. + $breadcrumb .= sprintf( '<%1$s %2$s>%3$s%4$s</%1$s>', tag_escape( $this->args['item_tag'] ),$attributes, $item, $meta ); + } + + // Close the unordered list. + $breadcrumb .= sprintf( '</%s>', tag_escape( $this->args['list_tag'] ) ); + + // Wrap the breadcrumb trail. + $breadcrumb = sprintf( + '<%1$s role="navigation" aria-label="%2$s" class="breadcrumb-trail breadcrumbs" >%3$s%4$s%5$s</%1$s>', + tag_escape( $this->args['container'] ), + esc_attr( $this->labels['aria_label'] ), + $this->args['before'], + $breadcrumb, + $this->args['after'] + ); + } + + // Allow developers to filter the breadcrumb trail HTML. + $breadcrumb = apply_filters( 'astra_breadcrumb_trail', $breadcrumb, $this->args ); + + if ( false === $this->args['echo'] ) { + return $breadcrumb; + } + + echo $breadcrumb; + } + + /* ====== Protected Methods ====== */ + + /** + * Sets the labels property. Parses the inputted labels array with the defaults. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function set_labels() { + + $defaults = array( + 'browse' => esc_html__( 'Browse:', 'astra' ), + 'aria_label' => esc_attr_x( 'Breadcrumbs', 'breadcrumbs aria label', 'astra' ), + 'home' => esc_html__( 'Home', 'astra' ), + 'error_404' => esc_html__( '404 Not Found', 'astra' ), + 'archives' => esc_html__( 'Archives', 'astra' ), + // Translators: %s is the search query. + 'search' => esc_html__( 'Search results for: %s', 'astra' ), + // Translators: %s is the page number. + 'paged' => esc_html__( 'Page %s', 'astra' ), + // Translators: %s is the page number. + 'paged_comments' => esc_html__( 'Comment Page %s', 'astra' ), + // Translators: Minute archive title. %s is the minute time format. + 'archive_minute' => esc_html__( 'Minute %s', 'astra' ), + // Translators: Weekly archive title. %s is the week date format. + 'archive_week' => esc_html__( 'Week %s', 'astra' ), + + // "%s" is replaced with the translated date/time format. + 'archive_minute_hour' => '%s', + 'archive_hour' => '%s', + 'archive_day' => '%s', + 'archive_month' => '%s', + 'archive_year' => '%s', + ); + + $this->labels = apply_filters( 'astra_breadcrumb_trail_labels', wp_parse_args( $this->args['labels'], $defaults ) ); + } + + /** + * Sets the `$post_taxonomy` property. This is an array of post types (key) and taxonomies (value). + * The taxonomy's terms are shown on the singular post view if set. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function set_post_taxonomy() { + + $defaults = array(); + + // If post permalink is set to `%postname%`, use the `category` taxonomy. + if ( '%postname%' === trim( get_option( 'permalink_structure' ), '/' ) ) { + $defaults['post'] = 'category'; + } + + $this->post_taxonomy = apply_filters( 'astra_breadcrumb_trail_post_taxonomy', wp_parse_args( $this->args['post_taxonomy'], $defaults ) ); + } + + /** + * Runs through the various WordPress conditional tags to check the current page being viewed. Once + * a condition is met, a specific method is launched to add items to the `$items` array. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_items() { + + // If viewing the front page. + if ( is_front_page() ) { + $this->add_front_page_items(); + } + + // If not viewing the front page. + else { + + // Add the network and site home links. + $this->add_network_home_link(); + $this->add_site_home_link(); + + // If viewing the home/blog page. + if ( is_home() ) { + $this->add_blog_items(); + } + + // If viewing a single post. + elseif ( is_singular() ) { + $this->add_singular_items(); + } + + // If viewing an archive page. + elseif ( is_archive() ) { + + if ( is_post_type_archive() ) { + $this->add_post_type_archive_items(); + } + elseif ( is_category() || is_tag() || is_tax() ) { + $this->add_term_archive_items(); + } + elseif ( is_author() ) { + $this->add_user_archive_items(); + } + elseif ( get_query_var( 'minute' ) && get_query_var( 'hour' ) ) { + $this->add_minute_hour_archive_items(); + } + elseif ( get_query_var( 'minute' ) ) { + $this->add_minute_archive_items(); + } + elseif ( get_query_var( 'hour' ) ) { + $this->add_hour_archive_items(); + } + elseif ( is_day() ) { + $this->add_day_archive_items(); + } + elseif ( get_query_var( 'w' ) ) { + $this->add_week_archive_items(); + } + elseif ( is_month() ) { + $this->add_month_archive_items(); + } + elseif ( is_year() ) { + $this->add_year_archive_items(); + } + else { + $this->add_default_archive_items(); + } + } + + // If viewing a search results page. + elseif ( is_search() ) { + $this->add_search_items(); + } + + // If viewing the 404 page. + elseif ( is_404() ) { + $this->add_404_items(); + } + } + + // Add paged items if they exist. + $this->add_paged_items(); + + // Allow developers to overwrite the items for the breadcrumb trail. + $this->items = array_unique( apply_filters( 'astra_breadcrumb_trail_items', $this->items, $this->args ) ); + } + + /** + * Gets front items based on $wp_rewrite->front. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_rewrite_front_items() { + global $wp_rewrite; + + if ( $wp_rewrite->front ) { + $this->add_path_parents( $wp_rewrite->front ); + } + } + + /** + * Adds the page/paged number to the items array. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_paged_items() { + + // If viewing a paged singular post. + if ( is_singular() && 1 < get_query_var( 'page' ) && true === $this->args['show_title'] ) { + $this->items[] = sprintf( $this->labels['paged'], number_format_i18n( absint( get_query_var( 'page' ) ) ) ); + } + // If viewing a singular post with paged comments. + elseif ( is_singular() && get_option( 'page_comments' ) && 1 < get_query_var( 'cpage' ) ) { + $this->items[] = sprintf( $this->labels['paged_comments'], number_format_i18n( absint( get_query_var( 'cpage' ) ) ) ); + } + // If viewing a paged archive-type page. + elseif ( is_paged() && true === $this->args['show_title'] ) { + $this->items[] = sprintf( $this->labels['paged'], number_format_i18n( absint( get_query_var( 'paged' ) ) ) ); + } + } + + /** + * Adds the network (all sites) home page link to the items array. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_network_home_link() { + + if ( is_multisite() && ! is_main_site() && true === $this->args['network'] ) { + $this->items[] = sprintf( '<a href="%s" rel="home">%s</a>', esc_url( network_home_url() ), $this->labels['home'] ); + } + } + + /** + * Adds the current site's home page link to the items array. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_site_home_link() { + + $network = is_multisite() && ! is_main_site() && true === $this->args['network']; + $label = $network ? get_bloginfo( 'name' ) : $this->labels['home']; + $rel = $network ? '' : ' rel="home"'; + + $this->items[] = sprintf( '<a href="%s"%s>%s</a>', esc_url( user_trailingslashit( home_url() ) ), $rel, $label ); + } + + /** + * Adds items for the front page to the items array. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_front_page_items() { + + // Only show front items if the 'show_on_front' argument is set to 'true'. + if ( true === $this->args['show_on_front'] || is_paged() || ( is_singular() && 1 < get_query_var( 'page' ) ) ) { + + // Add network home link. + $this->add_network_home_link(); + + // If on a paged view, add the site home link. + if ( is_paged() ) { + $this->add_site_home_link(); + } + // If on the main front page, add the network home title. + elseif ( true === $this->args['show_title'] ) { + $this->items[] = is_multisite() && true === $this->args['network'] ? get_bloginfo( 'name' ) : $this->labels['home']; + } + } + } + + /** + * Adds items for the posts page (i.e., is_home()) to the items array. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_blog_items() { + + // Get the post ID and post. + $post_id = get_queried_object_id(); + $post = get_post( $post_id ); + + // If the post has parents, add them to the trail. + if ( 0 < $post->post_parent ) { + $this->add_post_parents( $post->post_parent ); + } + // Get the page title. + $title = get_the_title( $post_id ); + + // Add the posts page item. + if ( is_paged() ) { + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_permalink( $post_id ) ), $title ); + } + elseif ( $title && true === $this->args['show_title'] ) { + $this->items[] = $title; + } + } + + /** + * Adds singular post items to the items array. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_singular_items() { + + // Get the queried post. + $post = get_queried_object(); + $post_id = get_queried_object_id(); + + // If the post has a parent, follow the parent trail. + if ( 0 < $post->post_parent ) { + $this->add_post_parents( $post->post_parent ); + } + // If the post doesn't have a parent, get its hierarchy based off the post type. + else { + $this->add_post_hierarchy( $post_id ); + } + // Display terms for specific post type taxonomy if requested. + if ( ! empty( $this->post_taxonomy[ $post->post_type ] ) ) { + $this->add_post_terms( $post_id, $this->post_taxonomy[ $post->post_type ] ); + } + // End with the post title. + if ( $post_title = single_post_title( '', false ) ) { + + if ( ( 1 < get_query_var( 'page' ) || is_paged() ) || ( get_option( 'page_comments' ) && 1 < absint( get_query_var( 'cpage' ) ) ) ) { + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_permalink( $post_id ) ), $post_title ); + } + elseif ( true === $this->args['show_title'] ) { + $this->items[] = $post_title; + } + } + } + + /** + * Adds the items to the trail items array for taxonomy term archives. + * + * @since 1.0.0 + * @access protected + * @global object $wp_rewrite + * @return void + */ + protected function add_term_archive_items() { + global $wp_rewrite; + + // Get some taxonomy and term variables. + $term = get_queried_object(); + $taxonomy = get_taxonomy( $term->taxonomy ); + $done_post_type = false; + + // If there are rewrite rules for the taxonomy. + if ( false !== $taxonomy->rewrite ) { + + // If 'with_front' is true, dd $wp_rewrite->front to the trail. + if ( $taxonomy->rewrite['with_front'] && $wp_rewrite->front ) { + $this->add_rewrite_front_items(); + } + // Get parent pages by path if they exist. + $this->add_path_parents( $taxonomy->rewrite['slug'] ); + + // Add post type archive if its 'has_archive' matches the taxonomy rewrite 'slug'. + if ( $taxonomy->rewrite['slug'] ) { + + $slug = trim( $taxonomy->rewrite['slug'], '/' ); + + // Deals with the situation if the slug has a '/' between multiple + // strings. For example, "movies/genres" where "movies" is the post + // type archive. + $matches = explode( '/', $slug ); + + // If matches are found for the path. + if ( isset( $matches ) ) { + + // Reverse the array of matches to search for posts in the proper order. + $matches = array_reverse( $matches ); + + // Loop through each of the path matches. + foreach ( $matches as $match ) { + + + // Get public post types that match the rewrite slug. + $post_types = $this->get_post_types_by_slug( $match ); + + if ( ! empty( $post_types ) ) { + + $post_type_object = $post_types[0]; + + // Add support for a non-standard label of 'archive_title' (special use case). + $label = ! empty( $post_type_object->labels->archive_title ) ? $post_type_object->labels->archive_title : $post_type_object->labels->name; + + // Core filter hook. + $label = apply_filters( 'post_type_archive_title', $label, $post_type_object->name ); + + // Add the post type archive link to the trail. + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_post_type_archive_link( $post_type_object->name ) ), $label ); + + $done_post_type = true; + + // Break out of the loop. + break; + } + } + } + } + } + + // If there's a single post type for the taxonomy, use it. + if ( false === $done_post_type && 1 === count( $taxonomy->object_type ) && post_type_exists( $taxonomy->object_type[0] ) ) { + + // If the post type is 'post'. + if ( 'post' === $taxonomy->object_type[0] ) { + $post_id = get_option( 'page_for_posts' ); + + if ( 'posts' !== get_option( 'show_on_front' ) && 0 < $post_id ) { + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_permalink( $post_id ) ), get_the_title( $post_id ) ); + } + // If the post type is not 'post'. + } else { + $post_type_object = get_post_type_object( $taxonomy->object_type[0] ); + + $label = ! empty( $post_type_object->labels->archive_title ) ? $post_type_object->labels->archive_title : $post_type_object->labels->name; + + // Core filter hook. + $label = apply_filters( 'post_type_archive_title', $label, $post_type_object->name ); + + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_post_type_archive_link( $post_type_object->name ) ), $label ); + } + } + + // If the taxonomy is hierarchical, list its parent terms. + if ( is_taxonomy_hierarchical( $term->taxonomy ) && $term->parent ) { + $this->add_term_parents( $term->parent, $term->taxonomy ); + } + // Add the term name to the trail end. + if ( is_paged() ){ + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_term_link( $term, $term->taxonomy ) ), single_term_title( '', false ) ); + } + elseif ( true === $this->args['show_title'] ) { + $this->items[] = single_term_title( '', false ); + } + } + + /** + * Adds the items to the trail items array for post type archives. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_post_type_archive_items() { + + // Get the post type object. + $post_type_object = get_post_type_object( get_query_var( 'post_type' ) ); + + if ( false !== $post_type_object->rewrite ) { + + // If 'with_front' is true, add $wp_rewrite->front to the trail. + if ( $post_type_object->rewrite['with_front'] ) { + $this->add_rewrite_front_items(); + } + // If there's a rewrite slug, check for parents. + if ( ! empty( $post_type_object->rewrite['slug'] ) ) { + $this->add_path_parents( $post_type_object->rewrite['slug'] ); + } + } + + // Add the post type [plural] name to the trail end. + if ( is_paged() || is_author() ) { + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_post_type_archive_link( $post_type_object->name ) ), post_type_archive_title( '', false ) ); + } + elseif ( true === $this->args['show_title'] ) { + $this->items[] = post_type_archive_title( '', false ); + } + // If viewing a post type archive by author. + if ( is_author() ) { + $this->add_user_archive_items(); + } + } + + /** + * Adds the items to the trail items array for user (author) archives. + * + * @since 1.0.0 + * @access protected + * @global object $wp_rewrite + * @return void + */ + protected function add_user_archive_items() { + global $wp_rewrite; + + // Add $wp_rewrite->front to the trail. + $this->add_rewrite_front_items(); + + // Get the user ID. + $user_id = get_query_var( 'author' ); + + // If $author_base exists, check for parent pages. + if ( ! empty( $wp_rewrite->author_base ) && ! is_post_type_archive() ) { + $this->add_path_parents( $wp_rewrite->author_base ); + } + // Add the author's display name to the trail end. + if ( is_paged() ) { + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_author_posts_url( $user_id ) ), get_the_author_meta( 'display_name', $user_id ) ); + } + elseif ( true === $this->args['show_title'] ) { + $this->items[] = get_the_author_meta( 'display_name', $user_id ); + } + } + + /** + * Adds the items to the trail items array for minute + hour archives. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_minute_hour_archive_items() { + + // Add $wp_rewrite->front to the trail. + $this->add_rewrite_front_items(); + + // Add the minute + hour item. + if ( true === $this->args['show_title'] ) { + $this->items[] = sprintf( $this->labels['archive_minute_hour'], get_the_time( esc_html_x( 'g:i a', 'minute and hour archives time format', 'astra' ) ) ); + } + } + + /** + * Adds the items to the trail items array for minute archives. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_minute_archive_items() { + + // Add $wp_rewrite->front to the trail. + $this->add_rewrite_front_items(); + + // Add the minute item. + if ( true === $this->args['show_title'] ) { + $this->items[] = sprintf( $this->labels['archive_minute'], get_the_time( esc_html_x( 'i', 'minute archives time format', 'astra' ) ) ); + } + } + + /** + * Adds the items to the trail items array for hour archives. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_hour_archive_items() { + + // Add $wp_rewrite->front to the trail. + $this->add_rewrite_front_items(); + + // Add the hour item. + if ( true === $this->args['show_title'] ) { + $this->items[] = sprintf( $this->labels['archive_hour'], get_the_time( esc_html_x( 'g a', 'hour archives time format', 'astra' ) ) ); + } + } + + /** + * Adds the items to the trail items array for day archives. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_day_archive_items() { + + // Add $wp_rewrite->front to the trail. + $this->add_rewrite_front_items(); + + // Get year, month, and day. + $year = sprintf( $this->labels['archive_year'], get_the_time( esc_html_x( 'Y', 'yearly archives date format', 'astra' ) ) ); + $month = sprintf( $this->labels['archive_month'], get_the_time( esc_html_x( 'F', 'monthly archives date format', 'astra' ) ) ); + $day = sprintf( $this->labels['archive_day'], get_the_time( esc_html_x( 'j', 'daily archives date format', 'astra' ) ) ); + + // Add the year and month items. + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_year_link( get_the_time( 'Y' ) ) ), $year ); + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_month_link( get_the_time( 'Y' ), get_the_time( 'm' ) ) ), $month ); + + // Add the day item. + if ( is_paged() ) { + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_day_link( get_the_time( 'Y' ) ), get_the_time( 'm' ), get_the_time( 'd' ) ), $day ); + } + elseif ( true === $this->args['show_title'] ) { + $this->items[] = $day; + } + } + + /** + * Adds the items to the trail items array for week archives. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_week_archive_items() { + + // Add $wp_rewrite->front to the trail. + $this->add_rewrite_front_items(); + + // Get the year and week. + $year = sprintf( $this->labels['archive_year'], get_the_time( esc_html_x( 'Y', 'yearly archives date format', 'astra' ) ) ); + $week = sprintf( $this->labels['archive_week'], get_the_time( esc_html_x( 'W', 'weekly archives date format', 'astra' ) ) ); + + // Add the year item. + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_year_link( get_the_time( 'Y' ) ) ), $year ); + + // Add the week item. + if ( is_paged() ) { + $this->items[] = esc_url( get_archives_link( add_query_arg( array( 'm' => get_the_time( 'Y' ), 'w' => get_the_time( 'W' ) ), home_url() ), $week, false ) ); + } + elseif ( true === $this->args['show_title'] ) { + $this->items[] = $week; + } + } + + /** + * Adds the items to the trail items array for month archives. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_month_archive_items() { + + // Add $wp_rewrite->front to the trail. + $this->add_rewrite_front_items(); + + // Get the year and month. + $year = sprintf( $this->labels['archive_year'], get_the_time( esc_html_x( 'Y', 'yearly archives date format', 'astra' ) ) ); + $month = sprintf( $this->labels['archive_month'], get_the_time( esc_html_x( 'F', 'monthly archives date format', 'astra' ) ) ); + + // Add the year item. + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_year_link( get_the_time( 'Y' ) ) ), $year ); + + // Add the month item. + if ( is_paged() ) { + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_month_link( get_the_time( 'Y' ), get_the_time( 'm' ) ) ), $month ); + } + elseif ( true === $this->args['show_title'] ) { + $this->items[] = $month; + } + } + + /** + * Adds the items to the trail items array for year archives. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_year_archive_items() { + + // Add $wp_rewrite->front to the trail. + $this->add_rewrite_front_items(); + + // Get the year. + $year = sprintf( $this->labels['archive_year'], get_the_time( esc_html_x( 'Y', 'yearly archives date format', 'astra' ) ) ); + + // Add the year item. + if ( is_paged() ) { + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_year_link( get_the_time( 'Y' ) ) ), $year ); + } + elseif ( true === $this->args['show_title'] ) { + $this->items[] = $year; + } + } + + /** + * Adds the items to the trail items array for archives that don't have a more specific method + * defined in this class. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_default_archive_items() { + + // If this is a date-/time-based archive, add $wp_rewrite->front to the trail. + if ( is_date() || is_time() ) { + $this->add_rewrite_front_items(); + } + if ( true === $this->args['show_title'] ) { + $this->items[] = $this->labels['archives']; + } + } + + /** + * Adds the items to the trail items array for search results. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_search_items() { + + if ( is_paged() ) { + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_search_link() ), sprintf( $this->labels['search'], get_search_query() ) ); + } + elseif ( true === $this->args['show_title'] ) { + $this->items[] = sprintf( $this->labels['search'], get_search_query() ); + } + } + + /** + * Adds the items to the trail items array for 404 pages. + * + * @since 1.0.0 + * @access protected + * @return void + */ + protected function add_404_items() { + + if ( true === $this->args['show_title'] ) { + $this->items[] = $this->labels['error_404']; + } + } + + /** + * Adds a specific post's parents to the items array. + * + * @since 1.0.0 + * @access protected + * @param int $post_id + * @return void + */ + protected function add_post_parents( $post_id ) { + $parents = array(); + + while ( $post_id ) { + + // Get the post by ID. + $post = get_post( $post_id ); + + // If we hit a page that's set as the front page, bail. + if ( 'page' == $post->post_type && 'page' == get_option( 'show_on_front' ) && $post_id == get_option( 'page_on_front' ) ) { + break; + } + // Add the formatted post link to the array of parents. + $parents[] = sprintf( '<a href="%s">%s</a>', esc_url( get_permalink( $post_id ) ), get_the_title( $post_id ) ); + + // If there's no longer a post parent, break out of the loop. + if ( 0 >= $post->post_parent ) { + break; + } + // Change the post ID to the parent post to continue looping. + $post_id = $post->post_parent; + } + + // Get the post hierarchy based off the final parent post. + $this->add_post_hierarchy( $post_id ); + + // Display terms for specific post type taxonomy if requested. + if ( ! empty( $this->post_taxonomy[ $post->post_type ] ) ) { + $this->add_post_terms( $post_id, $this->post_taxonomy[ $post->post_type ] ); + } + // Merge the parent items into the items array. + $this->items = array_merge( $this->items, array_reverse( $parents ) ); + } + + /** + * Adds a specific post's hierarchy to the items array. The hierarchy is determined by post type's + * rewrite arguments and whether it has an archive page. + * + * @since 1.0.0 + * @access protected + * @param int $post_id + * @return void + */ + protected function add_post_hierarchy( $post_id ) { + + // Get the post type. + $post_type = get_post_type( $post_id ); + $post_type_object = get_post_type_object( $post_type ); + + // If this is the 'post' post type, get the rewrite front items and map the rewrite tags. + if ( 'post' === $post_type ) { + + // Add $wp_rewrite->front to the trail. + $this->add_rewrite_front_items(); + + // Map the rewrite tags. + $this->map_rewrite_tags( $post_id, get_option( 'permalink_structure' ) ); + } + + // If the post type has rewrite rules. + elseif ( false !== $post_type_object->rewrite ) { + + // If 'with_front' is true, add $wp_rewrite->front to the trail. + if ( $post_type_object->rewrite['with_front'] ) { + $this->add_rewrite_front_items(); + } + // If there's a path, check for parents. + if ( ! empty( $post_type_object->rewrite['slug'] ) ) { + $this->add_path_parents( $post_type_object->rewrite['slug'] ); + } + } + + // If there's an archive page, add it to the trail. + if ( $post_type_object->has_archive ) { + + // Add support for a non-standard label of 'archive_title' (special use case). + $label = ! empty( $post_type_object->labels->archive_title ) ? $post_type_object->labels->archive_title : $post_type_object->labels->name; + + // Core filter hook. + $label = apply_filters( 'post_type_archive_title', $label, $post_type_object->name ); + + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_post_type_archive_link( $post_type ) ), $label ); + } + + // Map the rewrite tags if there's a `%` in the slug. + if ( 'post' !== $post_type && ! empty( $post_type_object->rewrite['slug'] ) && false !== strpos( $post_type_object->rewrite['slug'], '%' ) ) { + $this->map_rewrite_tags( $post_id, $post_type_object->rewrite['slug'] ); + } + } + + /** + * Gets post types by slug. This is needed because the get_post_types() function doesn't exactly + * match the 'has_archive' argument when it's set as a string instead of a boolean. + * + * @since 0.6.0 + * @access protected + * @param int $slug The post type archive slug to search for. + * @return void + */ + protected function get_post_types_by_slug( $slug ) { + + $return = array(); + + $post_types = get_post_types( array(), 'objects' ); + + foreach ( $post_types as $type ) { + + if ( $slug === $type->has_archive || ( true === $type->has_archive && $slug === $type->rewrite['slug'] ) ) { + $return[] = $type; + } + } + + return $return; + } + + /** + * Adds a post's terms from a specific taxonomy to the items array. + * + * @since 1.0.0 + * @access protected + * @param int $post_id The ID of the post to get the terms for. + * @param string $taxonomy The taxonomy to get the terms from. + * @return void + */ + protected function add_post_terms( $post_id, $taxonomy ) { + + + // Get the post categories. + $terms = get_the_terms( $post_id, $taxonomy ); + + // Check that categories were returned. + if ( $terms && ! is_wp_error( $terms ) ) { + + // Sort the terms by ID and get the first category. + if ( function_exists( 'wp_list_sort' ) ) { + $terms = wp_list_sort( $terms, 'term_id' ); + } + else { + usort( $terms, '_usort_terms_by_ID' ); + } + $term = get_term( $terms[0], $taxonomy ); + + // If the category has a parent, add the hierarchy to the trail. + if ( 0 < $term->parent ) { + $this->add_term_parents( $term->parent, $taxonomy ); + } + // Add the category archive link to the trail. + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_term_link( $term, $taxonomy ) ), $term->name ); + } + } + + /** + * Get parent posts by path. Currently, this method only supports getting parents of the 'page' + * post type. The goal of this function is to create a clear path back to home given what would + * normally be a "ghost" directory. If any page matches the given path, it'll be added. + * + * @since 1.0.0 + * @access protected + * @param string $path The path (slug) to search for posts by. + * @return void + */ + function add_path_parents( $path ) { + + // Trim '/' off $path in case we just got a simple '/' instead of a real path. + $path = trim( $path, '/' ); + + // If there's no path, return. + if ( empty( $path ) ) { + return; + } + // Get parent post by the path. + $post = get_page_by_path( $path ); + + if ( ! empty( $post ) ) { + $this->add_post_parents( $post->ID ); + } + + elseif ( is_null( $post ) ) { + + // Separate post names into separate paths by '/'. + $path = trim( $path, '/' ); + preg_match_all( "/\/.*?\z/", $path, $matches ); + + // If matches are found for the path. + if ( isset( $matches ) ) { + + // Reverse the array of matches to search for posts in the proper order. + $matches = array_reverse( $matches ); + + // Loop through each of the path matches. + foreach ( $matches as $match ) { + + // If a match is found. + if ( isset( $match[0] ) ) { + + // Get the parent post by the given path. + $path = str_replace( $match[0], '', $path ); + $post = get_page_by_path( trim( $path, '/' ) ); + + // If a parent post is found, set the $post_id and break out of the loop. + if ( ! empty( $post ) && 0 < $post->ID ) { + $this->add_post_parents( $post->ID ); + break; + } + } + } + } + } + } + + /** + * Searches for term parents of hierarchical taxonomies. This function is similar to the WordPress + * function get_category_parents() but handles any type of taxonomy. + * + * @since 1.0.0 + * @param int $term_id ID of the term to get the parents of. + * @param string $taxonomy Name of the taxonomy for the given term. + * @return void + */ + function add_term_parents( $term_id, $taxonomy ) { + + // Set up some default arrays. + $parents = array(); + + // While there is a parent ID, add the parent term link to the $parents array. + while ( $term_id ) { + + // Get the parent term. + $term = get_term( $term_id, $taxonomy ); + + // Add the formatted term link to the array of parent terms. + $parents[] = sprintf( '<a href="%s">%s</a>', esc_url( get_term_link( $term, $taxonomy ) ), $term->name ); + + // Set the parent term's parent as the parent ID. + $term_id = $term->parent; + } + + // If we have parent terms, reverse the array to put them in the proper order for the trail. + if ( ! empty( $parents ) ) { + $this->items = array_merge( $this->items, array_reverse( $parents ) ); + } + } + + /** + * Turns %tag% from permalink structures into usable links for the breadcrumb trail. This feels kind of + * hackish for now because we're checking for specific %tag% examples and only doing it for the 'post' + * post type. In the future, maybe it'll handle a wider variety of possibilities, especially for custom post + * types. + * + * @since 0.6.0 + * @access protected + * @param int $post_id ID of the post whose parents we want. + * @param string $path Path of a potential parent page. + * @param array $args Mixed arguments for the menu. + * @return array + */ + protected function map_rewrite_tags( $post_id, $path ) { + + $post = get_post( $post_id ); + + // Trim '/' from both sides of the $path. + $path = trim( $path, '/' ); + + // Split the $path into an array of strings. + $matches = explode( '/', $path ); + + // If matches are found for the path. + if ( is_array( $matches ) ) { + + // Loop through each of the matches, adding each to the $trail array. + foreach ( $matches as $match ) { + + // Trim any '/' from the $match. + $tag = trim( $match, '/' ); + + // If using the %year% tag, add a link to the yearly archive. + if ( '%year%' == $tag ) { + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_year_link( get_the_time( 'Y', $post_id ) ) ), sprintf( $this->labels['archive_year'], get_the_time( esc_html_x( 'Y', 'yearly archives date format', 'astra' ) ) ) ); + } + // If using the %monthnum% tag, add a link to the monthly archive. + elseif ( '%monthnum%' == $tag ) { + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_month_link( get_the_time( 'Y', $post_id ), get_the_time( 'm', $post_id ) ) ), sprintf( $this->labels['archive_month'], get_the_time( esc_html_x( 'F', 'monthly archives date format', 'astra' ) ) ) ); + } + // If using the %day% tag, add a link to the daily archive. + elseif ( '%day%' == $tag ) { + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_day_link( get_the_time( 'Y', $post_id ), get_the_time( 'm', $post_id ), get_the_time( 'd', $post_id ) ) ), sprintf( $this->labels['archive_day'], get_the_time( esc_html_x( 'j', 'daily archives date format', 'astra' ) ) ) ); + } + // If using the %author% tag, add a link to the post author archive. + elseif ( '%author%' == $tag ) { + $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_author_posts_url( $post->post_author ) ), get_the_author_meta( 'display_name', $post->post_author ) ); + } + // If using the %category% tag, add a link to the first category archive to match permalinks. + elseif ( taxonomy_exists( trim( $tag, '%' ) ) ) { + + // Force override terms in this post type. + $this->post_taxonomy[ $post->post_type ] = false; + + // Add the post categories. + $this->add_post_terms( $post_id, trim( $tag, '%' ) ); + } + } + } + } }
\ No newline at end of file diff --git a/inc/addons/breadcrumbs/class-astra-breadcrumbs-loader.php b/inc/addons/breadcrumbs/class-astra-breadcrumbs-loader.php index ddf3377..e7586ff 100644 --- a/inc/addons/breadcrumbs/class-astra-breadcrumbs-loader.php +++ b/inc/addons/breadcrumbs/class-astra-breadcrumbs-loader.php @@ -1,190 +1,190 @@ -<?php
-/**
- * Breadcrumbs Loader for Astra theme.
- *
- * @package Astra
- * @author Brainstorm Force
- * @copyright Copyright (c) 2020, Brainstorm Force
- * @link https://www.brainstormforce.com
- * @since Astra 1.7.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-if ( ! class_exists( 'Astra_Breadcrumbs_Loader' ) ) {
-
- /**
- * Customizer Initialization
- *
- * @since 1.7.0
- */
- class Astra_Breadcrumbs_Loader {
-
- /**
- * Member Variable
- *
- * @var instance
- */
- private static $instance;
-
- /**
- * Initiator
- */
- public static function get_instance() {
- if ( ! isset( self::$instance ) ) {
- self::$instance = new self();
- }
- return self::$instance;
- }
-
- /**
- * Constructor
- */
- public function __construct() {
-
- add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) );
- add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 );
- add_action( 'customize_register', array( $this, 'customize_register' ), 2 );
- // Load Google fonts.
- add_action( 'astra_get_fonts', array( $this, 'add_fonts' ), 1 );
- }
-
- /**
- * Enqueue google fonts.
- *
- * @return void
- */
- public function add_fonts() {
- $breadcrumb_font_family = astra_get_option( 'breadcrumb-font-family' );
- $breadcrumb_font_weight = astra_get_option( 'breadcrumb-font-weight' );
- Astra_Fonts::add_font( $breadcrumb_font_family, $breadcrumb_font_weight );
- }
-
- /**
- * Set Options Default Values
- *
- * @param array $defaults Astra options default value array.
- * @return array
- */
- public function theme_defaults( $defaults ) {
-
- /**
- * Breadcrumb Typography
- */
- $defaults['breadcrumb-font-family'] = 'inherit';
- $defaults['breadcrumb-font-weight'] = 'inherit';
- $defaults['breadcrumb-text-transform'] = 'inherit';
-
- /**
- * Breadcrumb Responsive Colors
- */
- $defaults['breadcrumb-text-color-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['breadcrumb-active-color-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['breadcrumb-hover-color-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['breadcrumb-separator-color'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['breadcrumb-bg-color'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['breadcrumb-spacing'] = array(
- 'desktop' => array(
- 'top' => '',
- 'right' => '',
- 'bottom' => '',
- 'left' => '',
- ),
- 'tablet' => array(
- 'top' => '',
- 'right' => '',
- 'bottom' => '',
- 'left' => '',
- ),
- 'mobile' => array(
- 'top' => '',
- 'right' => '',
- 'bottom' => '',
- 'left' => '',
- ),
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- );
-
- /**
- * Breadcrumb Font Defaults
- */
- $defaults['breadcrumb-font-family'] = 'inherit';
- $defaults['breadcrumb-font-weight'] = 'inherit';
- $defaults['breadcrumb-text-transform'] = '';
- $defaults['breadcrumb-font-size'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- );
-
- return $defaults;
- }
-
- /**
- * Add postMessage support for site title and description for the Theme Customizer.
- *
- * @param WP_Customize_Manager $wp_customize Theme Customizer object.
- */
- public function customize_register( $wp_customize ) {
-
- /**
- * Register Panel & Sections
- */
- // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
- require_once ASTRA_THEME_BREADCRUMBS_DIR . 'customizer/class-astra-breadcrumbs-configs.php';
- require_once ASTRA_THEME_BREADCRUMBS_DIR . 'customizer/class-astra-breadcrumbs-color-configs.php';
- require_once ASTRA_THEME_BREADCRUMBS_DIR . 'customizer/class-astra-breadcrumbs-typo-configs.php';
- // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
- }
-
- /**
- * Customizer Preview
- */
- public function preview_scripts() {
- /**
- * Load unminified if SCRIPT_DEBUG is true.
- */
- /* Directory and Extension */
- $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
- $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
- wp_enqueue_script( 'astra-breadcrumbs-customizer-preview-js', ASTRA_THEME_BREADCRUMBS_URI . 'assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true );
- }
- }
-}
-
-/**
-* Kicking this off by calling 'get_instance()' method
-*/
-Astra_Breadcrumbs_Loader::get_instance();
+<?php +/** + * Breadcrumbs Loader for Astra theme. + * + * @package Astra + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 1.7.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +if ( ! class_exists( 'Astra_Breadcrumbs_Loader' ) ) { + + /** + * Customizer Initialization + * + * @since 1.7.0 + */ + class Astra_Breadcrumbs_Loader { + + /** + * Member Variable + * + * @var instance + */ + private static $instance; + + /** + * Initiator + */ + public static function get_instance() { + if ( ! isset( self::$instance ) ) { + self::$instance = new self(); + } + return self::$instance; + } + + /** + * Constructor + */ + public function __construct() { + + add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); + add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); + add_action( 'customize_register', array( $this, 'customize_register' ), 2 ); + // Load Google fonts. + add_action( 'astra_get_fonts', array( $this, 'add_fonts' ), 1 ); + } + + /** + * Enqueue google fonts. + * + * @return void + */ + public function add_fonts() { + $breadcrumb_font_family = astra_get_option( 'breadcrumb-font-family' ); + $breadcrumb_font_weight = astra_get_option( 'breadcrumb-font-weight' ); + Astra_Fonts::add_font( $breadcrumb_font_family, $breadcrumb_font_weight ); + } + + /** + * Set Options Default Values + * + * @param array $defaults Astra options default value array. + * @return array + */ + public function theme_defaults( $defaults ) { + + /** + * Breadcrumb Typography + */ + $defaults['breadcrumb-font-family'] = 'inherit'; + $defaults['breadcrumb-font-weight'] = 'inherit'; + $defaults['breadcrumb-text-transform'] = 'inherit'; + + /** + * Breadcrumb Responsive Colors + */ + $defaults['breadcrumb-text-color-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['breadcrumb-active-color-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['breadcrumb-hover-color-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['breadcrumb-separator-color'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['breadcrumb-bg-color'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['breadcrumb-spacing'] = array( + 'desktop' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + 'tablet' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + 'mobile' => array( + 'top' => '', + 'right' => '', + 'bottom' => '', + 'left' => '', + ), + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ); + + /** + * Breadcrumb Font Defaults + */ + $defaults['breadcrumb-font-family'] = 'inherit'; + $defaults['breadcrumb-font-weight'] = 'inherit'; + $defaults['breadcrumb-text-transform'] = ''; + $defaults['breadcrumb-font-size'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ); + + return $defaults; + } + + /** + * Add postMessage support for site title and description for the Theme Customizer. + * + * @param WP_Customize_Manager $wp_customize Theme Customizer object. + */ + public function customize_register( $wp_customize ) { + + /** + * Register Panel & Sections + */ + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require_once ASTRA_THEME_BREADCRUMBS_DIR . 'customizer/class-astra-breadcrumbs-configs.php'; + require_once ASTRA_THEME_BREADCRUMBS_DIR . 'customizer/class-astra-breadcrumbs-color-configs.php'; + require_once ASTRA_THEME_BREADCRUMBS_DIR . 'customizer/class-astra-breadcrumbs-typo-configs.php'; + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + + /** + * Customizer Preview + */ + public function preview_scripts() { + /** + * Load unminified if SCRIPT_DEBUG is true. + */ + /* Directory and Extension */ + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_script( 'astra-breadcrumbs-customizer-preview-js', ASTRA_THEME_BREADCRUMBS_URI . 'assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); + } + } +} + +/** +* Kicking this off by calling 'get_instance()' method +*/ +Astra_Breadcrumbs_Loader::get_instance(); diff --git a/inc/addons/breadcrumbs/class-astra-breadcrumbs-markup.php b/inc/addons/breadcrumbs/class-astra-breadcrumbs-markup.php index e5285a3..a689037 100644 --- a/inc/addons/breadcrumbs/class-astra-breadcrumbs-markup.php +++ b/inc/addons/breadcrumbs/class-astra-breadcrumbs-markup.php @@ -1,157 +1,157 @@ -<?php
-/**
- * Breadcrumbs for Astra theme.
- *
- * @package Astra
- * @author Brainstorm Force
- * @copyright Copyright (c) 2020, Brainstorm Force
- * @link https://www.brainstormforce.com
- * @since Astra 1.8.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-if ( ! class_exists( 'Astra_Breadcrumbs_Markup' ) ) {
-
- /**
- * Breadcrumbs Markup Initial Setup
- *
- * @since 1.8.0
- */
- class Astra_Breadcrumbs_Markup {
-
- /**
- * Member Variable
- *
- * @var object instance
- */
- private static $instance;
-
- /**
- * Initiator
- */
- public static function get_instance() {
- if ( ! isset( self::$instance ) ) {
- self::$instance = new self();
- }
- return self::$instance;
- }
-
- /**
- * Constructor
- */
- public function __construct() {
-
- add_action( 'wp', array( $this, 'astra_breadcumb_template' ) );
- }
-
- /**
- * Astra Breadcrumbs Template
- *
- * Loads template based on the style option selected in options panel for Breadcrumbs.
- *
- * @since 1.8.0
- *
- * @return void
- */
- public function astra_breadcumb_template() {
-
- $breadcrumb_position = astra_get_option( 'breadcrumb-position' );
-
- $breadcrumb_enabled = false;
-
- if ( is_singular() ) {
- $breadcrumb_enabled = get_post_meta( get_the_ID(), 'ast-breadcrumbs-content', true );
- }
-
- if ( 'disabled' !== $breadcrumb_enabled && $breadcrumb_position && 'none' !== $breadcrumb_position && ! ( ( is_home() || is_front_page() ) && ( 'astra_entry_top' === $breadcrumb_position ) ) ) {
- if ( self::astra_breadcrumb_rules() ) {
- if ( ( is_archive() || is_search() ) && 'astra_entry_top' === $breadcrumb_position ) {
- add_action( 'astra_before_archive_title', array( $this, 'astra_hook_breadcrumb_position' ), 15 );
- } else {
- add_action( $breadcrumb_position, array( $this, 'astra_hook_breadcrumb_position' ), 15 );
- }
- }
- }
- }
-
- /**
- * Astra Hook Breadcrumb Position
- *
- * Hook breadcrumb to position of selected option
- *
- * @since 1.8.0
- *
- * @return void
- */
- public function astra_hook_breadcrumb_position() {
- $breadcrumb_position = astra_get_option( 'breadcrumb-position' );
-
- if ( $breadcrumb_position && ( 'astra_header_markup_after' === $breadcrumb_position || 'astra_header_after' === $breadcrumb_position ) ) {
- echo '<div class="main-header-bar ast-header-breadcrumb">
- <div class="ast-container">';
- }
- astra_get_breadcrumb();
- if ( $breadcrumb_position && ( 'astra_header_markup_after' === $breadcrumb_position || 'astra_header_after' === $breadcrumb_position ) ) {
- echo ' </div>
- </div>';
- }
- }
-
- /**
- * Astra Breadcrumbs Rules
- *
- * Checks the rules defined for displaying Breadcrumb on different pages.
- *
- * @since 1.8.0
- *
- * @return boolean
- */
- public static function astra_breadcrumb_rules() {
-
- // Display Breadcrumb default true.
- $display_breadcrumb = true;
-
- if ( is_front_page() && '1' == astra_get_option( 'breadcrumb-disable-home-page' ) ) {
- $display_breadcrumb = false;
- }
-
- if ( is_home() && '1' == astra_get_option( 'breadcrumb-disable-blog-posts-page' ) ) {
- $display_breadcrumb = false;
- }
-
- if ( is_search() && '1' == astra_get_option( 'breadcrumb-disable-search' ) ) {
- $display_breadcrumb = false;
- }
-
- if ( ( is_archive() ) && '1' == astra_get_option( 'breadcrumb-disable-archive' ) ) {
- $display_breadcrumb = false;
- }
-
- if ( is_page() && '1' == astra_get_option( 'breadcrumb-disable-single-page' ) ) {
- $display_breadcrumb = false;
- }
-
- if ( is_single() && '1' == astra_get_option( 'breadcrumb-disable-single-post' ) ) {
- $display_breadcrumb = false;
- }
-
- if ( is_singular() && '1' == astra_get_option( 'breadcrumb-disable-singular' ) ) {
- $display_breadcrumb = false;
- }
-
- if ( is_404() && '1' == astra_get_option( 'breadcrumb-disable-404-page' ) ) {
- $display_breadcrumb = false;
- }
-
- return apply_filters( 'astra_breadcrumb_enabled', $display_breadcrumb );
- }
- }
-}
-
-/**
-* Kicking this off by calling 'get_instance()' method
-*/
-Astra_Breadcrumbs_Markup::get_instance();
+<?php +/** + * Breadcrumbs for Astra theme. + * + * @package Astra + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 1.8.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +if ( ! class_exists( 'Astra_Breadcrumbs_Markup' ) ) { + + /** + * Breadcrumbs Markup Initial Setup + * + * @since 1.8.0 + */ + class Astra_Breadcrumbs_Markup { + + /** + * Member Variable + * + * @var object instance + */ + private static $instance; + + /** + * Initiator + */ + public static function get_instance() { + if ( ! isset( self::$instance ) ) { + self::$instance = new self(); + } + return self::$instance; + } + + /** + * Constructor + */ + public function __construct() { + + add_action( 'wp', array( $this, 'astra_breadcumb_template' ) ); + } + + /** + * Astra Breadcrumbs Template + * + * Loads template based on the style option selected in options panel for Breadcrumbs. + * + * @since 1.8.0 + * + * @return void + */ + public function astra_breadcumb_template() { + + $breadcrumb_position = astra_get_option( 'breadcrumb-position' ); + + $breadcrumb_enabled = false; + + if ( is_singular() ) { + $breadcrumb_enabled = get_post_meta( get_the_ID(), 'ast-breadcrumbs-content', true ); + } + + if ( 'disabled' !== $breadcrumb_enabled && $breadcrumb_position && 'none' !== $breadcrumb_position && ! ( ( is_home() || is_front_page() ) && ( 'astra_entry_top' === $breadcrumb_position ) ) ) { + if ( self::astra_breadcrumb_rules() ) { + if ( ( is_archive() || is_search() ) && 'astra_entry_top' === $breadcrumb_position ) { + add_action( 'astra_before_archive_title', array( $this, 'astra_hook_breadcrumb_position' ), 15 ); + } else { + add_action( $breadcrumb_position, array( $this, 'astra_hook_breadcrumb_position' ), 15 ); + } + } + } + } + + /** + * Astra Hook Breadcrumb Position + * + * Hook breadcrumb to position of selected option + * + * @since 1.8.0 + * + * @return void + */ + public function astra_hook_breadcrumb_position() { + $breadcrumb_position = astra_get_option( 'breadcrumb-position' ); + + if ( $breadcrumb_position && ( 'astra_header_markup_after' === $breadcrumb_position || 'astra_header_after' === $breadcrumb_position ) ) { + echo '<div class="main-header-bar ast-header-breadcrumb"> + <div class="ast-container">'; + } + astra_get_breadcrumb(); + if ( $breadcrumb_position && ( 'astra_header_markup_after' === $breadcrumb_position || 'astra_header_after' === $breadcrumb_position ) ) { + echo ' </div> + </div>'; + } + } + + /** + * Astra Breadcrumbs Rules + * + * Checks the rules defined for displaying Breadcrumb on different pages. + * + * @since 1.8.0 + * + * @return boolean + */ + public static function astra_breadcrumb_rules() { + + // Display Breadcrumb default true. + $display_breadcrumb = true; + + if ( is_front_page() && '1' == astra_get_option( 'breadcrumb-disable-home-page' ) ) { + $display_breadcrumb = false; + } + + if ( is_home() && '1' == astra_get_option( 'breadcrumb-disable-blog-posts-page' ) ) { + $display_breadcrumb = false; + } + + if ( is_search() && '1' == astra_get_option( 'breadcrumb-disable-search' ) ) { + $display_breadcrumb = false; + } + + if ( ( is_archive() ) && '1' == astra_get_option( 'breadcrumb-disable-archive' ) ) { + $display_breadcrumb = false; + } + + if ( is_page() && '1' == astra_get_option( 'breadcrumb-disable-single-page' ) ) { + $display_breadcrumb = false; + } + + if ( is_single() && '1' == astra_get_option( 'breadcrumb-disable-single-post' ) ) { + $display_breadcrumb = false; + } + + if ( is_singular() && '1' == astra_get_option( 'breadcrumb-disable-singular' ) ) { + $display_breadcrumb = false; + } + + if ( is_404() && '1' == astra_get_option( 'breadcrumb-disable-404-page' ) ) { + $display_breadcrumb = false; + } + + return apply_filters( 'astra_breadcrumb_enabled', $display_breadcrumb ); + } + } +} + +/** +* Kicking this off by calling 'get_instance()' method +*/ +Astra_Breadcrumbs_Markup::get_instance(); diff --git a/inc/addons/breadcrumbs/class-astra-breadcrumbs.php b/inc/addons/breadcrumbs/class-astra-breadcrumbs.php index 4a7b00f..5269f65 100644 --- a/inc/addons/breadcrumbs/class-astra-breadcrumbs.php +++ b/inc/addons/breadcrumbs/class-astra-breadcrumbs.php @@ -1,105 +1,105 @@ -<?php
-/**
- * Breadcrumbs for Astra theme.
- *
- * @package Astra
- * @author Brainstorm Force
- * @copyright Copyright (c) 2020, Brainstorm Force
- * @link https://www.brainstormforce.com
- * @since Astra 1.7.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-define( 'ASTRA_THEME_BREADCRUMBS_DIR', ASTRA_THEME_DIR . 'inc/addons/breadcrumbs/' );
-define( 'ASTRA_THEME_BREADCRUMBS_URI', ASTRA_THEME_URI . 'inc/addons/breadcrumbs/' );
-
-if ( ! class_exists( 'Astra_Breadcrumbs' ) ) {
-
- /**
- * Breadcrumbs Initial Setup
- *
- * @since 1.7.0
- */
- class Astra_Breadcrumbs {
-
- /**
- * Member Variable
- *
- * @var instance
- */
- private static $instance;
-
- /**
- * Initiator
- */
- public static function get_instance() {
- if ( ! isset( self::$instance ) ) {
- self::$instance = new self();
- }
- return self::$instance;
- }
-
- /**
- * Constructor function that initializes required actions and hooks
- */
- public function __construct() {
-
- // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
- require_once ASTRA_THEME_BREADCRUMBS_DIR . 'class-astra-breadcrumbs-loader.php';
- require_once ASTRA_THEME_BREADCRUMBS_DIR . 'class-astra-breadcrumbs-markup.php';
- require_once ASTRA_THEME_BREADCRUMBS_DIR . 'class-astra-breadcrumb-trail.php';
- // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
-
- // Third Party plugins in the breadcrumb options.
- add_filter( 'astra_breadcrumb_source_list', array( $this, 'astra_breadcrumb_source_list_items' ) );
-
- // Include front end files.
- if ( ! is_admin() ) {
- require_once ASTRA_THEME_BREADCRUMBS_DIR . 'dynamic-css/dynamic.css.php';// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
- }
- }
-
- /**
- * Third Party Breadcrumb option
- *
- * @param Array $options breadcrumb options array.
- *
- * @return Array breadcrumb options array.
- * @since 1.0.0
- */
- public function astra_breadcrumb_source_list_items( $options ) {
-
- $breadcrumb_enable = is_callable( 'WPSEO_Options::get' ) ? WPSEO_Options::get( 'breadcrumbs-enable' ) : false;
- $wpseo_option = get_option( 'wpseo_internallinks' ) ? get_option( 'wpseo_internallinks' ) : $breadcrumb_enable;
- if ( ! is_array( $wpseo_option ) ) {
- unset( $wpseo_option );
- $wpseo_option = array(
- 'breadcrumbs-enable' => $breadcrumb_enable,
- );
- }
-
- if ( function_exists( 'yoast_breadcrumb' ) && true === $wpseo_option['breadcrumbs-enable'] ) {
- $options['yoast-seo-breadcrumbs'] = 'Yoast SEO Breadcrumbs';
- }
-
- if ( function_exists( 'bcn_display' ) ) {
- $options['breadcrumb-navxt'] = 'Breadcrumb NavXT';
- }
-
- if ( function_exists( 'rank_math_the_breadcrumbs' ) ) {
- $options['rank-math'] = 'Rank Math';
- }
-
- return $options;
- }
- }
-
- /**
- * Kicking this off by calling 'get_instance()' method
- */
- Astra_Breadcrumbs::get_instance();
-
-}
+<?php +/** + * Breadcrumbs for Astra theme. + * + * @package Astra + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 1.7.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +define( 'ASTRA_THEME_BREADCRUMBS_DIR', ASTRA_THEME_DIR . 'inc/addons/breadcrumbs/' ); +define( 'ASTRA_THEME_BREADCRUMBS_URI', ASTRA_THEME_URI . 'inc/addons/breadcrumbs/' ); + +if ( ! class_exists( 'Astra_Breadcrumbs' ) ) { + + /** + * Breadcrumbs Initial Setup + * + * @since 1.7.0 + */ + class Astra_Breadcrumbs { + + /** + * Member Variable + * + * @var instance + */ + private static $instance; + + /** + * Initiator + */ + public static function get_instance() { + if ( ! isset( self::$instance ) ) { + self::$instance = new self(); + } + return self::$instance; + } + + /** + * Constructor function that initializes required actions and hooks + */ + public function __construct() { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require_once ASTRA_THEME_BREADCRUMBS_DIR . 'class-astra-breadcrumbs-loader.php'; + require_once ASTRA_THEME_BREADCRUMBS_DIR . 'class-astra-breadcrumbs-markup.php'; + require_once ASTRA_THEME_BREADCRUMBS_DIR . 'class-astra-breadcrumb-trail.php'; + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + + // Third Party plugins in the breadcrumb options. + add_filter( 'astra_breadcrumb_source_list', array( $this, 'astra_breadcrumb_source_list_items' ) ); + + // Include front end files. + if ( ! is_admin() ) { + require_once ASTRA_THEME_BREADCRUMBS_DIR . 'dynamic-css/dynamic.css.php';// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + } + + /** + * Third Party Breadcrumb option + * + * @param Array $options breadcrumb options array. + * + * @return Array breadcrumb options array. + * @since 1.0.0 + */ + public function astra_breadcrumb_source_list_items( $options ) { + + $breadcrumb_enable = is_callable( 'WPSEO_Options::get' ) ? WPSEO_Options::get( 'breadcrumbs-enable' ) : false; + $wpseo_option = get_option( 'wpseo_internallinks' ) ? get_option( 'wpseo_internallinks' ) : $breadcrumb_enable; + if ( ! is_array( $wpseo_option ) ) { + unset( $wpseo_option ); + $wpseo_option = array( + 'breadcrumbs-enable' => $breadcrumb_enable, + ); + } + + if ( function_exists( 'yoast_breadcrumb' ) && true === $wpseo_option['breadcrumbs-enable'] ) { + $options['yoast-seo-breadcrumbs'] = 'Yoast SEO Breadcrumbs'; + } + + if ( function_exists( 'bcn_display' ) ) { + $options['breadcrumb-navxt'] = 'Breadcrumb NavXT'; + } + + if ( function_exists( 'rank_math_the_breadcrumbs' ) ) { + $options['rank-math'] = 'Rank Math'; + } + + return $options; + } + } + + /** + * Kicking this off by calling 'get_instance()' method + */ + Astra_Breadcrumbs::get_instance(); + +} diff --git a/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-color-configs.php b/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-color-configs.php index a5a2ddd..28a7272 100644 --- a/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-color-configs.php +++ b/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-color-configs.php @@ -1,206 +1,206 @@ -<?php
-/**
- * Colors - Breadcrumbs Options for theme.
- *
- * @package Astra
- * @author Brainstorm Force
- * @copyright Copyright (c) 2020, Brainstorm Force
- * @link https://www.brainstormforce.com
- * @since Astra 1.7.0
- */
-
-// Block direct access to the file.
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-// Bail if Customizer config base class does not exist.
-if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) {
- return;
-}
-
-/**
- * Customizer Sanitizes
- *
- * @since 1.7.0
- */
-if ( ! class_exists( 'Astra_Breadcrumbs_Color_Configs' ) ) {
-
- /**
- * Register Colors and Background - Breadcrumbs Options Customizer Configurations.
- */
- class Astra_Breadcrumbs_Color_Configs extends Astra_Customizer_Config_Base {
-
- /**
- * Register Colors and Background - Breadcrumbs Options Customizer Configurations.
- *
- * @param Array $configurations Astra Customizer Configurations.
- * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
- * @since 1.7.0
- * @return Array Astra Customizer Configurations with updated configurations.
- */
- public function register_configuration( $configurations, $wp_customize ) {
-
- $content_colors_control_title = __( 'Content', 'astra' );
-
- if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
- $content_colors_control_title = __( 'Content Colors', 'astra' );
- }
-
- $_configs = array(
-
- /*
- * Breadcrumb Color
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-bg-color]',
- 'type' => 'control',
- 'default' => astra_get_option( 'breadcrumb-bg-color' ),
- 'section' => 'section-breadcrumb',
- 'transport' => 'postMessage',
- 'control' => 'ast-responsive-color',
- 'title' => __( 'Background Color', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ?
- Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config,
- ),
- 'priority' => 72,
- ),
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-active-color-responsive]',
- 'default' => astra_get_option( 'breadcrumb-active-color-responsive' ),
- 'type' => 'control',
- 'section' => 'section-breadcrumb',
- 'transport' => 'postMessage',
- 'control' => 'ast-responsive-color',
- 'title' => __( 'Text Color', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ?
- Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config,
- ),
- 'priority' => 72,
- ),
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-separator-color]',
- 'default' => astra_get_option( 'breadcrumb-separator-color' ),
- 'type' => 'control',
- 'section' => 'section-breadcrumb',
- 'transport' => 'postMessage',
- 'control' => 'ast-responsive-color',
- 'title' => __( 'Separator Color', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ?
- Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config,
- ),
- 'priority' => 72,
- ),
-
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-link-color]',
- 'default' => astra_get_option( 'section-breadcrumb-color' ),
- 'type' => 'control',
- 'control' => 'ast-color-group',
- 'title' => __( 'Content Link Color', 'astra' ),
- 'section' => 'section-breadcrumb',
- 'transport' => 'postMessage',
- 'priority' => 72,
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ?
- Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config,
- ),
- 'responsive' => true,
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- array(
- 'name' => 'breadcrumb-text-color-responsive',
- 'default' => astra_get_option( 'breadcrumb-text-color-responsive' ),
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-link-color]',
- 'section' => 'section-breadcrumb',
- 'transport' => 'postMessage',
- 'tab' => __( 'Normal', 'astra' ),
- 'control' => 'ast-responsive-color',
- 'title' => __( 'Normal', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- 'priority' => 15,
- ),
-
- array(
- 'name' => 'breadcrumb-hover-color-responsive',
- 'default' => astra_get_option( 'breadcrumb-hover-color-responsive' ),
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-link-color]',
- 'section' => 'section-breadcrumb',
- 'transport' => 'postMessage',
- 'tab' => __( 'Hover', 'astra' ),
- 'control' => 'ast-responsive-color',
- 'title' => __( 'Hover', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- 'priority' => 20,
- ),
- );
-
- if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) {
- array_push(
- $_configs,
- /**
- * Option: Divider
- * Option: breadcrumb color Section divider
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-color-divider]',
- 'type' => 'control',
- 'control' => 'ast-heading',
- 'section' => 'section-breadcrumb',
- 'title' => __( 'Colors', 'astra' ),
- 'priority' => 71,
- 'settings' => array(),
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- Astra_Builder_Helper::$general_tab_config,
- ),
- )
- );
- }
- return array_merge( $configurations, $_configs );
- }
- }
-}
-
-/**
- * Kicking this off by calling 'get_instance()' method
- */
-new Astra_Breadcrumbs_Color_Configs();
+<?php +/** + * Colors - Breadcrumbs Options for theme. + * + * @package Astra + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 1.7.0 + */ + +// Block direct access to the file. +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +// Bail if Customizer config base class does not exist. +if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { + return; +} + +/** + * Customizer Sanitizes + * + * @since 1.7.0 + */ +if ( ! class_exists( 'Astra_Breadcrumbs_Color_Configs' ) ) { + + /** + * Register Colors and Background - Breadcrumbs Options Customizer Configurations. + */ + class Astra_Breadcrumbs_Color_Configs extends Astra_Customizer_Config_Base { + + /** + * Register Colors and Background - Breadcrumbs Options Customizer Configurations. + * + * @param Array $configurations Astra Customizer Configurations. + * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. + * @since 1.7.0 + * @return Array Astra Customizer Configurations with updated configurations. + */ + public function register_configuration( $configurations, $wp_customize ) { + + $content_colors_control_title = __( 'Content', 'astra' ); + + if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { + $content_colors_control_title = __( 'Content Colors', 'astra' ); + } + + $_configs = array( + + /* + * Breadcrumb Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-bg-color]', + 'type' => 'control', + 'default' => astra_get_option( 'breadcrumb-bg-color' ), + 'section' => 'section-breadcrumb', + 'transport' => 'postMessage', + 'control' => 'ast-responsive-color', + 'title' => __( 'Background Color', 'astra' ), + 'responsive' => true, + 'rgba' => true, + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? + Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config, + ), + 'priority' => 72, + ), + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-active-color-responsive]', + 'default' => astra_get_option( 'breadcrumb-active-color-responsive' ), + 'type' => 'control', + 'section' => 'section-breadcrumb', + 'transport' => 'postMessage', + 'control' => 'ast-responsive-color', + 'title' => __( 'Text Color', 'astra' ), + 'responsive' => true, + 'rgba' => true, + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? + Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config, + ), + 'priority' => 72, + ), + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-separator-color]', + 'default' => astra_get_option( 'breadcrumb-separator-color' ), + 'type' => 'control', + 'section' => 'section-breadcrumb', + 'transport' => 'postMessage', + 'control' => 'ast-responsive-color', + 'title' => __( 'Separator Color', 'astra' ), + 'responsive' => true, + 'rgba' => true, + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? + Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config, + ), + 'priority' => 72, + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-link-color]', + 'default' => astra_get_option( 'section-breadcrumb-color' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Content Link Color', 'astra' ), + 'section' => 'section-breadcrumb', + 'transport' => 'postMessage', + 'priority' => 72, + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? + Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config, + ), + 'responsive' => true, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + array( + 'name' => 'breadcrumb-text-color-responsive', + 'default' => astra_get_option( 'breadcrumb-text-color-responsive' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-link-color]', + 'section' => 'section-breadcrumb', + 'transport' => 'postMessage', + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-responsive-color', + 'title' => __( 'Normal', 'astra' ), + 'responsive' => true, + 'rgba' => true, + 'priority' => 15, + ), + + array( + 'name' => 'breadcrumb-hover-color-responsive', + 'default' => astra_get_option( 'breadcrumb-hover-color-responsive' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-link-color]', + 'section' => 'section-breadcrumb', + 'transport' => 'postMessage', + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-responsive-color', + 'title' => __( 'Hover', 'astra' ), + 'responsive' => true, + 'rgba' => true, + 'priority' => 20, + ), + ); + + if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) { + array_push( + $_configs, + /** + * Option: Divider + * Option: breadcrumb color Section divider + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-color-divider]', + 'type' => 'control', + 'control' => 'ast-heading', + 'section' => 'section-breadcrumb', + 'title' => __( 'Colors', 'astra' ), + 'priority' => 71, + 'settings' => array(), + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + Astra_Builder_Helper::$general_tab_config, + ), + ) + ); + } + return array_merge( $configurations, $_configs ); + } + } +} + +/** + * Kicking this off by calling 'get_instance()' method + */ +new Astra_Breadcrumbs_Color_Configs(); diff --git a/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-configs.php b/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-configs.php index e4f60a8..e1800dd 100644 --- a/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-configs.php +++ b/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-configs.php @@ -1,503 +1,503 @@ -<?php
-/**
- * Breadcrumbs Options for Astra theme.
- *
- * @package Astra
- * @author Brainstorm Force
- * @copyright Copyright (c) 2020, Brainstorm Force
- * @link https://www.brainstormforce.com
- * @since Astra 1.7.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-if ( ! class_exists( 'Astra_Breadcrumbs_Configs' ) ) {
-
- /**
- * Customizer Sanitizes Initial setup
- */
- class Astra_Breadcrumbs_Configs extends Astra_Customizer_Config_Base {
-
- /**
- * Register Astra-Breadcrumbs Settings.
- *
- * @param Array $configurations Astra Customizer Configurations.
- * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
- * @since 1.7.0
- * @return Array Astra Customizer Configurations with updated configurations.
- */
- public function register_configuration( $configurations, $wp_customize ) {
-
- $breadcrumb_source_list = apply_filters(
- 'astra_breadcrumb_source_list',
- array(
- 'default' => __( 'Default', 'astra' ),
- ),
- 'breadcrumb-list'
- );
-
- $_section = 'section-breadcrumb';
-
- $positions = array(
- 'none' => __( 'None', 'astra' ),
- 'astra_masthead_content' => __( 'Inside', 'astra' ),
- 'astra_header_markup_after' => __( 'After Header', 'astra' ),
- 'astra_entry_top' => __( 'Before Title', 'astra' ),
- );
-
- if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
- $positions = array(
- 'none' => __( 'None', 'astra' ),
- 'astra_header_primary_container_after' => __( 'Inside', 'astra' ),
- 'astra_header_after' => __( 'After', 'astra' ),
- 'astra_entry_top' => __( 'Before Title', 'astra' ),
- );
- }
-
- $_configs = array(
-
- /*
- * Breadcrumb
- */
- array(
- 'name' => $_section,
- 'type' => 'section',
- 'priority' => 20,
- 'title' => __( 'Breadcrumb', 'astra' ),
- 'description_hidden' => true,
- 'description' => $this->section_get_description(
- array(
- 'description' => '<p><b>' . __( 'Helpful Information', 'astra' ) . '</b></p>',
- 'links' => array(
- array(
- 'text' => __( 'Breadcrumb Overview', 'astra' ) . ' »',
- 'attrs' => array(
- 'href' => astra_get_pro_url( 'https://wpastra.com/docs/add-breadcrumbs-with-astra/', 'customizer', 'sidebar', 'helpful-information' ),
- ),
- ),
- ),
- )
- ),
- ),
-
- /**
- * Option: Breadcrumb Position
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'default' => astra_get_option( 'breadcrumb-position', 'none' ),
- 'section' => $_section,
- 'title' => __( 'Header Position', 'astra' ),
- 'type' => 'control',
- 'control' => 'ast-select',
- 'priority' => 5,
- 'choices' => $positions,
- 'partial' => array(
- 'selector' => '.ast-breadcrumbs-wrapper .ast-breadcrumbs .trail-items',
- 'container_inclusive' => false,
- ),
- 'context' => Astra_Builder_Helper::$general_tab,
- 'responsive' => false,
- 'renderAs' => 'text',
- ),
-
- /**
- * Option: Disable Breadcrumb on Categories
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-home-page]',
- 'default' => astra_get_option( 'breadcrumb-disable-home-page' ),
- 'type' => 'control',
- 'section' => $_section,
- 'title' => __( 'Disable on Home Page?', 'astra' ),
- 'priority' => 25,
- 'control' => 'ast-toggle-control',
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- Astra_Builder_Helper::$general_tab_config,
- ),
- 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-top-divider' ),
- ),
-
-
- /**
- * Option: Disable Breadcrumb on Categories
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-blog-posts-page]',
- 'default' => astra_get_option( 'breadcrumb-disable-blog-posts-page' ),
- 'type' => 'control',
- 'section' => $_section,
- 'description' => __( 'Latest posts page or when any page is selected as blog page', 'astra' ),
- 'title' => __( 'Disable on Blog / Posts Page?', 'astra' ),
- 'priority' => 25,
- 'control' => 'ast-toggle-control',
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- Astra_Builder_Helper::$general_tab_config,
- ),
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Disable Breadcrumb on Search
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-search]',
- 'default' => astra_get_option( 'breadcrumb-disable-search' ),
- 'type' => 'control',
- 'section' => $_section,
- 'title' => __( 'Disable on Search?', 'astra' ),
- 'priority' => 30,
- 'control' => 'ast-toggle-control',
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- Astra_Builder_Helper::$general_tab_config,
- ),
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Disable Breadcrumb on Archive
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-archive]',
- 'default' => astra_get_option( 'breadcrumb-disable-archive' ),
- 'type' => 'control',
- 'section' => $_section,
- 'title' => __( 'Disable on Archive?', 'astra' ),
- 'priority' => 35,
- 'control' => 'ast-toggle-control',
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- Astra_Builder_Helper::$general_tab_config,
- ),
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Disable Breadcrumb on Single Page
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-single-page]',
- 'default' => astra_get_option( 'breadcrumb-disable-single-page' ),
- 'type' => 'control',
- 'section' => $_section,
- 'title' => __( 'Disable on Single Page?', 'astra' ),
- 'priority' => 40,
- 'control' => 'ast-toggle-control',
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- Astra_Builder_Helper::$general_tab_config,
- ),
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Disable Breadcrumb on Single Post
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-single-post]',
- 'default' => astra_get_option( 'breadcrumb-disable-single-post' ),
- 'type' => 'control',
- 'section' => $_section,
- 'title' => __( 'Disable on Single Post?', 'astra' ),
- 'priority' => 45,
- 'control' => 'ast-toggle-control',
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- Astra_Builder_Helper::$general_tab_config,
- ),
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Disable Breadcrumb on Singular
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-singular]',
- 'default' => astra_get_option( 'breadcrumb-disable-singular' ),
- 'type' => 'control',
- 'section' => $_section,
- 'description' => __( 'All Pages, All Posts, All Attachments', 'astra' ),
- 'title' => __( 'Disable on Singular?', 'astra' ),
- 'priority' => 50,
- 'control' => 'ast-toggle-control',
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- Astra_Builder_Helper::$general_tab_config,
- ),
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Disable Breadcrumb on 404 Page
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-404-page]',
- 'default' => astra_get_option( 'breadcrumb-disable-404-page' ),
- 'type' => 'control',
- 'section' => $_section,
-
- 'title' => __( 'Disable on 404 Page?', 'astra' ),
- 'priority' => 55,
- 'control' => 'ast-toggle-control',
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- Astra_Builder_Helper::$general_tab_config,
- ),
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Breadcrumb Alignment
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-alignment]',
- 'default' => astra_get_option( 'breadcrumb-alignment', 'left' ),
- 'section' => $_section,
- 'transport' => 'postMessage',
- 'title' => __( 'Alignment', 'astra' ),
- 'type' => 'control',
- 'control' => 'ast-selector',
- 'priority' => 65,
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- Astra_Builder_Helper::$general_tab_config,
- ),
- 'choices' => array(
- 'left' => 'align-left',
- 'center' => 'align-center',
- 'right' => 'align-right',
- ),
- 'responsive' => false,
- ),
-
- /**
- * Option: Breadcrumb Spacing
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-spacing]',
- 'default' => astra_get_option( 'breadcrumb-spacing' ),
- 'type' => 'control',
- 'transport' => 'postMessage',
- 'control' => 'ast-responsive-spacing',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ),
- 'priority' => 83,
- 'title' => __( 'Spacing', 'astra' ),
- 'linked_choices' => true,
- 'unit_choices' => array( 'px', 'em', '%' ),
- 'choices' => array(
- 'top' => __( 'Top', 'astra' ),
- 'right' => __( 'Right', 'astra' ),
- 'bottom' => __( 'Bottom', 'astra' ),
- 'left' => __( 'Left', 'astra' ),
- ),
-
- 'section' => $_section,
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ?
- Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config,
- ),
- ),
- );
-
-
- if ( $this->is_third_party_breadcrumb_active() ) {
-
- $_configs[] = array(
- 'name' => ASTRA_THEME_SETTINGS . '[select-breadcrumb-source]',
- 'default' => astra_get_option( 'select-breadcrumb-source', 'default' ),
- 'section' => $_section,
- 'title' => __( 'Breadcrumb Source', 'astra' ),
- 'type' => 'control',
- 'control' => 'ast-select',
- 'priority' => 10,
- 'choices' => $breadcrumb_source_list,
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- Astra_Builder_Helper::$general_tab_config,
- ),
- 'divider' => array( 'ast_class' => 'ast-top-divider' ),
- );
- }
-
- if ( $this->is_selected_breadcrumb_active() ) {
-
- $_configs[] = array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-separator-divider]',
- 'type' => 'control',
- 'control' => 'ast-divider',
- 'section' => $_section,
- 'settings' => array(),
- 'priority' => 15,
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- Astra_Builder_Helper::$general_tab_config,
- ),
- );
- $_configs[] = array(
- 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-separator]',
- 'type' => 'control',
- 'control' => 'text',
- 'section' => $_section,
- 'default' => astra_get_option( 'breadcrumb-separator' ) ? astra_get_option( 'breadcrumb-separator' ) : '\00bb',
- 'priority' => 15,
- 'title' => __( 'Separator', 'astra' ),
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- Astra_Builder_Helper::$general_tab_config,
- ),
- 'transport' => 'postMessage',
- );
- }
-
- if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
-
- $_configs[] = array(
- 'name' => $_section . '-ast-context-tabs',
- 'section' => $_section,
- 'type' => 'control',
- 'control' => 'ast-builder-header-control',
- 'priority' => 0,
- 'description' => '',
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- ),
- );
-
- }
-
-
- return array_merge( $configurations, $_configs );
-
- }
-
- /**
- * Is third-party breadcrumb active.
- * Decide if the Source option should be visible depending on third party plugins.
- *
- * @return boolean True - If the option should be displayed, False - If the option should be hidden.
- */
- public function is_third_party_breadcrumb_active() {
-
- // Check if breadcrumb is turned on from WPSEO option.
- $breadcrumb_enable = is_callable( 'WPSEO_Options::get' ) ? WPSEO_Options::get( 'breadcrumbs-enable' ) : false;
- $wpseo_option = get_option( 'wpseo_internallinks' ) ? get_option( 'wpseo_internallinks' ) : $breadcrumb_enable;
- if ( ! is_array( $wpseo_option ) ) {
- unset( $wpseo_option );
- $wpseo_option = array(
- 'breadcrumbs-enable' => $breadcrumb_enable,
- );
- }
-
- if ( function_exists( 'yoast_breadcrumb' ) && true === $wpseo_option['breadcrumbs-enable'] ) {
- // Check if breadcrumb is turned on from SEO Yoast plugin.
- return true;
- } elseif ( function_exists( 'bcn_display' ) ) {
- // Check if breadcrumb is turned on from Breadcrumb NavXT plugin.
- return true;
- } elseif ( function_exists( 'rank_math_the_breadcrumbs' ) ) {
- // Check if breadcrumb is turned on from Rank Math plugin.
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Is selected third-party breadcrumb active.
- * Decide if the Separator option should be visible depending on third party plugins.
- *
- * @return boolean True - If the option should be displayed, False - If the option should be hidden.
- */
- public function is_selected_breadcrumb_active() {
-
- // Check if breadcrumb is turned on from WPSEO option.
- $selected_breadcrumb_source = astra_get_option( 'select-breadcrumb-source' );
- $breadcrumb_enable = is_callable( 'WPSEO_Options::get' ) ? WPSEO_Options::get( 'breadcrumbs-enable' ) : false;
- $wpseo_option = get_option( 'wpseo_internallinks' ) ? get_option( 'wpseo_internallinks' ) : $breadcrumb_enable;
- if ( ! is_array( $wpseo_option ) ) {
-
- unset( $wpseo_option );
- $wpseo_option = array(
- 'breadcrumbs-enable' => $breadcrumb_enable,
- );
- }
-
- if ( function_exists( 'yoast_breadcrumb' ) && true === $wpseo_option['breadcrumbs-enable'] && 'yoast-seo-breadcrumbs' === $selected_breadcrumb_source ) {
- // Check if breadcrumb is turned on from SEO Yoast plugin.
- return false;
- } elseif ( function_exists( 'bcn_display' ) && 'breadcrumb-navxt' === $selected_breadcrumb_source ) {
- // Check if breadcrumb is turned on from Breadcrumb NavXT plugin.
- return false;
- } elseif ( function_exists( 'rank_math_the_breadcrumbs' ) && 'rank-math' === $selected_breadcrumb_source ) {
- // Check if breadcrumb is turned on from Rank Math plugin.
- return false;
- } else {
- return true;
- }
- }
- }
-}
-
-new Astra_Breadcrumbs_Configs();
+<?php +/** + * Breadcrumbs Options for Astra theme. + * + * @package Astra + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 1.7.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +if ( ! class_exists( 'Astra_Breadcrumbs_Configs' ) ) { + + /** + * Customizer Sanitizes Initial setup + */ + class Astra_Breadcrumbs_Configs extends Astra_Customizer_Config_Base { + + /** + * Register Astra-Breadcrumbs Settings. + * + * @param Array $configurations Astra Customizer Configurations. + * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. + * @since 1.7.0 + * @return Array Astra Customizer Configurations with updated configurations. + */ + public function register_configuration( $configurations, $wp_customize ) { + + $breadcrumb_source_list = apply_filters( + 'astra_breadcrumb_source_list', + array( + 'default' => __( 'Default', 'astra' ), + ), + 'breadcrumb-list' + ); + + $_section = 'section-breadcrumb'; + + $positions = array( + 'none' => __( 'None', 'astra' ), + 'astra_masthead_content' => __( 'Inside', 'astra' ), + 'astra_header_markup_after' => __( 'After Header', 'astra' ), + 'astra_entry_top' => __( 'Before Title', 'astra' ), + ); + + if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { + $positions = array( + 'none' => __( 'None', 'astra' ), + 'astra_header_primary_container_after' => __( 'Inside', 'astra' ), + 'astra_header_after' => __( 'After', 'astra' ), + 'astra_entry_top' => __( 'Before Title', 'astra' ), + ); + } + + $_configs = array( + + /* + * Breadcrumb + */ + array( + 'name' => $_section, + 'type' => 'section', + 'priority' => 20, + 'title' => __( 'Breadcrumb', 'astra' ), + 'description_hidden' => true, + 'description' => $this->section_get_description( + array( + 'description' => '<p><b>' . __( 'Helpful Information', 'astra' ) . '</b></p>', + 'links' => array( + array( + 'text' => __( 'Breadcrumb Overview', 'astra' ) . ' »', + 'attrs' => array( + 'href' => astra_get_pro_url( 'https://wpastra.com/docs/add-breadcrumbs-with-astra/', 'customizer', 'sidebar', 'helpful-information' ), + ), + ), + ), + ) + ), + ), + + /** + * Option: Breadcrumb Position + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'default' => astra_get_option( 'breadcrumb-position', 'none' ), + 'section' => $_section, + 'title' => __( 'Header Position', 'astra' ), + 'type' => 'control', + 'control' => 'ast-select', + 'priority' => 5, + 'choices' => $positions, + 'partial' => array( + 'selector' => '.ast-breadcrumbs-wrapper .ast-breadcrumbs .trail-items', + 'container_inclusive' => false, + ), + 'context' => Astra_Builder_Helper::$general_tab, + 'responsive' => false, + 'renderAs' => 'text', + ), + + /** + * Option: Disable Breadcrumb on Categories + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-home-page]', + 'default' => astra_get_option( 'breadcrumb-disable-home-page' ), + 'type' => 'control', + 'section' => $_section, + 'title' => __( 'Disable on Home Page?', 'astra' ), + 'priority' => 25, + 'control' => 'ast-toggle-control', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + Astra_Builder_Helper::$general_tab_config, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-top-divider' ), + ), + + + /** + * Option: Disable Breadcrumb on Categories + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-blog-posts-page]', + 'default' => astra_get_option( 'breadcrumb-disable-blog-posts-page' ), + 'type' => 'control', + 'section' => $_section, + 'description' => __( 'Latest posts page or when any page is selected as blog page', 'astra' ), + 'title' => __( 'Disable on Blog / Posts Page?', 'astra' ), + 'priority' => 25, + 'control' => 'ast-toggle-control', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + Astra_Builder_Helper::$general_tab_config, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Disable Breadcrumb on Search + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-search]', + 'default' => astra_get_option( 'breadcrumb-disable-search' ), + 'type' => 'control', + 'section' => $_section, + 'title' => __( 'Disable on Search?', 'astra' ), + 'priority' => 30, + 'control' => 'ast-toggle-control', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + Astra_Builder_Helper::$general_tab_config, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Disable Breadcrumb on Archive + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-archive]', + 'default' => astra_get_option( 'breadcrumb-disable-archive' ), + 'type' => 'control', + 'section' => $_section, + 'title' => __( 'Disable on Archive?', 'astra' ), + 'priority' => 35, + 'control' => 'ast-toggle-control', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + Astra_Builder_Helper::$general_tab_config, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Disable Breadcrumb on Single Page + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-single-page]', + 'default' => astra_get_option( 'breadcrumb-disable-single-page' ), + 'type' => 'control', + 'section' => $_section, + 'title' => __( 'Disable on Single Page?', 'astra' ), + 'priority' => 40, + 'control' => 'ast-toggle-control', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + Astra_Builder_Helper::$general_tab_config, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Disable Breadcrumb on Single Post + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-single-post]', + 'default' => astra_get_option( 'breadcrumb-disable-single-post' ), + 'type' => 'control', + 'section' => $_section, + 'title' => __( 'Disable on Single Post?', 'astra' ), + 'priority' => 45, + 'control' => 'ast-toggle-control', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + Astra_Builder_Helper::$general_tab_config, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Disable Breadcrumb on Singular + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-singular]', + 'default' => astra_get_option( 'breadcrumb-disable-singular' ), + 'type' => 'control', + 'section' => $_section, + 'description' => __( 'All Pages, All Posts, All Attachments', 'astra' ), + 'title' => __( 'Disable on Singular?', 'astra' ), + 'priority' => 50, + 'control' => 'ast-toggle-control', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + Astra_Builder_Helper::$general_tab_config, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Disable Breadcrumb on 404 Page + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-disable-404-page]', + 'default' => astra_get_option( 'breadcrumb-disable-404-page' ), + 'type' => 'control', + 'section' => $_section, + + 'title' => __( 'Disable on 404 Page?', 'astra' ), + 'priority' => 55, + 'control' => 'ast-toggle-control', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + Astra_Builder_Helper::$general_tab_config, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Breadcrumb Alignment + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-alignment]', + 'default' => astra_get_option( 'breadcrumb-alignment', 'left' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'title' => __( 'Alignment', 'astra' ), + 'type' => 'control', + 'control' => 'ast-selector', + 'priority' => 65, + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + Astra_Builder_Helper::$general_tab_config, + ), + 'choices' => array( + 'left' => 'align-left', + 'center' => 'align-center', + 'right' => 'align-right', + ), + 'responsive' => false, + ), + + /** + * Option: Breadcrumb Spacing + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-spacing]', + 'default' => astra_get_option( 'breadcrumb-spacing' ), + 'type' => 'control', + 'transport' => 'postMessage', + 'control' => 'ast-responsive-spacing', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), + 'priority' => 83, + 'title' => __( 'Spacing', 'astra' ), + 'linked_choices' => true, + 'unit_choices' => array( 'px', 'em', '%' ), + 'choices' => array( + 'top' => __( 'Top', 'astra' ), + 'right' => __( 'Right', 'astra' ), + 'bottom' => __( 'Bottom', 'astra' ), + 'left' => __( 'Left', 'astra' ), + ), + + 'section' => $_section, + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? + Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config, + ), + ), + ); + + + if ( $this->is_third_party_breadcrumb_active() ) { + + $_configs[] = array( + 'name' => ASTRA_THEME_SETTINGS . '[select-breadcrumb-source]', + 'default' => astra_get_option( 'select-breadcrumb-source', 'default' ), + 'section' => $_section, + 'title' => __( 'Breadcrumb Source', 'astra' ), + 'type' => 'control', + 'control' => 'ast-select', + 'priority' => 10, + 'choices' => $breadcrumb_source_list, + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + Astra_Builder_Helper::$general_tab_config, + ), + 'divider' => array( 'ast_class' => 'ast-top-divider' ), + ); + } + + if ( $this->is_selected_breadcrumb_active() ) { + + $_configs[] = array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-separator-divider]', + 'type' => 'control', + 'control' => 'ast-divider', + 'section' => $_section, + 'settings' => array(), + 'priority' => 15, + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + Astra_Builder_Helper::$general_tab_config, + ), + ); + $_configs[] = array( + 'name' => ASTRA_THEME_SETTINGS . '[breadcrumb-separator]', + 'type' => 'control', + 'control' => 'text', + 'section' => $_section, + 'default' => astra_get_option( 'breadcrumb-separator' ) ? astra_get_option( 'breadcrumb-separator' ) : '\00bb', + 'priority' => 15, + 'title' => __( 'Separator', 'astra' ), + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + Astra_Builder_Helper::$general_tab_config, + ), + 'transport' => 'postMessage', + ); + } + + if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { + + $_configs[] = array( + 'name' => $_section . '-ast-context-tabs', + 'section' => $_section, + 'type' => 'control', + 'control' => 'ast-builder-header-control', + 'priority' => 0, + 'description' => '', + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + ), + ); + + } + + + return array_merge( $configurations, $_configs ); + + } + + /** + * Is third-party breadcrumb active. + * Decide if the Source option should be visible depending on third party plugins. + * + * @return boolean True - If the option should be displayed, False - If the option should be hidden. + */ + public function is_third_party_breadcrumb_active() { + + // Check if breadcrumb is turned on from WPSEO option. + $breadcrumb_enable = is_callable( 'WPSEO_Options::get' ) ? WPSEO_Options::get( 'breadcrumbs-enable' ) : false; + $wpseo_option = get_option( 'wpseo_internallinks' ) ? get_option( 'wpseo_internallinks' ) : $breadcrumb_enable; + if ( ! is_array( $wpseo_option ) ) { + unset( $wpseo_option ); + $wpseo_option = array( + 'breadcrumbs-enable' => $breadcrumb_enable, + ); + } + + if ( function_exists( 'yoast_breadcrumb' ) && true === $wpseo_option['breadcrumbs-enable'] ) { + // Check if breadcrumb is turned on from SEO Yoast plugin. + return true; + } elseif ( function_exists( 'bcn_display' ) ) { + // Check if breadcrumb is turned on from Breadcrumb NavXT plugin. + return true; + } elseif ( function_exists( 'rank_math_the_breadcrumbs' ) ) { + // Check if breadcrumb is turned on from Rank Math plugin. + return true; + } else { + return false; + } + } + + /** + * Is selected third-party breadcrumb active. + * Decide if the Separator option should be visible depending on third party plugins. + * + * @return boolean True - If the option should be displayed, False - If the option should be hidden. + */ + public function is_selected_breadcrumb_active() { + + // Check if breadcrumb is turned on from WPSEO option. + $selected_breadcrumb_source = astra_get_option( 'select-breadcrumb-source' ); + $breadcrumb_enable = is_callable( 'WPSEO_Options::get' ) ? WPSEO_Options::get( 'breadcrumbs-enable' ) : false; + $wpseo_option = get_option( 'wpseo_internallinks' ) ? get_option( 'wpseo_internallinks' ) : $breadcrumb_enable; + if ( ! is_array( $wpseo_option ) ) { + + unset( $wpseo_option ); + $wpseo_option = array( + 'breadcrumbs-enable' => $breadcrumb_enable, + ); + } + + if ( function_exists( 'yoast_breadcrumb' ) && true === $wpseo_option['breadcrumbs-enable'] && 'yoast-seo-breadcrumbs' === $selected_breadcrumb_source ) { + // Check if breadcrumb is turned on from SEO Yoast plugin. + return false; + } elseif ( function_exists( 'bcn_display' ) && 'breadcrumb-navxt' === $selected_breadcrumb_source ) { + // Check if breadcrumb is turned on from Breadcrumb NavXT plugin. + return false; + } elseif ( function_exists( 'rank_math_the_breadcrumbs' ) && 'rank-math' === $selected_breadcrumb_source ) { + // Check if breadcrumb is turned on from Rank Math plugin. + return false; + } else { + return true; + } + } + } +} + +new Astra_Breadcrumbs_Configs(); diff --git a/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-typo-configs.php b/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-typo-configs.php index 2afd280..51f879b 100644 --- a/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-typo-configs.php +++ b/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-typo-configs.php @@ -1,179 +1,179 @@ -<?php
-/**
- * Typography - Breadcrumbs Options for theme.
- *
- * @package Astra
- * @author Brainstorm Force
- * @copyright Copyright (c) 2020, Brainstorm Force
- * @link https://www.brainstormforce.com
- * @since Astra 1.7.0
- */
-
-// Block direct access to the file.
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-// Bail if Customizer config base class does not exist.
-if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) {
- return;
-}
-
-/**
- * Customizer Sanitizes
- *
- * @since 1.7.0
- */
-if ( ! class_exists( 'Astra_Breadcrumbs_Typo_Configs' ) ) {
-
- /**
- * Register Colors and Background - Breadcrumbs Options Customizer Configurations.
- */
- class Astra_Breadcrumbs_Typo_Configs extends Astra_Customizer_Config_Base {
-
- /**
- * Register Colors and Background - Breadcrumbs Options Customizer Configurations.
- *
- * @param Array $configurations Astra Customizer Configurations.
- * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
- * @since 1.7.0
- * @return Array Astra Customizer Configurations with updated configurations.
- */
- public function register_configuration( $configurations, $wp_customize ) {
-
- $_configs = array(
-
- /*
- * Breadcrumb Typography
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-typo]',
- 'default' => astra_get_option( 'section-breadcrumb-typo' ),
- 'type' => 'control',
- 'control' => 'ast-settings-group',
- 'title' => __( 'Content Font', 'astra' ),
- 'section' => 'section-breadcrumb',
- 'transport' => 'postMessage',
- 'priority' => 73,
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ?
- Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config,
- ),
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Font Family
- */
- array(
- 'name' => 'breadcrumb-font-family',
- 'default' => astra_get_option( 'breadcrumb-font-family' ),
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-typo]',
- 'section' => 'section-breadcrumb',
- 'control' => 'ast-font',
- 'font_type' => 'ast-font-family',
- 'title' => __( 'Family', 'astra' ),
- 'connect' => 'breadcrumb-font-weight',
- 'priority' => 5,
- ),
-
- /**
- * Option: Font Size
- */
- array(
- 'name' => 'breadcrumb-font-size',
- 'control' => 'ast-responsive',
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-typo]',
- 'section' => 'section-breadcrumb',
- 'default' => astra_get_option( 'breadcrumb-font-size' ),
- 'transport' => 'postMessage',
- 'title' => __( 'Size', 'astra' ),
- 'priority' => 10,
- 'input_attrs' => array(
- 'min' => 0,
- ),
- 'units' => array(
- 'px' => 'px',
- 'em' => 'em',
- ),
- ),
-
- /**
- * Option: Font Weight
- */
- array(
- 'name' => 'breadcrumb-font-weight',
- 'control' => 'ast-font',
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-typo]',
- 'section' => 'section-breadcrumb',
- 'font_type' => 'ast-font-weight',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ),
- 'default' => astra_get_option( 'breadcrumb-font-weight' ),
- 'title' => __( 'Weight', 'astra' ),
- 'connect' => 'breadcrumb-font-family',
- 'priority' => 15,
- ),
-
- /**
- * Option: Text Transform
- */
- array(
- 'name' => 'breadcrumb-text-transform',
- 'control' => 'ast-select',
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-typo]',
- 'section' => 'section-breadcrumb',
- 'default' => astra_get_option( 'breadcrumb-text-transform' ),
- 'title' => __( 'Text Transform', 'astra' ),
- 'transport' => 'postMessage',
- 'priority' => 20,
- 'choices' => array(
- '' => __( 'Inherit', 'astra' ),
- 'none' => __( 'None', 'astra' ),
- 'capitalize' => __( 'Capitalize', 'astra' ),
- 'uppercase' => __( 'Uppercase', 'astra' ),
- 'lowercase' => __( 'Lowercase', 'astra' ),
- ),
- ),
-
- /**
- * Option: Line Height
- */
- array(
- 'name' => 'breadcrumb-line-height',
- 'control' => 'ast-slider',
- 'transport' => 'postMessage',
- 'type' => 'sub-control',
- 'default' => astra_get_option( 'breadcrumb-line-height' ),
- 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-typo]',
- 'section' => 'section-breadcrumb',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ),
- 'title' => __( 'Line Height', 'astra' ),
- 'suffix' => 'em',
- 'priority' => 25,
- 'input_attrs' => array(
- 'min' => 1,
- 'step' => 0.01,
- 'max' => 5,
- ),
- ),
-
- );
-
- return array_merge( $configurations, $_configs );
- }
- }
-}
-
-/**
- * Kicking this off by calling 'get_instance()' method
- */
-new Astra_Breadcrumbs_Typo_Configs();
+<?php +/** + * Typography - Breadcrumbs Options for theme. + * + * @package Astra + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 1.7.0 + */ + +// Block direct access to the file. +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +// Bail if Customizer config base class does not exist. +if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { + return; +} + +/** + * Customizer Sanitizes + * + * @since 1.7.0 + */ +if ( ! class_exists( 'Astra_Breadcrumbs_Typo_Configs' ) ) { + + /** + * Register Colors and Background - Breadcrumbs Options Customizer Configurations. + */ + class Astra_Breadcrumbs_Typo_Configs extends Astra_Customizer_Config_Base { + + /** + * Register Colors and Background - Breadcrumbs Options Customizer Configurations. + * + * @param Array $configurations Astra Customizer Configurations. + * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. + * @since 1.7.0 + * @return Array Astra Customizer Configurations with updated configurations. + */ + public function register_configuration( $configurations, $wp_customize ) { + + $_configs = array( + + /* + * Breadcrumb Typography + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-typo]', + 'default' => astra_get_option( 'section-breadcrumb-typo' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Content Font', 'astra' ), + 'section' => 'section-breadcrumb', + 'transport' => 'postMessage', + 'priority' => 73, + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[breadcrumb-position]', + 'operator' => '!=', + 'value' => 'none', + ), + ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? + Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Font Family + */ + array( + 'name' => 'breadcrumb-font-family', + 'default' => astra_get_option( 'breadcrumb-font-family' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-typo]', + 'section' => 'section-breadcrumb', + 'control' => 'ast-font', + 'font_type' => 'ast-font-family', + 'title' => __( 'Family', 'astra' ), + 'connect' => 'breadcrumb-font-weight', + 'priority' => 5, + ), + + /** + * Option: Font Size + */ + array( + 'name' => 'breadcrumb-font-size', + 'control' => 'ast-responsive', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-typo]', + 'section' => 'section-breadcrumb', + 'default' => astra_get_option( 'breadcrumb-font-size' ), + 'transport' => 'postMessage', + 'title' => __( 'Size', 'astra' ), + 'priority' => 10, + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + + /** + * Option: Font Weight + */ + array( + 'name' => 'breadcrumb-font-weight', + 'control' => 'ast-font', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-typo]', + 'section' => 'section-breadcrumb', + 'font_type' => 'ast-font-weight', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), + 'default' => astra_get_option( 'breadcrumb-font-weight' ), + 'title' => __( 'Weight', 'astra' ), + 'connect' => 'breadcrumb-font-family', + 'priority' => 15, + ), + + /** + * Option: Text Transform + */ + array( + 'name' => 'breadcrumb-text-transform', + 'control' => 'ast-select', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-typo]', + 'section' => 'section-breadcrumb', + 'default' => astra_get_option( 'breadcrumb-text-transform' ), + 'title' => __( 'Text Transform', 'astra' ), + 'transport' => 'postMessage', + 'priority' => 20, + 'choices' => array( + '' => __( 'Inherit', 'astra' ), + 'none' => __( 'None', 'astra' ), + 'capitalize' => __( 'Capitalize', 'astra' ), + 'uppercase' => __( 'Uppercase', 'astra' ), + 'lowercase' => __( 'Lowercase', 'astra' ), + ), + ), + + /** + * Option: Line Height + */ + array( + 'name' => 'breadcrumb-line-height', + 'control' => 'ast-slider', + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'default' => astra_get_option( 'breadcrumb-line-height' ), + 'parent' => ASTRA_THEME_SETTINGS . '[section-breadcrumb-typo]', + 'section' => 'section-breadcrumb', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), + 'title' => __( 'Line Height', 'astra' ), + 'suffix' => 'em', + 'priority' => 25, + 'input_attrs' => array( + 'min' => 1, + 'step' => 0.01, + 'max' => 5, + ), + ), + + ); + + return array_merge( $configurations, $_configs ); + } + } +} + +/** + * Kicking this off by calling 'get_instance()' method + */ +new Astra_Breadcrumbs_Typo_Configs(); diff --git a/inc/addons/breadcrumbs/dynamic-css/dynamic.css.php b/inc/addons/breadcrumbs/dynamic-css/dynamic.css.php index 1aa68c9..23132a5 100644 --- a/inc/addons/breadcrumbs/dynamic-css/dynamic.css.php +++ b/inc/addons/breadcrumbs/dynamic-css/dynamic.css.php @@ -1,539 +1,539 @@ -<?php
-/**
- * Breadcrumbs - Dynamic CSS
- *
- * @package Astra
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-/**
- * Breadcrumbs
- */
-add_filter( 'astra_dynamic_theme_css', 'astra_breadcrumb_section_dynamic_css' );
-
-/**
- * Dynamic CSS
- *
- * @param string $dynamic_css Astra Dynamic CSS.
- * @param string $dynamic_css_filtered Astra Dynamic CSS Filters.
- * @return String Generated dynamic CSS for Breadcrumb.
- *
- * @since 1.7.0
- */
-function astra_breadcrumb_section_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) {
-
- $breadcrumb_position = astra_get_option( 'breadcrumb-position', 'none' );
-
- $dynamic_css .= astra_parse_css(
- array(
- '.ast-breadcrumbs .trail-browse, .ast-breadcrumbs .trail-items, .ast-breadcrumbs .trail-items li' => array(
- 'display' => 'inline-block',
- 'margin' => '0',
- 'padding' => '0',
- 'border' => 'none',
- 'background' => 'inherit',
- 'text-indent' => '0',
- ),
- '.ast-breadcrumbs .trail-browse' => array(
- 'font-size' => 'inherit',
- 'font-style' => 'inherit',
- 'font-weight' => 'inherit',
- 'color' => 'inherit',
- ),
- '.ast-breadcrumbs .trail-items' => array(
- 'list-style' => 'none',
- ),
- '.trail-items li::after' => array(
- 'padding' => '0 0.3em',
- 'content' => '"\00bb"',
- ),
- '.trail-items li:last-of-type::after' => array(
- 'display' => 'none',
- ),
- ),
- '',
- ''
- );
-
- if ( 'none' === $breadcrumb_position ) {
- return $dynamic_css;
- }
-
- /**
- * Set CSS Params
- */
-
- $default_color_array = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $breadcrumb_text_color = astra_get_option( 'breadcrumb-text-color-responsive', $default_color_array );
- $breadcrumb_active_color = astra_get_option( 'breadcrumb-active-color-responsive', $default_color_array );
- $breadcrumb_hover_color = astra_get_option( 'breadcrumb-hover-color-responsive', $default_color_array );
- $breadcrumb_separator_color = astra_get_option( 'breadcrumb-separator-color', $default_color_array );
- $breadcrumb_bg_color = astra_get_option( 'breadcrumb-bg-color', $default_color_array );
-
- $breadcrumb_font_family = astra_get_option( 'breadcrumb-font-family' );
- $breadcrumb_font_weight = astra_get_option( 'breadcrumb-font-weight' );
- $breadcrumb_font_size = astra_get_option( 'breadcrumb-font-size' );
- $breadcrumb_line_height = astra_get_option( 'breadcrumb-line-height' );
- $breadcrumb_text_transform = astra_get_option( 'breadcrumb-text-transform' );
-
- $breadcrumb_spacing = astra_get_option( 'breadcrumb-spacing' );
-
- $breadcrumb_alignment = astra_get_option( 'breadcrumb-alignment' );
-
- /**
- * Generate dynamic CSS based on the Breadcrumb Source option selected from the customizer.
- */
- $breadcrumb_source = astra_get_option( 'select-breadcrumb-source' );
-
- /**
- * Generate Dynamic CSS
- */
-
- $css = '';
- $breadcrumbs_default_css = array();
- $breadcrumb_enable = is_callable( 'WPSEO_Options::get' ) ? WPSEO_Options::get( 'breadcrumbs-enable' ) : false;
- $wpseo_option = get_option( 'wpseo_internallinks' ) ? get_option( 'wpseo_internallinks' ) : $breadcrumb_enable;
- if ( ! is_array( $wpseo_option ) ) {
- unset( $wpseo_option );
- $wpseo_option = array(
- 'breadcrumbs-enable' => $breadcrumb_enable,
- );
- }
-
- $css .= astra_parse_css(
- array(
- '.trail-items li::after' => array(
- 'content' => '"' . astra_get_option( 'breadcrumb-separator', '\00bb' ) . '"',
- ),
- ),
- '',
- ''
- );
-
- /**
- * Breadcrumb Colors & Typography
- */
- if ( function_exists( 'yoast_breadcrumb' ) && true === $wpseo_option['breadcrumbs-enable'] && $breadcrumb_source && 'yoast-seo-breadcrumbs' == $breadcrumb_source ) {
-
- /* Yoast SEO Breadcrumb CSS - Desktop */
- $breadcrumbs_desktop = array(
- '.ast-breadcrumbs-wrapper a' => array(
- 'color' => esc_attr( $breadcrumb_text_color['desktop'] ),
- ),
- '.ast-breadcrumbs-wrapper .breadcrumb_last' => array(
- 'color' => esc_attr( $breadcrumb_active_color['desktop'] ),
- ),
- '.ast-breadcrumbs-wrapper a:hover' => array(
- 'color' => esc_attr( $breadcrumb_hover_color['desktop'] ),
- ),
- '.ast-breadcrumbs-wrapper span' => array(
- 'color' => esc_attr( $breadcrumb_separator_color['desktop'] ),
- ),
-
- '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span' => array(
- 'font-family' => astra_get_font_family( $breadcrumb_font_family ),
- 'font-weight' => esc_attr( $breadcrumb_font_weight ),
- 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'desktop' ),
- 'line-height' => esc_attr( $breadcrumb_line_height ),
- 'text-transform' => esc_attr( $breadcrumb_text_transform ),
- ),
- );
-
- /* Yoast SEO Breadcrumb CSS - Tablet */
- $breadcrumbs_tablet = array(
- '.ast-breadcrumbs-wrapper a' => array(
- 'color' => esc_attr( $breadcrumb_text_color['tablet'] ),
- ),
- '.ast-breadcrumbs-wrapper .breadcrumb_last' => array(
- 'color' => esc_attr( $breadcrumb_active_color['tablet'] ),
- ),
- '.ast-breadcrumbs-wrapper a:hover' => array(
- 'color' => esc_attr( $breadcrumb_hover_color['tablet'] ),
- ),
- '.ast-breadcrumbs-wrapper span' => array(
- 'color' => esc_attr( $breadcrumb_separator_color['tablet'] ),
- ),
-
- '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span' => array(
- 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'tablet' ),
- ),
- );
-
- /* Yoast SEO Breadcrumb CSS - Mobile */
- $breadcrumbs_mobile = array(
- '.ast-breadcrumbs-wrapper a' => array(
- 'color' => esc_attr( $breadcrumb_text_color['mobile'] ),
- ),
- '.ast-breadcrumbs-wrapper .breadcrumb_last' => array(
- 'color' => esc_attr( $breadcrumb_active_color['mobile'] ),
- ),
- '.ast-breadcrumbs-wrapper a:hover' => array(
- 'color' => esc_attr( $breadcrumb_hover_color['mobile'] ),
- ),
- '.ast-breadcrumbs-wrapper span' => array(
- 'color' => esc_attr( $breadcrumb_separator_color['mobile'] ),
- ),
-
- '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span' => array(
- 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'mobile' ),
- ),
- );
- } elseif ( function_exists( 'bcn_display' ) && $breadcrumb_source && 'breadcrumb-navxt' == $breadcrumb_source ) {
-
- /* Breadcrumb NavXT CSS - Desktop */
- $breadcrumbs_desktop = array(
- '.ast-breadcrumbs-wrapper a' => array(
- 'color' => esc_attr( $breadcrumb_text_color['desktop'] ),
- ),
- '.ast-breadcrumbs-wrapper .current-item' => array(
- 'color' => esc_attr( $breadcrumb_active_color['desktop'] ),
- ),
- '.ast-breadcrumbs-wrapper a:hover' => array(
- 'color' => esc_attr( $breadcrumb_hover_color['desktop'] ),
- ),
- '.ast-breadcrumbs-wrapper .breadcrumbs' => array(
- 'color' => esc_attr( $breadcrumb_separator_color['desktop'] ),
- ),
-
- '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item' => array(
- 'font-family' => astra_get_font_family( $breadcrumb_font_family ),
- 'font-weight' => esc_attr( $breadcrumb_font_weight ),
- 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'desktop' ),
- 'line-height' => esc_attr( $breadcrumb_line_height ),
- 'text-transform' => esc_attr( $breadcrumb_text_transform ),
- ),
- );
-
- /* Breadcrumb NavXT CSS - Tablet */
- $breadcrumbs_tablet = array(
- '.ast-breadcrumbs-wrapper a' => array(
- 'color' => esc_attr( $breadcrumb_text_color['tablet'] ),
- ),
- '.ast-breadcrumbs-wrapper .current-item' => array(
- 'color' => esc_attr( $breadcrumb_active_color['tablet'] ),
- ),
- '.ast-breadcrumbs-wrapper a:hover' => array(
- 'color' => esc_attr( $breadcrumb_hover_color['tablet'] ),
- ),
- '.ast-breadcrumbs-wrapper .breadcrumbs' => array(
- 'color' => esc_attr( $breadcrumb_separator_color['tablet'] ),
- ),
-
- '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item' => array(
- 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'tablet' ),
- ),
- );
-
- /* Breadcrumb NavXT CSS - Mobile */
- $breadcrumbs_mobile = array(
- '.ast-breadcrumbs-wrapper a' => array(
- 'color' => esc_attr( $breadcrumb_text_color['mobile'] ),
- ),
- '.ast-breadcrumbs-wrapper .current-item' => array(
- 'color' => esc_attr( $breadcrumb_active_color['mobile'] ),
- ),
- '.ast-breadcrumbs-wrapper a:hover' => array(
- 'color' => esc_attr( $breadcrumb_hover_color['mobile'] ),
- ),
- '.ast-breadcrumbs-wrapper .breadcrumbs' => array(
- 'color' => esc_attr( $breadcrumb_separator_color['mobile'] ),
- ),
-
- '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item' => array(
- 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'mobile' ),
- ),
- );
- } elseif ( function_exists( 'rank_math_the_breadcrumbs' ) && $breadcrumb_source && 'rank-math' == $breadcrumb_source ) {
-
- /* Rank Math CSS - Desktop */
- $breadcrumbs_desktop = array(
- '.ast-breadcrumbs-wrapper a' => array(
- 'color' => esc_attr( $breadcrumb_text_color['desktop'] ),
- ),
- '.ast-breadcrumbs-wrapper .last' => array(
- 'color' => esc_attr( $breadcrumb_active_color['desktop'] ),
- ),
- '.ast-breadcrumbs-wrapper a:hover' => array(
- 'color' => esc_attr( $breadcrumb_hover_color['desktop'] ),
- ),
- '.ast-breadcrumbs-wrapper .separator' => array(
- 'color' => esc_attr( $breadcrumb_separator_color['desktop'] ),
- ),
-
- '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator' => array(
- 'font-family' => astra_get_font_family( $breadcrumb_font_family ),
- 'font-weight' => esc_attr( $breadcrumb_font_weight ),
- 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'desktop' ),
- 'line-height' => esc_attr( $breadcrumb_line_height ),
- 'text-transform' => esc_attr( $breadcrumb_text_transform ),
- ),
- );
-
- /* Rank Math CSS - Tablet */
- $breadcrumbs_tablet = array(
- '.ast-breadcrumbs-wrapper a' => array(
- 'color' => esc_attr( $breadcrumb_text_color['tablet'] ),
- ),
- '.ast-breadcrumbs-wrapper .last' => array(
- 'color' => esc_attr( $breadcrumb_active_color['tablet'] ),
- ),
- '.ast-breadcrumbs-wrapper a:hover' => array(
- 'color' => esc_attr( $breadcrumb_hover_color['tablet'] ),
- ),
- '.ast-breadcrumbs-wrapper .separator' => array(
- 'color' => esc_attr( $breadcrumb_separator_color['tablet'] ),
- ),
-
- '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator' => array(
- 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'tablet' ),
- ),
- );
-
- /* Rank Math CSS - Mobile */
- $breadcrumbs_mobile = array(
- '.ast-breadcrumbs-wrapper a' => array(
- 'color' => esc_attr( $breadcrumb_text_color['mobile'] ),
- ),
- '.ast-breadcrumbs-wrapper .last' => array(
- 'color' => esc_attr( $breadcrumb_active_color['mobile'] ),
- ),
- '.ast-breadcrumbs-wrapper a:hover' => array(
- 'color' => esc_attr( $breadcrumb_hover_color['mobile'] ),
- ),
- '.ast-breadcrumbs-wrapper .separator' => array(
- 'color' => esc_attr( $breadcrumb_separator_color['mobile'] ),
- ),
-
- '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator' => array(
- 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'mobile' ),
- ),
- );
- } else {
-
- /* Default Breadcrumb CSS - Desktop */
- $breadcrumbs_desktop = array(
- '.ast-breadcrumbs-wrapper .trail-items a' => array(
- 'color' => esc_attr( $breadcrumb_text_color['desktop'] ),
- ),
- '.ast-breadcrumbs-wrapper .trail-items .trail-end' => array(
- 'color' => esc_attr( $breadcrumb_active_color['desktop'] ),
- ),
- '.ast-breadcrumbs-wrapper .trail-items a:hover' => array(
- 'color' => esc_attr( $breadcrumb_hover_color['desktop'] ),
- ),
- '.ast-breadcrumbs-wrapper .trail-items li::after' => array(
- 'color' => esc_attr( $breadcrumb_separator_color['desktop'] ),
- ),
-
- '.ast-breadcrumbs-wrapper, .ast-breadcrumbs-wrapper a' => array(
- 'font-family' => astra_get_font_family( $breadcrumb_font_family ),
- 'font-weight' => esc_attr( $breadcrumb_font_weight ),
- 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'desktop' ),
- 'line-height' => esc_attr( $breadcrumb_line_height ),
- 'text-transform' => esc_attr( $breadcrumb_text_transform ),
- ),
- );
-
- /* Default Breadcrumb CSS - Tablet */
- $breadcrumbs_tablet = array(
- '.ast-breadcrumbs-wrapper .trail-items a' => array(
- 'color' => esc_attr( $breadcrumb_text_color['tablet'] ),
- ),
- '.ast-breadcrumbs-wrapper .trail-items .trail-end' => array(
- 'color' => esc_attr( $breadcrumb_active_color['tablet'] ),
- ),
- '.ast-breadcrumbs-wrapper .trail-items a:hover' => array(
- 'color' => esc_attr( $breadcrumb_hover_color['tablet'] ),
- ),
- '.ast-breadcrumbs-wrapper .trail-items li::after' => array(
- 'color' => esc_attr( $breadcrumb_separator_color['tablet'] ),
- ),
-
- '.ast-breadcrumbs-wrapper, .ast-breadcrumbs-wrapper a' => array(
- 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'tablet' ),
- ),
- );
-
- /* Default Breadcrumb CSS - Mobile */
- $breadcrumbs_mobile = array(
- '.ast-breadcrumbs-wrapper .trail-items a' => array(
- 'color' => esc_attr( $breadcrumb_text_color['mobile'] ),
- ),
- '.ast-breadcrumbs-wrapper .trail-items .trail-end' => array(
- 'color' => esc_attr( $breadcrumb_active_color['mobile'] ),
- ),
- '.ast-breadcrumbs-wrapper .trail-items a:hover' => array(
- 'color' => esc_attr( $breadcrumb_hover_color['mobile'] ),
- ),
-
- '.ast-breadcrumbs-wrapper .trail-items li::after' => array(
- 'color' => esc_attr( $breadcrumb_separator_color['mobile'] ),
- ),
-
- '.ast-breadcrumbs-wrapper, .ast-breadcrumbs-wrapper a' => array(
- 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'mobile' ),
- ),
- );
- }
-
- /* Breadcrumb CSS for Background Color */
- $breadcrumbs_desktop['.ast-breadcrumbs-wrapper, .main-header-bar.ast-header-breadcrumb'] = array(
- 'background-color' => esc_attr( $breadcrumb_bg_color['desktop'] ),
- );
- $breadcrumbs_tablet['.ast-breadcrumbs-wrapper, .main-header-bar.ast-header-breadcrumb'] = array(
- 'background-color' => esc_attr( $breadcrumb_bg_color['tablet'] ),
- );
- $breadcrumbs_mobile['.ast-breadcrumbs-wrapper, .main-header-bar.ast-header-breadcrumb'] = array(
- 'background-color' => esc_attr( $breadcrumb_bg_color['mobile'] ),
- );
-
- /* Breadcrumb CSS for Spacing */
- if ( 'astra_header_markup_after' === $breadcrumb_position || 'astra_header_after' === $breadcrumb_position ) {
- // After Header.
- $breadcrumbs_desktop['.main-header-bar.ast-header-breadcrumb, .ast-header-break-point .main-header-bar.ast-header-breadcrumb, .ast-header-break-point .header-main-layout-2 .main-header-bar.ast-header-breadcrumb, .ast-header-break-point .ast-mobile-header-stack .main-header-bar.ast-header-breadcrumb, .ast-default-menu-enable.ast-main-header-nav-open.ast-header-break-point .main-header-bar-wrap .main-header-bar.ast-header-breadcrumb, .ast-main-header-nav-open .main-header-bar-wrap .main-header-bar.ast-header-breadcrumb'] = array(
- 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'desktop' ),
- 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'desktop' ),
- 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'desktop' ),
- 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'desktop' ),
- );
- $breadcrumbs_tablet['.main-header-bar.ast-header-breadcrumb, .ast-header-break-point .main-header-bar.ast-header-breadcrumb, .ast-header-break-point .header-main-layout-2 .main-header-bar.ast-header-breadcrumb, .ast-header-break-point .ast-mobile-header-stack .main-header-bar.ast-header-breadcrumb, .ast-default-menu-enable.ast-main-header-nav-open.ast-header-break-point .main-header-bar-wrap .main-header-bar.ast-header-breadcrumb, .ast-main-header-nav-open .main-header-bar-wrap .main-header-bar.ast-header-breadcrumb'] = array(
- 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'tablet' ),
- 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'tablet' ),
- 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'tablet' ),
- 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'tablet' ),
- );
- $breadcrumbs_mobile['.main-header-bar.ast-header-breadcrumb, .ast-header-break-point .main-header-bar.ast-header-breadcrumb, .ast-header-break-point .header-main-layout-2 .main-header-bar.ast-header-breadcrumb, .ast-header-break-point .ast-mobile-header-stack .main-header-bar.ast-header-breadcrumb, .ast-default-menu-enable.ast-main-header-nav-open.ast-header-break-point .main-header-bar-wrap .main-header-bar.ast-header-breadcrumb, .ast-main-header-nav-open .main-header-bar-wrap .main-header-bar.ast-header-breadcrumb'] = array(
- 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'mobile' ),
- 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'mobile' ),
- 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'mobile' ),
- 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'mobile' ),
- );
- $breadcrumbs_default_css['.ast-header-breadcrumb'] = array(
- 'padding-top' => '10px',
- 'padding-bottom' => '10px',
- );
- } elseif ( 'astra_masthead_content' === $breadcrumb_position ) {
- // Inside Header.
- $breadcrumbs_desktop['.ast-breadcrumbs-wrapper .ast-breadcrumbs-inner #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .breadcrumbs, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .rank-math-breadcrumb'] = array(
- 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'desktop' ),
- 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'desktop' ),
- 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'desktop' ),
- 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'desktop' ),
- );
- $breadcrumbs_tablet['.ast-breadcrumbs-wrapper .ast-breadcrumbs-inner #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .breadcrumbs, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .rank-math-breadcrumb'] = array(
- 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'tablet' ),
- 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'tablet' ),
- 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'tablet' ),
- 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'tablet' ),
- );
- $breadcrumbs_mobile['.ast-breadcrumbs-wrapper .ast-breadcrumbs-inner #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .breadcrumbs, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .rank-math-breadcrumb'] = array(
- 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'mobile' ),
- 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'mobile' ),
- 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'mobile' ),
- 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'mobile' ),
- );
- $breadcrumbs_default_css['.ast-breadcrumbs-inner #ast-breadcrumbs-yoast, .ast-breadcrumbs-inner .breadcrumbs, .ast-breadcrumbs-inner .rank-math-breadcrumb'] = array(
- 'padding-bottom' => '10px',
- );
- $breadcrumbs_default_css['.ast-header-break-point .ast-breadcrumbs-wrapper'] = array(
- 'order' => '4',
- );
- } else {
- // Before Title.
- $breadcrumbs_desktop['.ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .rank-math-breadcrumb'] = array(
- 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'desktop' ),
- 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'desktop' ),
- 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'desktop' ),
- 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'desktop' ),
- );
- $breadcrumbs_tablet['.ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .rank-math-breadcrumb'] = array(
- 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'tablet' ),
- 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'tablet' ),
- 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'tablet' ),
- 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'tablet' ),
- );
- $breadcrumbs_mobile['.ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .rank-math-breadcrumb'] = array(
- 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'mobile' ),
- 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'mobile' ),
- 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'mobile' ),
- 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'mobile' ),
- );
- }
-
- /* Breadcrumb CSS for Alignment */
- $breadcrumbs_desktop['.ast-breadcrumbs-wrapper'] = array(
- 'text-align' => esc_attr( $breadcrumb_alignment ),
- );
-
- $css .= astra_parse_css( $breadcrumbs_desktop );
- $css .= astra_parse_css( $breadcrumbs_tablet, '', astra_get_tablet_breakpoint() );
- $css .= astra_parse_css( $breadcrumbs_mobile, '', astra_get_mobile_breakpoint() );
- $css .= astra_parse_css( $breadcrumbs_default_css );
-
- /* Breadcrumb default CSS */
- $css .= astra_parse_css(
- array(
- '.ast-default-menu-enable.ast-main-header-nav-open.ast-header-break-point .main-header-bar.ast-header-breadcrumb, .ast-main-header-nav-open .main-header-bar.ast-header-breadcrumb' => array(
- 'padding-top' => '1em',
- 'padding-bottom' => '1em',
- ),
- ),
- '',
- ''
- );
-
- $css .= astra_parse_css(
- array(
- '.ast-header-break-point .main-header-bar.ast-header-breadcrumb' => array(
- 'border-bottom-width' => '1px',
- 'border-bottom-color' => '#eaeaea',
- 'border-bottom-style' => 'solid',
- ),
- ),
- '',
- ''
- );
-
- $css .= astra_parse_css(
- array(
- '.ast-breadcrumbs-wrapper' => array(
- 'line-height' => '1.4',
- ),
- ),
- '',
- ''
- );
-
- $css .= astra_parse_css(
- array(
- '.ast-breadcrumbs-wrapper .rank-math-breadcrumb p' => array(
- 'margin-bottom' => '0px',
- ),
- ),
- '',
- ''
- );
-
- $css .= astra_parse_css(
- array(
- '.ast-breadcrumbs-wrapper' => array(
- 'display' => 'block',
- 'width' => '100%',
- ),
- ),
- '',
- ''
- );
-
- $dynamic_css .= $css;
-
- return $dynamic_css;
-}
+<?php +/** + * Breadcrumbs - Dynamic CSS + * + * @package Astra + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Breadcrumbs + */ +add_filter( 'astra_dynamic_theme_css', 'astra_breadcrumb_section_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS for Breadcrumb. + * + * @since 1.7.0 + */ +function astra_breadcrumb_section_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + $breadcrumb_position = astra_get_option( 'breadcrumb-position', 'none' ); + + $dynamic_css .= astra_parse_css( + array( + '.ast-breadcrumbs .trail-browse, .ast-breadcrumbs .trail-items, .ast-breadcrumbs .trail-items li' => array( + 'display' => 'inline-block', + 'margin' => '0', + 'padding' => '0', + 'border' => 'none', + 'background' => 'inherit', + 'text-indent' => '0', + ), + '.ast-breadcrumbs .trail-browse' => array( + 'font-size' => 'inherit', + 'font-style' => 'inherit', + 'font-weight' => 'inherit', + 'color' => 'inherit', + ), + '.ast-breadcrumbs .trail-items' => array( + 'list-style' => 'none', + ), + '.trail-items li::after' => array( + 'padding' => '0 0.3em', + 'content' => '"\00bb"', + ), + '.trail-items li:last-of-type::after' => array( + 'display' => 'none', + ), + ), + '', + '' + ); + + if ( 'none' === $breadcrumb_position ) { + return $dynamic_css; + } + + /** + * Set CSS Params + */ + + $default_color_array = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $breadcrumb_text_color = astra_get_option( 'breadcrumb-text-color-responsive', $default_color_array ); + $breadcrumb_active_color = astra_get_option( 'breadcrumb-active-color-responsive', $default_color_array ); + $breadcrumb_hover_color = astra_get_option( 'breadcrumb-hover-color-responsive', $default_color_array ); + $breadcrumb_separator_color = astra_get_option( 'breadcrumb-separator-color', $default_color_array ); + $breadcrumb_bg_color = astra_get_option( 'breadcrumb-bg-color', $default_color_array ); + + $breadcrumb_font_family = astra_get_option( 'breadcrumb-font-family' ); + $breadcrumb_font_weight = astra_get_option( 'breadcrumb-font-weight' ); + $breadcrumb_font_size = astra_get_option( 'breadcrumb-font-size' ); + $breadcrumb_line_height = astra_get_option( 'breadcrumb-line-height' ); + $breadcrumb_text_transform = astra_get_option( 'breadcrumb-text-transform' ); + + $breadcrumb_spacing = astra_get_option( 'breadcrumb-spacing' ); + + $breadcrumb_alignment = astra_get_option( 'breadcrumb-alignment' ); + + /** + * Generate dynamic CSS based on the Breadcrumb Source option selected from the customizer. + */ + $breadcrumb_source = astra_get_option( 'select-breadcrumb-source' ); + + /** + * Generate Dynamic CSS + */ + + $css = ''; + $breadcrumbs_default_css = array(); + $breadcrumb_enable = is_callable( 'WPSEO_Options::get' ) ? WPSEO_Options::get( 'breadcrumbs-enable' ) : false; + $wpseo_option = get_option( 'wpseo_internallinks' ) ? get_option( 'wpseo_internallinks' ) : $breadcrumb_enable; + if ( ! is_array( $wpseo_option ) ) { + unset( $wpseo_option ); + $wpseo_option = array( + 'breadcrumbs-enable' => $breadcrumb_enable, + ); + } + + $css .= astra_parse_css( + array( + '.trail-items li::after' => array( + 'content' => '"' . astra_get_option( 'breadcrumb-separator', '\00bb' ) . '"', + ), + ), + '', + '' + ); + + /** + * Breadcrumb Colors & Typography + */ + if ( function_exists( 'yoast_breadcrumb' ) && true === $wpseo_option['breadcrumbs-enable'] && $breadcrumb_source && 'yoast-seo-breadcrumbs' == $breadcrumb_source ) { + + /* Yoast SEO Breadcrumb CSS - Desktop */ + $breadcrumbs_desktop = array( + '.ast-breadcrumbs-wrapper a' => array( + 'color' => esc_attr( $breadcrumb_text_color['desktop'] ), + ), + '.ast-breadcrumbs-wrapper .breadcrumb_last' => array( + 'color' => esc_attr( $breadcrumb_active_color['desktop'] ), + ), + '.ast-breadcrumbs-wrapper a:hover' => array( + 'color' => esc_attr( $breadcrumb_hover_color['desktop'] ), + ), + '.ast-breadcrumbs-wrapper span' => array( + 'color' => esc_attr( $breadcrumb_separator_color['desktop'] ), + ), + + '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span' => array( + 'font-family' => astra_get_font_family( $breadcrumb_font_family ), + 'font-weight' => esc_attr( $breadcrumb_font_weight ), + 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'desktop' ), + 'line-height' => esc_attr( $breadcrumb_line_height ), + 'text-transform' => esc_attr( $breadcrumb_text_transform ), + ), + ); + + /* Yoast SEO Breadcrumb CSS - Tablet */ + $breadcrumbs_tablet = array( + '.ast-breadcrumbs-wrapper a' => array( + 'color' => esc_attr( $breadcrumb_text_color['tablet'] ), + ), + '.ast-breadcrumbs-wrapper .breadcrumb_last' => array( + 'color' => esc_attr( $breadcrumb_active_color['tablet'] ), + ), + '.ast-breadcrumbs-wrapper a:hover' => array( + 'color' => esc_attr( $breadcrumb_hover_color['tablet'] ), + ), + '.ast-breadcrumbs-wrapper span' => array( + 'color' => esc_attr( $breadcrumb_separator_color['tablet'] ), + ), + + '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span' => array( + 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'tablet' ), + ), + ); + + /* Yoast SEO Breadcrumb CSS - Mobile */ + $breadcrumbs_mobile = array( + '.ast-breadcrumbs-wrapper a' => array( + 'color' => esc_attr( $breadcrumb_text_color['mobile'] ), + ), + '.ast-breadcrumbs-wrapper .breadcrumb_last' => array( + 'color' => esc_attr( $breadcrumb_active_color['mobile'] ), + ), + '.ast-breadcrumbs-wrapper a:hover' => array( + 'color' => esc_attr( $breadcrumb_hover_color['mobile'] ), + ), + '.ast-breadcrumbs-wrapper span' => array( + 'color' => esc_attr( $breadcrumb_separator_color['mobile'] ), + ), + + '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span' => array( + 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'mobile' ), + ), + ); + } elseif ( function_exists( 'bcn_display' ) && $breadcrumb_source && 'breadcrumb-navxt' == $breadcrumb_source ) { + + /* Breadcrumb NavXT CSS - Desktop */ + $breadcrumbs_desktop = array( + '.ast-breadcrumbs-wrapper a' => array( + 'color' => esc_attr( $breadcrumb_text_color['desktop'] ), + ), + '.ast-breadcrumbs-wrapper .current-item' => array( + 'color' => esc_attr( $breadcrumb_active_color['desktop'] ), + ), + '.ast-breadcrumbs-wrapper a:hover' => array( + 'color' => esc_attr( $breadcrumb_hover_color['desktop'] ), + ), + '.ast-breadcrumbs-wrapper .breadcrumbs' => array( + 'color' => esc_attr( $breadcrumb_separator_color['desktop'] ), + ), + + '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item' => array( + 'font-family' => astra_get_font_family( $breadcrumb_font_family ), + 'font-weight' => esc_attr( $breadcrumb_font_weight ), + 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'desktop' ), + 'line-height' => esc_attr( $breadcrumb_line_height ), + 'text-transform' => esc_attr( $breadcrumb_text_transform ), + ), + ); + + /* Breadcrumb NavXT CSS - Tablet */ + $breadcrumbs_tablet = array( + '.ast-breadcrumbs-wrapper a' => array( + 'color' => esc_attr( $breadcrumb_text_color['tablet'] ), + ), + '.ast-breadcrumbs-wrapper .current-item' => array( + 'color' => esc_attr( $breadcrumb_active_color['tablet'] ), + ), + '.ast-breadcrumbs-wrapper a:hover' => array( + 'color' => esc_attr( $breadcrumb_hover_color['tablet'] ), + ), + '.ast-breadcrumbs-wrapper .breadcrumbs' => array( + 'color' => esc_attr( $breadcrumb_separator_color['tablet'] ), + ), + + '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item' => array( + 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'tablet' ), + ), + ); + + /* Breadcrumb NavXT CSS - Mobile */ + $breadcrumbs_mobile = array( + '.ast-breadcrumbs-wrapper a' => array( + 'color' => esc_attr( $breadcrumb_text_color['mobile'] ), + ), + '.ast-breadcrumbs-wrapper .current-item' => array( + 'color' => esc_attr( $breadcrumb_active_color['mobile'] ), + ), + '.ast-breadcrumbs-wrapper a:hover' => array( + 'color' => esc_attr( $breadcrumb_hover_color['mobile'] ), + ), + '.ast-breadcrumbs-wrapper .breadcrumbs' => array( + 'color' => esc_attr( $breadcrumb_separator_color['mobile'] ), + ), + + '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item' => array( + 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'mobile' ), + ), + ); + } elseif ( function_exists( 'rank_math_the_breadcrumbs' ) && $breadcrumb_source && 'rank-math' == $breadcrumb_source ) { + + /* Rank Math CSS - Desktop */ + $breadcrumbs_desktop = array( + '.ast-breadcrumbs-wrapper a' => array( + 'color' => esc_attr( $breadcrumb_text_color['desktop'] ), + ), + '.ast-breadcrumbs-wrapper .last' => array( + 'color' => esc_attr( $breadcrumb_active_color['desktop'] ), + ), + '.ast-breadcrumbs-wrapper a:hover' => array( + 'color' => esc_attr( $breadcrumb_hover_color['desktop'] ), + ), + '.ast-breadcrumbs-wrapper .separator' => array( + 'color' => esc_attr( $breadcrumb_separator_color['desktop'] ), + ), + + '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator' => array( + 'font-family' => astra_get_font_family( $breadcrumb_font_family ), + 'font-weight' => esc_attr( $breadcrumb_font_weight ), + 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'desktop' ), + 'line-height' => esc_attr( $breadcrumb_line_height ), + 'text-transform' => esc_attr( $breadcrumb_text_transform ), + ), + ); + + /* Rank Math CSS - Tablet */ + $breadcrumbs_tablet = array( + '.ast-breadcrumbs-wrapper a' => array( + 'color' => esc_attr( $breadcrumb_text_color['tablet'] ), + ), + '.ast-breadcrumbs-wrapper .last' => array( + 'color' => esc_attr( $breadcrumb_active_color['tablet'] ), + ), + '.ast-breadcrumbs-wrapper a:hover' => array( + 'color' => esc_attr( $breadcrumb_hover_color['tablet'] ), + ), + '.ast-breadcrumbs-wrapper .separator' => array( + 'color' => esc_attr( $breadcrumb_separator_color['tablet'] ), + ), + + '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator' => array( + 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'tablet' ), + ), + ); + + /* Rank Math CSS - Mobile */ + $breadcrumbs_mobile = array( + '.ast-breadcrumbs-wrapper a' => array( + 'color' => esc_attr( $breadcrumb_text_color['mobile'] ), + ), + '.ast-breadcrumbs-wrapper .last' => array( + 'color' => esc_attr( $breadcrumb_active_color['mobile'] ), + ), + '.ast-breadcrumbs-wrapper a:hover' => array( + 'color' => esc_attr( $breadcrumb_hover_color['mobile'] ), + ), + '.ast-breadcrumbs-wrapper .separator' => array( + 'color' => esc_attr( $breadcrumb_separator_color['mobile'] ), + ), + + '.ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator' => array( + 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'mobile' ), + ), + ); + } else { + + /* Default Breadcrumb CSS - Desktop */ + $breadcrumbs_desktop = array( + '.ast-breadcrumbs-wrapper .trail-items a' => array( + 'color' => esc_attr( $breadcrumb_text_color['desktop'] ), + ), + '.ast-breadcrumbs-wrapper .trail-items .trail-end' => array( + 'color' => esc_attr( $breadcrumb_active_color['desktop'] ), + ), + '.ast-breadcrumbs-wrapper .trail-items a:hover' => array( + 'color' => esc_attr( $breadcrumb_hover_color['desktop'] ), + ), + '.ast-breadcrumbs-wrapper .trail-items li::after' => array( + 'color' => esc_attr( $breadcrumb_separator_color['desktop'] ), + ), + + '.ast-breadcrumbs-wrapper, .ast-breadcrumbs-wrapper a' => array( + 'font-family' => astra_get_font_family( $breadcrumb_font_family ), + 'font-weight' => esc_attr( $breadcrumb_font_weight ), + 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'desktop' ), + 'line-height' => esc_attr( $breadcrumb_line_height ), + 'text-transform' => esc_attr( $breadcrumb_text_transform ), + ), + ); + + /* Default Breadcrumb CSS - Tablet */ + $breadcrumbs_tablet = array( + '.ast-breadcrumbs-wrapper .trail-items a' => array( + 'color' => esc_attr( $breadcrumb_text_color['tablet'] ), + ), + '.ast-breadcrumbs-wrapper .trail-items .trail-end' => array( + 'color' => esc_attr( $breadcrumb_active_color['tablet'] ), + ), + '.ast-breadcrumbs-wrapper .trail-items a:hover' => array( + 'color' => esc_attr( $breadcrumb_hover_color['tablet'] ), + ), + '.ast-breadcrumbs-wrapper .trail-items li::after' => array( + 'color' => esc_attr( $breadcrumb_separator_color['tablet'] ), + ), + + '.ast-breadcrumbs-wrapper, .ast-breadcrumbs-wrapper a' => array( + 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'tablet' ), + ), + ); + + /* Default Breadcrumb CSS - Mobile */ + $breadcrumbs_mobile = array( + '.ast-breadcrumbs-wrapper .trail-items a' => array( + 'color' => esc_attr( $breadcrumb_text_color['mobile'] ), + ), + '.ast-breadcrumbs-wrapper .trail-items .trail-end' => array( + 'color' => esc_attr( $breadcrumb_active_color['mobile'] ), + ), + '.ast-breadcrumbs-wrapper .trail-items a:hover' => array( + 'color' => esc_attr( $breadcrumb_hover_color['mobile'] ), + ), + + '.ast-breadcrumbs-wrapper .trail-items li::after' => array( + 'color' => esc_attr( $breadcrumb_separator_color['mobile'] ), + ), + + '.ast-breadcrumbs-wrapper, .ast-breadcrumbs-wrapper a' => array( + 'font-size' => astra_responsive_font( $breadcrumb_font_size, 'mobile' ), + ), + ); + } + + /* Breadcrumb CSS for Background Color */ + $breadcrumbs_desktop['.ast-breadcrumbs-wrapper, .main-header-bar.ast-header-breadcrumb'] = array( + 'background-color' => esc_attr( $breadcrumb_bg_color['desktop'] ), + ); + $breadcrumbs_tablet['.ast-breadcrumbs-wrapper, .main-header-bar.ast-header-breadcrumb'] = array( + 'background-color' => esc_attr( $breadcrumb_bg_color['tablet'] ), + ); + $breadcrumbs_mobile['.ast-breadcrumbs-wrapper, .main-header-bar.ast-header-breadcrumb'] = array( + 'background-color' => esc_attr( $breadcrumb_bg_color['mobile'] ), + ); + + /* Breadcrumb CSS for Spacing */ + if ( 'astra_header_markup_after' === $breadcrumb_position || 'astra_header_after' === $breadcrumb_position ) { + // After Header. + $breadcrumbs_desktop['.main-header-bar.ast-header-breadcrumb, .ast-header-break-point .main-header-bar.ast-header-breadcrumb, .ast-header-break-point .header-main-layout-2 .main-header-bar.ast-header-breadcrumb, .ast-header-break-point .ast-mobile-header-stack .main-header-bar.ast-header-breadcrumb, .ast-default-menu-enable.ast-main-header-nav-open.ast-header-break-point .main-header-bar-wrap .main-header-bar.ast-header-breadcrumb, .ast-main-header-nav-open .main-header-bar-wrap .main-header-bar.ast-header-breadcrumb'] = array( + 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'desktop' ), + 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'desktop' ), + 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'desktop' ), + 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'desktop' ), + ); + $breadcrumbs_tablet['.main-header-bar.ast-header-breadcrumb, .ast-header-break-point .main-header-bar.ast-header-breadcrumb, .ast-header-break-point .header-main-layout-2 .main-header-bar.ast-header-breadcrumb, .ast-header-break-point .ast-mobile-header-stack .main-header-bar.ast-header-breadcrumb, .ast-default-menu-enable.ast-main-header-nav-open.ast-header-break-point .main-header-bar-wrap .main-header-bar.ast-header-breadcrumb, .ast-main-header-nav-open .main-header-bar-wrap .main-header-bar.ast-header-breadcrumb'] = array( + 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'tablet' ), + 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'tablet' ), + 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'tablet' ), + 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'tablet' ), + ); + $breadcrumbs_mobile['.main-header-bar.ast-header-breadcrumb, .ast-header-break-point .main-header-bar.ast-header-breadcrumb, .ast-header-break-point .header-main-layout-2 .main-header-bar.ast-header-breadcrumb, .ast-header-break-point .ast-mobile-header-stack .main-header-bar.ast-header-breadcrumb, .ast-default-menu-enable.ast-main-header-nav-open.ast-header-break-point .main-header-bar-wrap .main-header-bar.ast-header-breadcrumb, .ast-main-header-nav-open .main-header-bar-wrap .main-header-bar.ast-header-breadcrumb'] = array( + 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'mobile' ), + 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'mobile' ), + 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'mobile' ), + 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'mobile' ), + ); + $breadcrumbs_default_css['.ast-header-breadcrumb'] = array( + 'padding-top' => '10px', + 'padding-bottom' => '10px', + ); + } elseif ( 'astra_masthead_content' === $breadcrumb_position ) { + // Inside Header. + $breadcrumbs_desktop['.ast-breadcrumbs-wrapper .ast-breadcrumbs-inner #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .breadcrumbs, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .rank-math-breadcrumb'] = array( + 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'desktop' ), + 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'desktop' ), + 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'desktop' ), + 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'desktop' ), + ); + $breadcrumbs_tablet['.ast-breadcrumbs-wrapper .ast-breadcrumbs-inner #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .breadcrumbs, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .rank-math-breadcrumb'] = array( + 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'tablet' ), + 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'tablet' ), + 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'tablet' ), + 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'tablet' ), + ); + $breadcrumbs_mobile['.ast-breadcrumbs-wrapper .ast-breadcrumbs-inner #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .breadcrumbs, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .rank-math-breadcrumb'] = array( + 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'mobile' ), + 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'mobile' ), + 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'mobile' ), + 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'mobile' ), + ); + $breadcrumbs_default_css['.ast-breadcrumbs-inner #ast-breadcrumbs-yoast, .ast-breadcrumbs-inner .breadcrumbs, .ast-breadcrumbs-inner .rank-math-breadcrumb'] = array( + 'padding-bottom' => '10px', + ); + $breadcrumbs_default_css['.ast-header-break-point .ast-breadcrumbs-wrapper'] = array( + 'order' => '4', + ); + } else { + // Before Title. + $breadcrumbs_desktop['.ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .rank-math-breadcrumb'] = array( + 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'desktop' ), + 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'desktop' ), + 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'desktop' ), + 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'desktop' ), + ); + $breadcrumbs_tablet['.ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .rank-math-breadcrumb'] = array( + 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'tablet' ), + 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'tablet' ), + 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'tablet' ), + 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'tablet' ), + ); + $breadcrumbs_mobile['.ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .rank-math-breadcrumb'] = array( + 'padding-top' => astra_responsive_spacing( $breadcrumb_spacing, 'top', 'mobile' ), + 'padding-right' => astra_responsive_spacing( $breadcrumb_spacing, 'right', 'mobile' ), + 'padding-bottom' => astra_responsive_spacing( $breadcrumb_spacing, 'bottom', 'mobile' ), + 'padding-left' => astra_responsive_spacing( $breadcrumb_spacing, 'left', 'mobile' ), + ); + } + + /* Breadcrumb CSS for Alignment */ + $breadcrumbs_desktop['.ast-breadcrumbs-wrapper'] = array( + 'text-align' => esc_attr( $breadcrumb_alignment ), + ); + + $css .= astra_parse_css( $breadcrumbs_desktop ); + $css .= astra_parse_css( $breadcrumbs_tablet, '', astra_get_tablet_breakpoint() ); + $css .= astra_parse_css( $breadcrumbs_mobile, '', astra_get_mobile_breakpoint() ); + $css .= astra_parse_css( $breadcrumbs_default_css ); + + /* Breadcrumb default CSS */ + $css .= astra_parse_css( + array( + '.ast-default-menu-enable.ast-main-header-nav-open.ast-header-break-point .main-header-bar.ast-header-breadcrumb, .ast-main-header-nav-open .main-header-bar.ast-header-breadcrumb' => array( + 'padding-top' => '1em', + 'padding-bottom' => '1em', + ), + ), + '', + '' + ); + + $css .= astra_parse_css( + array( + '.ast-header-break-point .main-header-bar.ast-header-breadcrumb' => array( + 'border-bottom-width' => '1px', + 'border-bottom-color' => '#eaeaea', + 'border-bottom-style' => 'solid', + ), + ), + '', + '' + ); + + $css .= astra_parse_css( + array( + '.ast-breadcrumbs-wrapper' => array( + 'line-height' => '1.4', + ), + ), + '', + '' + ); + + $css .= astra_parse_css( + array( + '.ast-breadcrumbs-wrapper .rank-math-breadcrumb p' => array( + 'margin-bottom' => '0px', + ), + ), + '', + '' + ); + + $css .= astra_parse_css( + array( + '.ast-breadcrumbs-wrapper' => array( + 'display' => 'block', + 'width' => '100%', + ), + ), + '', + '' + ); + + $dynamic_css .= $css; + + return $dynamic_css; +} diff --git a/inc/addons/heading-colors/class-astra-heading-colors-loader.php b/inc/addons/heading-colors/class-astra-heading-colors-loader.php index 3a27549..666631d 100644 --- a/inc/addons/heading-colors/class-astra-heading-colors-loader.php +++ b/inc/addons/heading-colors/class-astra-heading-colors-loader.php @@ -1,161 +1,161 @@ -<?php
-/**
- * Heading Colors Loader for Astra theme.
- *
- * @package Astra
- * @author Brainstorm Force
- * @copyright Copyright (c) 2020, Brainstorm Force
- * @link https://www.brainstormforce.com
- * @since Astra 2.2.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-/**
- * Customizer Initialization
- *
- * @since 2.2.0
- */
-class Astra_Heading_Colors_Loader {
-
- /**
- * Constructor
- *
- * @since 2.2.0
- */
- public function __construct() {
-
- add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) );
- add_action( 'customize_register', array( $this, 'customize_register' ), 2 );
- add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 );
- // Load Google fonts.
- add_action( 'astra_get_fonts', array( $this, 'add_fonts' ), 1 );
- }
-
- /**
- * Enqueue google fonts.
- *
- * @since 2.2.0
- */
- public function add_fonts() {
-
- $font_family_h1 = astra_get_option( 'font-family-h1' );
- $font_weight_h1 = astra_get_option( 'font-weight-h1' );
- Astra_Fonts::add_font( $font_family_h1, $font_weight_h1 );
-
- $font_family_h2 = astra_get_option( 'font-family-h2' );
- $font_weight_h2 = astra_get_option( 'font-weight-h2' );
- Astra_Fonts::add_font( $font_family_h2, $font_weight_h2 );
-
- $font_family_h3 = astra_get_option( 'font-family-h3' );
- $font_weight_h3 = astra_get_option( 'font-weight-h3' );
- Astra_Fonts::add_font( $font_family_h3, $font_weight_h3 );
-
- $theme_btn_font_family = astra_get_option( 'font-family-button' );
- $theme_btn_font_weight = astra_get_option( 'font-weight-button' );
- Astra_Fonts::add_font( $theme_btn_font_family, $theme_btn_font_weight );
-
- $header_btn_font_family = astra_get_option( 'primary-header-button-font-family' );
- $header_btn_font_weight = astra_get_option( 'primary-header-button-font-weight' );
- Astra_Fonts::add_font( $header_btn_font_family, $header_btn_font_weight );
- }
-
- /**
- * Set Options Default Values
- *
- * @param array $defaults Astra options default value array.
- * @return array
- *
- * @since 2.2.0
- */
- public function theme_defaults( $defaults ) {
-
- /**
- * Heading Tags <h1> to <h6>
- */
- $defaults['h1-color'] = '';
- $defaults['h2-color'] = '';
- $defaults['h3-color'] = '';
- $defaults['h4-color'] = '';
- $defaults['h5-color'] = '';
- $defaults['h6-color'] = '';
-
- // Header <H1>.
- $defaults['font-family-h1'] = 'inherit';
- $defaults['font-weight-h1'] = 'inherit';
- $defaults['text-transform-h1'] = '';
- $defaults['line-height-h1'] = '';
-
- // Header <H2>.
- $defaults['font-family-h2'] = 'inherit';
- $defaults['font-weight-h2'] = 'inherit';
- $defaults['text-transform-h2'] = '';
- $defaults['line-height-h2'] = '';
-
- // Header <H3>.
- $defaults['font-family-h3'] = 'inherit';
- $defaults['font-weight-h3'] = 'inherit';
- $defaults['text-transform-h3'] = '';
- $defaults['line-height-h3'] = '';
-
- /**
- * Theme button Font Defaults
- */
- $defaults['font-weight-button'] = 'inherit';
- $defaults['font-family-button'] = 'inherit';
- $defaults['font-size-button'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- 'desktop-unit' => 'px',
- 'tablet-unit' => 'px',
- 'mobile-unit' => 'px',
- );
- $defaults['text-transform-button'] = '';
-
- /**
- * Check backward compatibility for button line height.
- */
- $defaults['theme-btn-line-height'] = 1;
- $defaults['theme-btn-letter-spacing'] = '';
-
- return $defaults;
- }
-
- /**
- * Load color configs for the Heading Colors.
- *
- * @param WP_Customize_Manager $wp_customize Theme Customizer object.
- *
- * @since 2.2.0
- */
- public function customize_register( $wp_customize ) {
-
- /**
- * Register Panel & Sections
- */
- require_once ASTRA_THEME_HEADING_COLORS_DIR . 'customizer/class-astra-heading-colors-configs.php';// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
- }
-
- /**
- * Customizer Preview
- *
- * @since 2.2.0
- */
- public function preview_scripts() {
- /**
- * Load unminified if SCRIPT_DEBUG is true.
- */
- /* Directory and Extension */
- $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
- $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
- wp_enqueue_script( 'astra-heading-colors-customizer-preview-js', ASTRA_THEME_HEADING_COLORS_URI . 'assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true );
- }
-}
-
-/**
-* Kicking this off by creating the object of the class.
-*/
-new Astra_Heading_Colors_Loader();
+<?php +/** + * Heading Colors Loader for Astra theme. + * + * @package Astra + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 2.2.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Customizer Initialization + * + * @since 2.2.0 + */ +class Astra_Heading_Colors_Loader { + + /** + * Constructor + * + * @since 2.2.0 + */ + public function __construct() { + + add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); + add_action( 'customize_register', array( $this, 'customize_register' ), 2 ); + add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); + // Load Google fonts. + add_action( 'astra_get_fonts', array( $this, 'add_fonts' ), 1 ); + } + + /** + * Enqueue google fonts. + * + * @since 2.2.0 + */ + public function add_fonts() { + + $font_family_h1 = astra_get_option( 'font-family-h1' ); + $font_weight_h1 = astra_get_option( 'font-weight-h1' ); + Astra_Fonts::add_font( $font_family_h1, $font_weight_h1 ); + + $font_family_h2 = astra_get_option( 'font-family-h2' ); + $font_weight_h2 = astra_get_option( 'font-weight-h2' ); + Astra_Fonts::add_font( $font_family_h2, $font_weight_h2 ); + + $font_family_h3 = astra_get_option( 'font-family-h3' ); + $font_weight_h3 = astra_get_option( 'font-weight-h3' ); + Astra_Fonts::add_font( $font_family_h3, $font_weight_h3 ); + + $theme_btn_font_family = astra_get_option( 'font-family-button' ); + $theme_btn_font_weight = astra_get_option( 'font-weight-button' ); + Astra_Fonts::add_font( $theme_btn_font_family, $theme_btn_font_weight ); + + $header_btn_font_family = astra_get_option( 'primary-header-button-font-family' ); + $header_btn_font_weight = astra_get_option( 'primary-header-button-font-weight' ); + Astra_Fonts::add_font( $header_btn_font_family, $header_btn_font_weight ); + } + + /** + * Set Options Default Values + * + * @param array $defaults Astra options default value array. + * @return array + * + * @since 2.2.0 + */ + public function theme_defaults( $defaults ) { + + /** + * Heading Tags <h1> to <h6> + */ + $defaults['h1-color'] = ''; + $defaults['h2-color'] = ''; + $defaults['h3-color'] = ''; + $defaults['h4-color'] = ''; + $defaults['h5-color'] = ''; + $defaults['h6-color'] = ''; + + // Header <H1>. + $defaults['font-family-h1'] = 'inherit'; + $defaults['font-weight-h1'] = 'inherit'; + $defaults['text-transform-h1'] = ''; + $defaults['line-height-h1'] = ''; + + // Header <H2>. + $defaults['font-family-h2'] = 'inherit'; + $defaults['font-weight-h2'] = 'inherit'; + $defaults['text-transform-h2'] = ''; + $defaults['line-height-h2'] = ''; + + // Header <H3>. + $defaults['font-family-h3'] = 'inherit'; + $defaults['font-weight-h3'] = 'inherit'; + $defaults['text-transform-h3'] = ''; + $defaults['line-height-h3'] = ''; + + /** + * Theme button Font Defaults + */ + $defaults['font-weight-button'] = 'inherit'; + $defaults['font-family-button'] = 'inherit'; + $defaults['font-size-button'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + 'desktop-unit' => 'px', + 'tablet-unit' => 'px', + 'mobile-unit' => 'px', + ); + $defaults['text-transform-button'] = ''; + + /** + * Check backward compatibility for button line height. + */ + $defaults['theme-btn-line-height'] = 1; + $defaults['theme-btn-letter-spacing'] = ''; + + return $defaults; + } + + /** + * Load color configs for the Heading Colors. + * + * @param WP_Customize_Manager $wp_customize Theme Customizer object. + * + * @since 2.2.0 + */ + public function customize_register( $wp_customize ) { + + /** + * Register Panel & Sections + */ + require_once ASTRA_THEME_HEADING_COLORS_DIR . 'customizer/class-astra-heading-colors-configs.php';// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + + /** + * Customizer Preview + * + * @since 2.2.0 + */ + public function preview_scripts() { + /** + * Load unminified if SCRIPT_DEBUG is true. + */ + /* Directory and Extension */ + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_script( 'astra-heading-colors-customizer-preview-js', ASTRA_THEME_HEADING_COLORS_URI . 'assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); + } +} + +/** +* Kicking this off by creating the object of the class. +*/ +new Astra_Heading_Colors_Loader(); diff --git a/inc/addons/heading-colors/class-astra-heading-colors.php b/inc/addons/heading-colors/class-astra-heading-colors.php index 7de04b8..01fe4db 100644 --- a/inc/addons/heading-colors/class-astra-heading-colors.php +++ b/inc/addons/heading-colors/class-astra-heading-colors.php @@ -1,47 +1,47 @@ -<?php
-/**
- * Heading Colors for Astra theme.
- *
- * @package Astra
- * @author Brainstorm Force
- * @copyright Copyright (c) 2020, Brainstorm Force
- * @link https://www.brainstormforce.com
- * @since Astra 2.1.4
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-define( 'ASTRA_THEME_HEADING_COLORS_DIR', ASTRA_THEME_DIR . 'inc/addons/heading-colors/' );
-define( 'ASTRA_THEME_HEADING_COLORS_URI', ASTRA_THEME_URI . 'inc/addons/heading-colors/' );
-
-if ( ! class_exists( 'Astra_Heading_Colors' ) ) {
-
- /**
- * Heading Initial Setup
- *
- * @since 2.1.4
- */
- class Astra_Heading_Colors {
-
- /**
- * Constructor function that initializes required actions and hooks
- */
- public function __construct() {
-
- require_once ASTRA_THEME_HEADING_COLORS_DIR . 'class-astra-heading-colors-loader.php';// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
-
- // Include front end files.
- if ( ! is_admin() ) {
- require_once ASTRA_THEME_HEADING_COLORS_DIR . 'dynamic-css/dynamic.css.php';// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
- }
- }
- }
-
- /**
- * Kicking this off by creating an object.
- */
- new Astra_Heading_Colors();
-
-}
+<?php +/** + * Heading Colors for Astra theme. + * + * @package Astra + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 2.1.4 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +define( 'ASTRA_THEME_HEADING_COLORS_DIR', ASTRA_THEME_DIR . 'inc/addons/heading-colors/' ); +define( 'ASTRA_THEME_HEADING_COLORS_URI', ASTRA_THEME_URI . 'inc/addons/heading-colors/' ); + +if ( ! class_exists( 'Astra_Heading_Colors' ) ) { + + /** + * Heading Initial Setup + * + * @since 2.1.4 + */ + class Astra_Heading_Colors { + + /** + * Constructor function that initializes required actions and hooks + */ + public function __construct() { + + require_once ASTRA_THEME_HEADING_COLORS_DIR . 'class-astra-heading-colors-loader.php';// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + + // Include front end files. + if ( ! is_admin() ) { + require_once ASTRA_THEME_HEADING_COLORS_DIR . 'dynamic-css/dynamic.css.php';// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + } + } + + /** + * Kicking this off by creating an object. + */ + new Astra_Heading_Colors(); + +} diff --git a/inc/addons/heading-colors/customizer/class-astra-heading-colors-configs.php b/inc/addons/heading-colors/customizer/class-astra-heading-colors-configs.php index 2cdffa3..74e4e93 100644 --- a/inc/addons/heading-colors/customizer/class-astra-heading-colors-configs.php +++ b/inc/addons/heading-colors/customizer/class-astra-heading-colors-configs.php @@ -1,426 +1,426 @@ -<?php
-/**
- * Heading Colors Options for Astra theme.
- *
- * @package Astra
- * @author Brainstorm Force
- * @copyright Copyright (c) 2020, Brainstorm Force
- * @link https://www.brainstormforce.com
- * @since Astra 2.1.4
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-if ( ! class_exists( 'Astra_Heading_Colors_Configs' ) ) {
-
- /**
- * Customizer Sanitizes Initial setup
- */
- class Astra_Heading_Colors_Configs extends Astra_Customizer_Config_Base {
-
- /**
- * Register Astra Heading Colors Settings.
- *
- * @param Array $configurations Astra Customizer Configurations.
- * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
- * @since 2.1.4
- * @return Array Astra Customizer Configurations with updated configurations.
- */
- public function register_configuration( $configurations, $wp_customize ) {
-
- $_configs = array(
-
- // Option: Base Heading Color.
- array(
- 'default' => astra_get_option( 'heading-base-color' ),
- 'type' => 'control',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'transport' => 'postMessage',
- 'priority' => 18,
- 'name' => ASTRA_THEME_SETTINGS . '[heading-base-color]',
- 'title' => __( 'Heading Color ( H1 - H6 )', 'astra' ),
- 'section' => ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'colors-and-background' ) ) ? 'section-colors-body' : 'section-colors-background',
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Heading Typography starts here - h1 - h3
- */
-
- /**
- * Option: Heading <H1> Font Family
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[font-family-h1]',
- 'type' => 'control',
- 'control' => 'ast-font',
- 'font-type' => 'ast-font-family',
- 'default' => astra_get_option( 'font-family-h1' ),
- 'title' => __( 'Family', 'astra' ),
- 'section' => 'section-content-typo',
- 'priority' => 5,
- 'connect' => ASTRA_THEME_SETTINGS . '[font-weight-h1]',
- 'transport' => 'postMessage',
- ),
-
- /**
- * Option: Heading <H1> Font Weight
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[font-weight-h1]',
- 'type' => 'control',
- 'control' => 'ast-font',
- 'font-type' => 'ast-font-weight',
- 'title' => __( 'Weight', 'astra' ),
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ),
- 'default' => astra_get_option( 'font-weight-h1' ),
- 'section' => 'section-content-typo',
- 'priority' => 7,
- 'connect' => ASTRA_THEME_SETTINGS . '[font-family-h1]',
- 'transport' => 'postMessage',
- ),
-
- /**
- * Option: Heading <H1> Text Transform
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[text-transform-h1]',
- 'section' => 'section-content-typo',
- 'default' => astra_get_option( 'text-transform-h1' ),
- 'title' => __( 'Text Transform', 'astra' ),
- 'type' => 'control',
- 'control' => 'ast-select',
- 'priority' => 8,
- 'choices' => array(
- '' => __( 'Inherit', 'astra' ),
- 'none' => __( 'None', 'astra' ),
- 'capitalize' => __( 'Capitalize', 'astra' ),
- 'uppercase' => __( 'Uppercase', 'astra' ),
- 'lowercase' => __( 'Lowercase', 'astra' ),
- ),
- 'transport' => 'postMessage',
- ),
-
- /**
- * Option: Heading <H1> Line Height
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[line-height-h1]',
- 'section' => 'section-content-typo',
- 'default' => astra_get_option( 'line-height-h1' ),
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ),
- 'type' => 'control',
- 'control' => 'ast-slider',
- 'title' => __( 'Line Height', 'astra' ),
- 'transport' => 'postMessage',
- 'priority' => 8,
- 'suffix' => 'em',
- 'input_attrs' => array(
- 'min' => 1,
- 'step' => 0.01,
- 'max' => 5,
- ),
- ),
-
- /**
- * Option: Heading <H2> Font Family
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[font-family-h2]',
- 'type' => 'control',
- 'control' => 'ast-font',
- 'font-type' => 'ast-font-family',
- 'title' => __( 'Family', 'astra' ),
- 'default' => astra_get_option( 'font-family-h2' ),
- 'section' => 'section-content-typo',
- 'priority' => 10,
- 'connect' => ASTRA_THEME_SETTINGS . '[font-weight-h2]',
- 'transport' => 'postMessage',
- ),
-
- /**
- * Option: Heading <H2> Font Weight
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[font-weight-h2]',
- 'type' => 'control',
- 'control' => 'ast-font',
- 'font-type' => 'ast-font-weight',
- 'title' => __( 'Weight', 'astra' ),
- 'section' => 'section-content-typo',
- 'default' => astra_get_option( 'font-weight-h2' ),
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ),
- 'priority' => 12,
- 'connect' => ASTRA_THEME_SETTINGS . '[font-family-h2]',
- 'transport' => 'postMessage',
- ),
-
- /**
- * Option: Heading <H2> Text Transform
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[text-transform-h2]',
- 'section' => 'section-content-typo',
- 'default' => astra_get_option( 'text-transform-h2' ),
- 'title' => __( 'Text Transform', 'astra' ),
- 'type' => 'control',
- 'control' => 'ast-select',
- 'transport' => 'postMessage',
- 'priority' => 13,
- 'choices' => array(
- '' => __( 'Inherit', 'astra' ),
- 'none' => __( 'None', 'astra' ),
- 'capitalize' => __( 'Capitalize', 'astra' ),
- 'uppercase' => __( 'Uppercase', 'astra' ),
- 'lowercase' => __( 'Lowercase', 'astra' ),
- ),
- 'transport' => 'postMessage',
- ),
-
- /**
- * Option: Heading <H2> Line Height
- */
-
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[line-height-h2]',
- 'section' => 'section-content-typo',
- 'type' => 'control',
- 'control' => 'ast-slider',
- 'default' => astra_get_option( 'line-height-h2' ),
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ),
- 'transport' => 'postMessage',
- 'title' => __( 'Line Height', 'astra' ),
- 'priority' => 14,
- 'suffix' => 'em',
- 'input_attrs' => array(
- 'min' => 1,
- 'step' => 0.01,
- 'max' => 5,
- ),
- ),
-
- /**
- * Option: Heading <H3> Font Family
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[font-family-h3]',
- 'type' => 'control',
- 'control' => 'ast-font',
- 'font-type' => 'ast-font-family',
- 'default' => astra_get_option( 'font-family-h3' ),
- 'title' => __( 'Family', 'astra' ),
- 'section' => 'section-content-typo',
- 'priority' => 15,
- 'connect' => ASTRA_THEME_SETTINGS . '[font-weight-h3]',
- 'transport' => 'postMessage',
- ),
-
- /**
- * Option: Heading <H3> Font Weight
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[font-weight-h3]',
- 'type' => 'control',
- 'control' => 'ast-font',
- 'font-type' => 'ast-font-weight',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ),
- 'default' => astra_get_option( 'font-weight-h3' ),
- 'title' => __( 'Weight', 'astra' ),
- 'section' => 'section-content-typo',
- 'priority' => 17,
- 'connect' => ASTRA_THEME_SETTINGS . '[font-family-h3]',
- 'transport' => 'postMessage',
- ),
-
- /**
- * Option: Heading <H3> Text Transform
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[text-transform-h3]',
- 'type' => 'control',
- 'section' => 'section-content-typo',
- 'title' => __( 'Text Transform', 'astra' ),
- 'default' => astra_get_option( 'text-transform-h3' ),
- 'transport' => 'postMessage',
- 'control' => 'ast-select',
- 'priority' => 18,
- 'choices' => array(
- '' => __( 'Inherit', 'astra' ),
- 'none' => __( 'None', 'astra' ),
- 'capitalize' => __( 'Capitalize', 'astra' ),
- 'uppercase' => __( 'Uppercase', 'astra' ),
- 'lowercase' => __( 'Lowercase', 'astra' ),
- ),
- 'transport' => 'postMessage',
- ),
-
- /**
- * Option: Heading <H3> Line Height
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[line-height-h3]',
- 'type' => 'control',
- 'control' => 'ast-slider',
- 'section' => 'section-content-typo',
- 'title' => __( 'Line Height', 'astra' ),
- 'transport' => 'postMessage',
- 'default' => astra_get_option( 'line-height-h3' ),
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ),
- 'priority' => 19,
- 'suffix' => 'em',
- 'input_attrs' => array(
- 'min' => 1,
- 'step' => 0.01,
- 'max' => 5,
- ),
- ),
-
-
- /**
- * Option: Button Typography Heading
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[button-text-typography]',
- 'default' => astra_get_option( 'button-text-typography' ),
- 'type' => 'control',
- 'control' => 'ast-settings-group',
- 'title' => __( 'Button Font', 'astra' ),
- 'section' => 'section-buttons',
- 'transport' => 'postMessage',
- 'priority' => 25,
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Button Font Family
- */
- array(
- 'name' => 'font-family-button',
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[button-text-typography]',
- 'section' => 'section-buttons',
- 'control' => 'ast-font',
- 'font_type' => 'ast-font-family',
- 'title' => __( 'Family', 'astra' ),
- 'default' => astra_get_option( 'font-family-button' ),
- 'connect' => ASTRA_THEME_SETTINGS . '[font-weight-button]',
- 'priority' => 1,
- ),
-
- /**
- * Option: Button Font Size
- */
- array(
- 'name' => 'font-size-button',
- 'transport' => 'postMessage',
- 'title' => __( 'Size', 'astra' ),
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[button-text-typography]',
- 'section' => 'section-buttons',
- 'control' => 'ast-responsive',
- 'priority' => 2,
- 'default' => astra_get_option( 'font-size-button' ),
- 'input_attrs' => array(
- 'min' => 0,
- ),
- 'units' => array(
- 'px' => 'px',
- 'em' => 'em',
- ),
- ),
-
- /**
- * Option: Button Font Weight
- */
- array(
- 'name' => 'font-weight-button',
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[button-text-typography]',
- 'section' => 'section-buttons',
- 'control' => 'ast-font',
- 'font_type' => 'ast-font-weight',
- 'title' => __( 'Weight', 'astra' ),
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ),
- 'default' => astra_get_option( 'font-weight-button' ),
- 'connect' => 'font-family-button',
- 'priority' => 3,
- ),
-
- /**
- * Option: Button Text Transform
- */
- array(
- 'name' => 'text-transform-button',
- 'transport' => 'postMessage',
- 'default' => astra_get_option( 'text-transform-button' ),
- 'title' => __( 'Text Transform', 'astra' ),
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[button-text-typography]',
- 'section' => 'section-buttons',
- 'control' => 'ast-select',
- 'priority' => 4,
- 'choices' => array(
- '' => __( 'Inherit', 'astra' ),
- 'none' => __( 'None', 'astra' ),
- 'capitalize' => __( 'Capitalize', 'astra' ),
- 'uppercase' => __( 'Uppercase', 'astra' ),
- 'lowercase' => __( 'Lowercase', 'astra' ),
- ),
- ),
-
- /**
- * Option: Theme Button Line Height
- */
- array(
- 'name' => 'theme-btn-line-height',
- 'control' => 'ast-slider',
- 'transport' => 'postMessage',
- 'type' => 'sub-control',
- 'default' => astra_get_option( 'theme-btn-line-height' ),
- 'parent' => ASTRA_THEME_SETTINGS . '[button-text-typography]',
- 'section' => 'section-buttons',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ),
- 'title' => __( 'Line Height', 'astra' ),
- 'suffix' => 'em',
- 'priority' => 5,
- 'input_attrs' => array(
- 'min' => 1,
- 'step' => 0.01,
- 'max' => 5,
- ),
- ),
-
- /**
- * Option: Theme Button Line Height
- */
- array(
- 'name' => 'theme-btn-letter-spacing',
- 'control' => 'ast-slider',
- 'transport' => 'postMessage',
- 'type' => 'sub-control',
- 'default' => astra_get_option( 'theme-btn-letter-spacing' ),
- 'parent' => ASTRA_THEME_SETTINGS . '[button-text-typography]',
- 'section' => 'section-buttons',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ),
- 'title' => __( 'Letter Spacing', 'astra' ),
- 'suffix' => 'px',
- 'priority' => 6,
- 'input_attrs' => array(
- 'min' => 1,
- 'step' => 1,
- 'max' => 100,
- ),
- ),
-
- );
-
- return array_merge( $configurations, $_configs );
-
- }
- }
-}
-
-new Astra_Heading_Colors_Configs();
+<?php +/** + * Heading Colors Options for Astra theme. + * + * @package Astra + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 2.1.4 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +if ( ! class_exists( 'Astra_Heading_Colors_Configs' ) ) { + + /** + * Customizer Sanitizes Initial setup + */ + class Astra_Heading_Colors_Configs extends Astra_Customizer_Config_Base { + + /** + * Register Astra Heading Colors Settings. + * + * @param Array $configurations Astra Customizer Configurations. + * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. + * @since 2.1.4 + * @return Array Astra Customizer Configurations with updated configurations. + */ + public function register_configuration( $configurations, $wp_customize ) { + + $_configs = array( + + // Option: Base Heading Color. + array( + 'default' => astra_get_option( 'heading-base-color' ), + 'type' => 'control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'transport' => 'postMessage', + 'priority' => 18, + 'name' => ASTRA_THEME_SETTINGS . '[heading-base-color]', + 'title' => __( 'Heading Color ( H1 - H6 )', 'astra' ), + 'section' => ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'colors-and-background' ) ) ? 'section-colors-body' : 'section-colors-background', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Heading Typography starts here - h1 - h3 + */ + + /** + * Option: Heading <H1> Font Family + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-family-h1]', + 'type' => 'control', + 'control' => 'ast-font', + 'font-type' => 'ast-font-family', + 'default' => astra_get_option( 'font-family-h1' ), + 'title' => __( 'Family', 'astra' ), + 'section' => 'section-content-typo', + 'priority' => 5, + 'connect' => ASTRA_THEME_SETTINGS . '[font-weight-h1]', + 'transport' => 'postMessage', + ), + + /** + * Option: Heading <H1> Font Weight + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-weight-h1]', + 'type' => 'control', + 'control' => 'ast-font', + 'font-type' => 'ast-font-weight', + 'title' => __( 'Weight', 'astra' ), + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), + 'default' => astra_get_option( 'font-weight-h1' ), + 'section' => 'section-content-typo', + 'priority' => 7, + 'connect' => ASTRA_THEME_SETTINGS . '[font-family-h1]', + 'transport' => 'postMessage', + ), + + /** + * Option: Heading <H1> Text Transform + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[text-transform-h1]', + 'section' => 'section-content-typo', + 'default' => astra_get_option( 'text-transform-h1' ), + 'title' => __( 'Text Transform', 'astra' ), + 'type' => 'control', + 'control' => 'ast-select', + 'priority' => 8, + 'choices' => array( + '' => __( 'Inherit', 'astra' ), + 'none' => __( 'None', 'astra' ), + 'capitalize' => __( 'Capitalize', 'astra' ), + 'uppercase' => __( 'Uppercase', 'astra' ), + 'lowercase' => __( 'Lowercase', 'astra' ), + ), + 'transport' => 'postMessage', + ), + + /** + * Option: Heading <H1> Line Height + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[line-height-h1]', + 'section' => 'section-content-typo', + 'default' => astra_get_option( 'line-height-h1' ), + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), + 'type' => 'control', + 'control' => 'ast-slider', + 'title' => __( 'Line Height', 'astra' ), + 'transport' => 'postMessage', + 'priority' => 8, + 'suffix' => 'em', + 'input_attrs' => array( + 'min' => 1, + 'step' => 0.01, + 'max' => 5, + ), + ), + + /** + * Option: Heading <H2> Font Family + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-family-h2]', + 'type' => 'control', + 'control' => 'ast-font', + 'font-type' => 'ast-font-family', + 'title' => __( 'Family', 'astra' ), + 'default' => astra_get_option( 'font-family-h2' ), + 'section' => 'section-content-typo', + 'priority' => 10, + 'connect' => ASTRA_THEME_SETTINGS . '[font-weight-h2]', + 'transport' => 'postMessage', + ), + + /** + * Option: Heading <H2> Font Weight + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-weight-h2]', + 'type' => 'control', + 'control' => 'ast-font', + 'font-type' => 'ast-font-weight', + 'title' => __( 'Weight', 'astra' ), + 'section' => 'section-content-typo', + 'default' => astra_get_option( 'font-weight-h2' ), + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), + 'priority' => 12, + 'connect' => ASTRA_THEME_SETTINGS . '[font-family-h2]', + 'transport' => 'postMessage', + ), + + /** + * Option: Heading <H2> Text Transform + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[text-transform-h2]', + 'section' => 'section-content-typo', + 'default' => astra_get_option( 'text-transform-h2' ), + 'title' => __( 'Text Transform', 'astra' ), + 'type' => 'control', + 'control' => 'ast-select', + 'transport' => 'postMessage', + 'priority' => 13, + 'choices' => array( + '' => __( 'Inherit', 'astra' ), + 'none' => __( 'None', 'astra' ), + 'capitalize' => __( 'Capitalize', 'astra' ), + 'uppercase' => __( 'Uppercase', 'astra' ), + 'lowercase' => __( 'Lowercase', 'astra' ), + ), + 'transport' => 'postMessage', + ), + + /** + * Option: Heading <H2> Line Height + */ + + array( + 'name' => ASTRA_THEME_SETTINGS . '[line-height-h2]', + 'section' => 'section-content-typo', + 'type' => 'control', + 'control' => 'ast-slider', + 'default' => astra_get_option( 'line-height-h2' ), + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), + 'transport' => 'postMessage', + 'title' => __( 'Line Height', 'astra' ), + 'priority' => 14, + 'suffix' => 'em', + 'input_attrs' => array( + 'min' => 1, + 'step' => 0.01, + 'max' => 5, + ), + ), + + /** + * Option: Heading <H3> Font Family + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-family-h3]', + 'type' => 'control', + 'control' => 'ast-font', + 'font-type' => 'ast-font-family', + 'default' => astra_get_option( 'font-family-h3' ), + 'title' => __( 'Family', 'astra' ), + 'section' => 'section-content-typo', + 'priority' => 15, + 'connect' => ASTRA_THEME_SETTINGS . '[font-weight-h3]', + 'transport' => 'postMessage', + ), + + /** + * Option: Heading <H3> Font Weight + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[font-weight-h3]', + 'type' => 'control', + 'control' => 'ast-font', + 'font-type' => 'ast-font-weight', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), + 'default' => astra_get_option( 'font-weight-h3' ), + 'title' => __( 'Weight', 'astra' ), + 'section' => 'section-content-typo', + 'priority' => 17, + 'connect' => ASTRA_THEME_SETTINGS . '[font-family-h3]', + 'transport' => 'postMessage', + ), + + /** + * Option: Heading <H3> Text Transform + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[text-transform-h3]', + 'type' => 'control', + 'section' => 'section-content-typo', + 'title' => __( 'Text Transform', 'astra' ), + 'default' => astra_get_option( 'text-transform-h3' ), + 'transport' => 'postMessage', + 'control' => 'ast-select', + 'priority' => 18, + 'choices' => array( + '' => __( 'Inherit', 'astra' ), + 'none' => __( 'None', 'astra' ), + 'capitalize' => __( 'Capitalize', 'astra' ), + 'uppercase' => __( 'Uppercase', 'astra' ), + 'lowercase' => __( 'Lowercase', 'astra' ), + ), + 'transport' => 'postMessage', + ), + + /** + * Option: Heading <H3> Line Height + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[line-height-h3]', + 'type' => 'control', + 'control' => 'ast-slider', + 'section' => 'section-content-typo', + 'title' => __( 'Line Height', 'astra' ), + 'transport' => 'postMessage', + 'default' => astra_get_option( 'line-height-h3' ), + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), + 'priority' => 19, + 'suffix' => 'em', + 'input_attrs' => array( + 'min' => 1, + 'step' => 0.01, + 'max' => 5, + ), + ), + + + /** + * Option: Button Typography Heading + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[button-text-typography]', + 'default' => astra_get_option( 'button-text-typography' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Button Font', 'astra' ), + 'section' => 'section-buttons', + 'transport' => 'postMessage', + 'priority' => 25, + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Button Font Family + */ + array( + 'name' => 'font-family-button', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[button-text-typography]', + 'section' => 'section-buttons', + 'control' => 'ast-font', + 'font_type' => 'ast-font-family', + 'title' => __( 'Family', 'astra' ), + 'default' => astra_get_option( 'font-family-button' ), + 'connect' => ASTRA_THEME_SETTINGS . '[font-weight-button]', + 'priority' => 1, + ), + + /** + * Option: Button Font Size + */ + array( + 'name' => 'font-size-button', + 'transport' => 'postMessage', + 'title' => __( 'Size', 'astra' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[button-text-typography]', + 'section' => 'section-buttons', + 'control' => 'ast-responsive', + 'priority' => 2, + 'default' => astra_get_option( 'font-size-button' ), + 'input_attrs' => array( + 'min' => 0, + ), + 'units' => array( + 'px' => 'px', + 'em' => 'em', + ), + ), + + /** + * Option: Button Font Weight + */ + array( + 'name' => 'font-weight-button', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[button-text-typography]', + 'section' => 'section-buttons', + 'control' => 'ast-font', + 'font_type' => 'ast-font-weight', + 'title' => __( 'Weight', 'astra' ), + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), + 'default' => astra_get_option( 'font-weight-button' ), + 'connect' => 'font-family-button', + 'priority' => 3, + ), + + /** + * Option: Button Text Transform + */ + array( + 'name' => 'text-transform-button', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'text-transform-button' ), + 'title' => __( 'Text Transform', 'astra' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[button-text-typography]', + 'section' => 'section-buttons', + 'control' => 'ast-select', + 'priority' => 4, + 'choices' => array( + '' => __( 'Inherit', 'astra' ), + 'none' => __( 'None', 'astra' ), + 'capitalize' => __( 'Capitalize', 'astra' ), + 'uppercase' => __( 'Uppercase', 'astra' ), + 'lowercase' => __( 'Lowercase', 'astra' ), + ), + ), + + /** + * Option: Theme Button Line Height + */ + array( + 'name' => 'theme-btn-line-height', + 'control' => 'ast-slider', + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'default' => astra_get_option( 'theme-btn-line-height' ), + 'parent' => ASTRA_THEME_SETTINGS . '[button-text-typography]', + 'section' => 'section-buttons', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), + 'title' => __( 'Line Height', 'astra' ), + 'suffix' => 'em', + 'priority' => 5, + 'input_attrs' => array( + 'min' => 1, + 'step' => 0.01, + 'max' => 5, + ), + ), + + /** + * Option: Theme Button Line Height + */ + array( + 'name' => 'theme-btn-letter-spacing', + 'control' => 'ast-slider', + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'default' => astra_get_option( 'theme-btn-letter-spacing' ), + 'parent' => ASTRA_THEME_SETTINGS . '[button-text-typography]', + 'section' => 'section-buttons', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), + 'title' => __( 'Letter Spacing', 'astra' ), + 'suffix' => 'px', + 'priority' => 6, + 'input_attrs' => array( + 'min' => 1, + 'step' => 1, + 'max' => 100, + ), + ), + + ); + + return array_merge( $configurations, $_configs ); + + } + } +} + +new Astra_Heading_Colors_Configs(); diff --git a/inc/addons/heading-colors/dynamic-css/dynamic.css.php b/inc/addons/heading-colors/dynamic-css/dynamic.css.php index e591b9c..a60bd47 100644 --- a/inc/addons/heading-colors/dynamic-css/dynamic.css.php +++ b/inc/addons/heading-colors/dynamic-css/dynamic.css.php @@ -1,54 +1,54 @@ -<?php
-/**
- * Heading Colors - Dynamic CSS
- *
- * @package Astra
- * @since 2.1.4
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-/**
- * Heading Colors
- */
-add_filter( 'astra_dynamic_theme_css', 'astra_heading_colors_section_dynamic_css' );
-
-/**
- * Dynamic CSS
- *
- * @param string $dynamic_css Astra Dynamic CSS.
- * @param string $dynamic_css_filtered Astra Dynamic CSS Filters.
- * @return String Generated dynamic CSS for Heading Colors.
- *
- * @since 2.1.4
- */
-function astra_heading_colors_section_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) {
-
- /**
- * Heading Colors - h1 - h6.
- */
- $heading_base_color = astra_get_option( 'heading-base-color' );
-
- /**
- * Normal Colors without reponsive option.
- * [1]. Heading Colors
- */
- $css_output = array(
-
- /**
- * Content base heading color.
- */
- 'h1, .entry-content h1, h2, .entry-content h2, h3, .entry-content h3, h4, .entry-content h4, h5, .entry-content h5, h6, .entry-content h6' => array(
- 'color' => esc_attr( $heading_base_color ),
- ),
- );
-
- /* Parse CSS from array() */
- $css_output = astra_parse_css( $css_output );
-
- $dynamic_css .= $css_output;
-
- return $dynamic_css;
-}
+<?php +/** + * Heading Colors - Dynamic CSS + * + * @package Astra + * @since 2.1.4 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Heading Colors + */ +add_filter( 'astra_dynamic_theme_css', 'astra_heading_colors_section_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS for Heading Colors. + * + * @since 2.1.4 + */ +function astra_heading_colors_section_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + /** + * Heading Colors - h1 - h6. + */ + $heading_base_color = astra_get_option( 'heading-base-color' ); + + /** + * Normal Colors without reponsive option. + * [1]. Heading Colors + */ + $css_output = array( + + /** + * Content base heading color. + */ + 'h1, .entry-content h1, h2, .entry-content h2, h3, .entry-content h3, h4, .entry-content h4, h5, .entry-content h5, h6, .entry-content h6' => array( + 'color' => esc_attr( $heading_base_color ), + ), + ); + + /* Parse CSS from array() */ + $css_output = astra_parse_css( $css_output ); + + $dynamic_css .= $css_output; + + return $dynamic_css; +} diff --git a/inc/addons/transparent-header/class-astra-ext-transparent-header.php b/inc/addons/transparent-header/class-astra-ext-transparent-header.php index 68dff6c..162d8ff 100644 --- a/inc/addons/transparent-header/class-astra-ext-transparent-header.php +++ b/inc/addons/transparent-header/class-astra-ext-transparent-header.php @@ -1,64 +1,64 @@ -<?php
-/**
- * Sticky Header Extension
- *
- * @package Astra Addon
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-define( 'ASTRA_THEME_TRANSPARENT_HEADER_DIR', ASTRA_THEME_DIR . 'inc/addons/transparent-header/' );
-define( 'ASTRA_THEME_TRANSPARENT_HEADER_URI', ASTRA_THEME_URI . 'inc/addons/transparent-header/' );
-
-if ( ! class_exists( 'Astra_Ext_Transparent_Header' ) ) {
-
- /**
- * Sticky Header Initial Setup
- *
- * @since 1.0.0
- */
- class Astra_Ext_Transparent_Header {
-
- /**
- * Member Variable
- *
- * @var instance
- */
- private static $instance;
-
- /**
- * Initiator
- */
- public static function get_instance() {
- if ( ! isset( self::$instance ) ) {
- self::$instance = new self();
- }
- return self::$instance;
- }
-
- /**
- * Constructor function that initializes required actions and hooks
- */
- public function __construct() {
-
- // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
- require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/class-astra-ext-transparent-header-loader.php';
- require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/class-astra-ext-transparent-header-markup.php';
-
- // Include front end files.
- if ( ! is_admin() ) {
- require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/dynamic-css/dynamic.css.php';
- require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/dynamic-css/header-sections-dynamic.css.php';
- }
- // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
- }
- }
-
- /**
- * Kicking this off by calling 'get_instance()' method
- */
- Astra_Ext_Transparent_Header::get_instance();
-
-}
+<?php +/** + * Sticky Header Extension + * + * @package Astra Addon + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +define( 'ASTRA_THEME_TRANSPARENT_HEADER_DIR', ASTRA_THEME_DIR . 'inc/addons/transparent-header/' ); +define( 'ASTRA_THEME_TRANSPARENT_HEADER_URI', ASTRA_THEME_URI . 'inc/addons/transparent-header/' ); + +if ( ! class_exists( 'Astra_Ext_Transparent_Header' ) ) { + + /** + * Sticky Header Initial Setup + * + * @since 1.0.0 + */ + class Astra_Ext_Transparent_Header { + + /** + * Member Variable + * + * @var instance + */ + private static $instance; + + /** + * Initiator + */ + public static function get_instance() { + if ( ! isset( self::$instance ) ) { + self::$instance = new self(); + } + return self::$instance; + } + + /** + * Constructor function that initializes required actions and hooks + */ + public function __construct() { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/class-astra-ext-transparent-header-loader.php'; + require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/class-astra-ext-transparent-header-markup.php'; + + // Include front end files. + if ( ! is_admin() ) { + require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/dynamic-css/dynamic.css.php'; + require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/dynamic-css/header-sections-dynamic.css.php'; + } + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + } + + /** + * Kicking this off by calling 'get_instance()' method + */ + Astra_Ext_Transparent_Header::get_instance(); + +} diff --git a/inc/addons/transparent-header/classes/class-astra-ext-transparent-header-loader.php b/inc/addons/transparent-header/classes/class-astra-ext-transparent-header-loader.php index ea7143c..088fb81 100644 --- a/inc/addons/transparent-header/classes/class-astra-ext-transparent-header-loader.php +++ b/inc/addons/transparent-header/classes/class-astra-ext-transparent-header-loader.php @@ -1,214 +1,214 @@ -<?php
-/**
- * Sticky Header - Customizer.
- *
- * @package Astra Addon
- * @since 1.0.0
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-if ( ! class_exists( 'Astra_Ext_Transparent_Header_Loader' ) ) {
-
- /**
- * Customizer Initialization
- *
- * @since 1.0.0
- */
- class Astra_Ext_Transparent_Header_Loader {
-
- /**
- * Member Variable
- *
- * @var instance
- */
- private static $instance;
-
- /**
- * Initiator
- */
- public static function get_instance() {
- if ( ! isset( self::$instance ) ) {
- self::$instance = new self();
- }
- return self::$instance;
- }
-
- /**
- * Constructor
- */
- public function __construct() {
-
- add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) );
- add_action( 'customize_preview_init', array( $this, 'preview_scripts' ) );
- add_action( 'customize_register', array( $this, 'customize_register' ), 2 );
-
- }
-
- /**
- * Set Options Default Values
- *
- * @param array $defaults Astra options default value array.
- * @return array
- */
- public function theme_defaults( $defaults ) {
-
- // Header - Transparent.
- $defaults['transparent-header-logo'] = '';
- $defaults['transparent-header-retina-logo'] = '';
- $defaults['different-transparent-logo'] = 0;
- $defaults['different-transparent-retina-logo'] = 0;
- $defaults['transparent-header-logo-width'] = array(
- 'desktop' => 150,
- 'tablet' => 120,
- 'mobile' => 100,
- );
- $defaults['transparent-header-enable'] = 0;
- $defaults['transparent-header-disable-archive'] = 1;
- $defaults['transparent-header-disable-latest-posts-index'] = 1;
- $defaults['transparent-header-on-devices'] = 'both';
- $defaults['transparent-header-main-sep'] = '';
- $defaults['transparent-header-main-sep-color'] = '';
-
- /**
- * Transparent Header
- */
- $defaults['transparent-header-bg-color'] = '';
- $defaults['transparent-header-color-site-title'] = '';
- $defaults['transparent-header-color-h-site-title'] = '';
- $defaults['transparent-menu-bg-color'] = '';
- $defaults['transparent-menu-color'] = '';
- $defaults['transparent-menu-h-color'] = '';
- $defaults['transparent-submenu-bg-color'] = '';
- $defaults['transparent-submenu-color'] = '';
- $defaults['transparent-submenu-h-color'] = '';
-
- /**
- * Transparent Header Responsive Colors
- */
- $defaults['transparent-header-bg-color-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['transparent-header-color-site-title-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['transparent-header-color-h-site-title-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['transparent-menu-bg-color-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['transparent-menu-color-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['transparent-menu-h-color-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['transparent-submenu-bg-color-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['transparent-submenu-color-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['transparent-submenu-h-color-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- $defaults['transparent-content-section-text-color-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
- $defaults['transparent-content-section-link-color-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
- $defaults['transparent-content-section-link-h-color-responsive'] = array(
- 'desktop' => '',
- 'tablet' => '',
- 'mobile' => '',
- );
-
- return $defaults;
- }
-
- /**
- * Add postMessage support for site title and description for the Theme Customizer.
- *
- * @param WP_Customize_Manager $wp_customize Theme Customizer object.
- */
- public function customize_register( $wp_customize ) {
-
- // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
- /**
- * Register Panel & Sections
- */
- require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/class-astra-transparent-header-panels-and-sections.php';
-
- /**
- * Sections
- */
- require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/sections/class-astra-customizer-colors-transparent-header-configs.php';
- // Check Transparent Header is activated.
- require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/sections/class-astra-customizer-transparent-header-configs.php';
- // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
- }
-
- /**
- * Customizer Preview
- */
- public function preview_scripts() {
- /**
- * Load unminified if SCRIPT_DEBUG is true.
- */
- /* Directory and Extension */
- $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
- $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
- wp_enqueue_script( 'astra-transparent-header-customizer-preview-js', ASTRA_THEME_TRANSPARENT_HEADER_URI . 'assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true );
-
- // Localize variables for further JS.
- wp_localize_script(
- 'astra-transparent-header-customizer-preview-js',
- 'AstraBuilderTransparentData',
- array(
- 'is_astra_hf_builder_active' => Astra_Builder_Helper::$is_header_footer_builder_active,
- 'is_flex_based_css' => Astra_Builder_Helper::apply_flex_based_css(),
- )
- );
- }
- }
-}
-
-/**
-* Kicking this off by calling 'get_instance()' method
-*/
-Astra_Ext_Transparent_Header_Loader::get_instance();
+<?php +/** + * Sticky Header - Customizer. + * + * @package Astra Addon + * @since 1.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +if ( ! class_exists( 'Astra_Ext_Transparent_Header_Loader' ) ) { + + /** + * Customizer Initialization + * + * @since 1.0.0 + */ + class Astra_Ext_Transparent_Header_Loader { + + /** + * Member Variable + * + * @var instance + */ + private static $instance; + + /** + * Initiator + */ + public static function get_instance() { + if ( ! isset( self::$instance ) ) { + self::$instance = new self(); + } + return self::$instance; + } + + /** + * Constructor + */ + public function __construct() { + + add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) ); + add_action( 'customize_preview_init', array( $this, 'preview_scripts' ) ); + add_action( 'customize_register', array( $this, 'customize_register' ), 2 ); + + } + + /** + * Set Options Default Values + * + * @param array $defaults Astra options default value array. + * @return array + */ + public function theme_defaults( $defaults ) { + + // Header - Transparent. + $defaults['transparent-header-logo'] = ''; + $defaults['transparent-header-retina-logo'] = ''; + $defaults['different-transparent-logo'] = 0; + $defaults['different-transparent-retina-logo'] = 0; + $defaults['transparent-header-logo-width'] = array( + 'desktop' => 150, + 'tablet' => 120, + 'mobile' => 100, + ); + $defaults['transparent-header-enable'] = 0; + $defaults['transparent-header-disable-archive'] = 1; + $defaults['transparent-header-disable-latest-posts-index'] = 1; + $defaults['transparent-header-on-devices'] = 'both'; + $defaults['transparent-header-main-sep'] = ''; + $defaults['transparent-header-main-sep-color'] = ''; + + /** + * Transparent Header + */ + $defaults['transparent-header-bg-color'] = ''; + $defaults['transparent-header-color-site-title'] = ''; + $defaults['transparent-header-color-h-site-title'] = ''; + $defaults['transparent-menu-bg-color'] = ''; + $defaults['transparent-menu-color'] = ''; + $defaults['transparent-menu-h-color'] = ''; + $defaults['transparent-submenu-bg-color'] = ''; + $defaults['transparent-submenu-color'] = ''; + $defaults['transparent-submenu-h-color'] = ''; + + /** + * Transparent Header Responsive Colors + */ + $defaults['transparent-header-bg-color-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['transparent-header-color-site-title-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['transparent-header-color-h-site-title-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['transparent-menu-bg-color-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['transparent-menu-color-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['transparent-menu-h-color-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['transparent-submenu-bg-color-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['transparent-submenu-color-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['transparent-submenu-h-color-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + $defaults['transparent-content-section-text-color-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + $defaults['transparent-content-section-link-color-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + $defaults['transparent-content-section-link-h-color-responsive'] = array( + 'desktop' => '', + 'tablet' => '', + 'mobile' => '', + ); + + return $defaults; + } + + /** + * Add postMessage support for site title and description for the Theme Customizer. + * + * @param WP_Customize_Manager $wp_customize Theme Customizer object. + */ + public function customize_register( $wp_customize ) { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + /** + * Register Panel & Sections + */ + require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/class-astra-transparent-header-panels-and-sections.php'; + + /** + * Sections + */ + require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/sections/class-astra-customizer-colors-transparent-header-configs.php'; + // Check Transparent Header is activated. + require_once ASTRA_THEME_TRANSPARENT_HEADER_DIR . 'classes/sections/class-astra-customizer-transparent-header-configs.php'; + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + + /** + * Customizer Preview + */ + public function preview_scripts() { + /** + * Load unminified if SCRIPT_DEBUG is true. + */ + /* Directory and Extension */ + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_script( 'astra-transparent-header-customizer-preview-js', ASTRA_THEME_TRANSPARENT_HEADER_URI . 'assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); + + // Localize variables for further JS. + wp_localize_script( + 'astra-transparent-header-customizer-preview-js', + 'AstraBuilderTransparentData', + array( + 'is_astra_hf_builder_active' => Astra_Builder_Helper::$is_header_footer_builder_active, + 'is_flex_based_css' => Astra_Builder_Helper::apply_flex_based_css(), + ) + ); + } + } +} + +/** +* Kicking this off by calling 'get_instance()' method +*/ +Astra_Ext_Transparent_Header_Loader::get_instance(); diff --git a/inc/addons/transparent-header/classes/class-astra-ext-transparent-header-markup.php b/inc/addons/transparent-header/classes/class-astra-ext-transparent-header-markup.php index 4c1462e..bd6a0a0 100644 --- a/inc/addons/transparent-header/classes/class-astra-ext-transparent-header-markup.php +++ b/inc/addons/transparent-header/classes/class-astra-ext-transparent-header-markup.php @@ -1,386 +1,386 @@ -<?php
-/**
- * Sticky Header Markup
- *
- * @package Astra Addon
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-if ( ! class_exists( 'Astra_ExtTransparenty_Header_Markup' ) ) {
-
- /**
- * Sticky Header Markup Initial Setup
- *
- * @since 1.0.0
- */
- class Astra_Ext_Transparent_Header_Markup {
-
- /**
- * Member Variable
- *
- * @var object instance
- */
- private static $instance;
-
- /**
- * Initiator
- */
- public static function get_instance() {
- if ( ! isset( self::$instance ) ) {
- self::$instance = new self();
- }
- return self::$instance;
- }
-
- /**
- * Constructor
- */
- public function __construct() {
-
- add_action( 'body_class', array( $this, 'add_body_class' ) );
-
- /* Fixed header markup */
- add_action( 'astra_header', array( $this, 'transparent_header_logo' ), 1 );
-
- /**
- * Metabox setup
- */
- add_filter( 'astra_meta_box_options', array( $this, 'add_options' ) );
- add_action( 'astra_meta_box_markup_after', array( $this, 'add_options_markup' ) );
-
- add_action( 'astra_customizer_save', array( $this, 'customizer_save' ) );
- }
-
- /**
- * Add Body Classes
- *
- * @param array $classes Body Class Array.
- * @return array
- */
- public function add_body_class( $classes ) {
-
- $inherit_desk_logo = astra_get_option( 'different-transparent-logo', false );
- $transparent_header_logo = astra_get_option( 'transparent-header-logo', true );
- $transparent_header_logo_retina = astra_get_option( 'transparent-header-retina-logo', true );
-
- if ( '1' == $inherit_desk_logo && ( '' !== $transparent_header_logo || '' !== $transparent_header_logo_retina ) ) {
- $classes[] = 'ast-replace-site-logo-transparent';
- }
-
- if ( '1' !== $inherit_desk_logo ) {
- $classes[] = 'ast-inherit-site-logo-transparent';
- }
-
- /**
- * Add class 'ast-theme-transparent-header'
- */
-
- if ( self::is_transparent_header() ) {
- $classes[] = 'ast-theme-transparent-header';
- }
-
- return $classes;
- }
-
- /**
- * Astra check if transparent header is enabled.
- *
- * @return boolean true/false.
- */
- public static function is_transparent_header() {
-
- // Transparent Header.
- $enable_trans_header = astra_get_option( 'transparent-header-enable' );
- $trans_meta_option = astra_get_option_meta( 'theme-transparent-header-meta', 'default' );
-
- if ( $enable_trans_header ) {
-
- if ( ( is_archive() || is_search() || is_404() ) && '1' == astra_get_option( 'transparent-header-disable-archive' ) ) {
- $enable_trans_header = false;
- }
-
- if ( is_home() && '1' == astra_get_option( 'transparent-header-disable-index' ) && ( 'posts' !== get_option( 'show_on_front' ) ) ) {
- $enable_trans_header = false;
- }
-
- if ( is_front_page() && 'posts' == get_option( 'show_on_front' ) && '1' == astra_get_option( 'transparent-header-disable-latest-posts-index' ) ) {
- $enable_trans_header = false;
- }
-
- if ( is_page() && '1' == astra_get_option( 'transparent-header-disable-page' ) ) {
- $enable_trans_header = false;
- }
-
- if ( is_single() && '1' == astra_get_option( 'transparent-header-disable-posts' ) ) {
- $enable_trans_header = false;
- }
- }
-
- if ( class_exists( 'Astra_Woocommerce' ) ) {
- if ( is_product() && '1' == astra_get_option( 'transparent-header-disable-woo-products' ) ) {
- $enable_trans_header = false;
- }
- }
-
- // Force Meta settings to override global settings.
- if ( 'enabled' === $trans_meta_option ) {
- $enable_trans_header = true;
- } elseif ( 'disabled' === $trans_meta_option ) {
- $enable_trans_header = false;
- }
-
- return apply_filters( 'astra_is_transparent_header', $enable_trans_header );
- }
-
- /**
- * Site Header - <header>
- *
- * @since 1.0.0
- */
- public function transparent_header_logo() {
-
- $inherit_desk_logo = astra_get_option( 'different-transparent-logo', false );
- $transparent_header_logo = astra_get_option( 'transparent-header-logo' );
-
- if ( self::is_transparent_header() && '1' == $inherit_desk_logo && '' !== $transparent_header_logo ) {
- // Logo For None Effect.
- add_filter( 'astra_has_custom_logo', '__return_true' );
- add_filter( 'get_custom_logo', array( $this, 'transparent_custom_logo' ), 10, 2 );
- }
- }
-
-
- /**
- * Replace transparent header logo.
- *
- * @param sting $html Size name.
- * @param int $blog_id Icon.
- *
- * @return string html markup of logo.
- */
- public function transparent_custom_logo( $html, $blog_id ) {
-
- $trans_logo = astra_get_option( 'transparent-header-logo' );
- $transparent_header_devices = astra_get_option( 'transparent-header-on-devices' );
-
- if ( '' !== $trans_logo ) {
-
- /* Replace transparent header logo and width */
- add_filter( 'wp_get_attachment_image_attributes', array( $this, 'replace_trans_header_attr' ), 10, 3 );
-
- $custom_logo_id = attachment_url_to_postid( $trans_logo );
-
- $size = 'ast-transparent-logo-size';
-
- if ( is_customize_preview() ) {
- $size = 'full';
- }
-
- $html = sprintf(
- '<a href="%1$s" class="custom-logo-link transparent-custom-logo" rel="home" itemprop="url">%2$s</a>',
- esc_url( home_url( '/' ) ),
- wp_get_attachment_image(
- $custom_logo_id,
- $size,
- false,
- array(
- 'class' => 'custom-logo',
- )
- )
- );
-
- if ( 'mobile' === $transparent_header_devices ) {
-
- $html .= sprintf(
- '<a href="%1$s" class="custom-logo-link ast-transparent-desktop-logo" rel="home" itemprop="url">%2$s</a>',
- esc_url( home_url( '/' ) ),
- wp_get_attachment_image(
- get_theme_mod( 'custom_logo' ),
- $size,
- false,
- array(
- 'class' => 'custom-logo',
- )
- )
- );
- }
-
- if ( 'desktop' === $transparent_header_devices ) {
-
- $html .= sprintf(
- '<a href="%1$s" class="custom-logo-link ast-transparent-mobile-logo" rel="home" itemprop="url">%2$s</a>',
- esc_url( home_url( '/' ) ),
- wp_get_attachment_image(
- get_theme_mod( 'custom_logo' ),
- $size,
- false,
- array(
- 'class' => 'custom-logo',
- )
- )
- );
- }
-
- remove_filter( 'wp_get_attachment_image_attributes', array( $this, 'replace_trans_header_attr' ) );
- }
-
- return $html;
- }
-
-
-
- /**
- * Replace transparent header logo.
- *
- * @param array $attr Image.
- * @param object $attachment Image obj.
- * @param sting $size Size name.
- *
- * @return array Image attr.
- */
- public function replace_trans_header_attr( $attr, $attachment, $size ) {
-
- $trans_logo = astra_get_option( 'transparent-header-logo' );
- $custom_logo_id = attachment_url_to_postid( $trans_logo );
-
- if ( $custom_logo_id == $attachment->ID ) {
-
- $attach_data = array();
- if ( ! is_customize_preview() ) {
- $attach_data = wp_get_attachment_image_src( $attachment->ID, 'ast-transparent-logo-size' );
- if ( isset( $attach_data[0] ) ) {
- $attr['src'] = $attach_data[0];
- }
- }
-
- $file_type = wp_check_filetype( $attr['src'] );
- $file_extension = $file_type['ext'];
-
- if ( 'svg' == $file_extension ) {
- $attr['class'] = 'astra-logo-svg';
- }
-
- $diff_retina_logo = astra_get_option( 'different-transparent-retina-logo' );
-
- if ( '1' == $diff_retina_logo ) {
-
- $retina_logo = astra_get_option( 'transparent-header-retina-logo' );
-
- $attr['srcset'] = '';
-
- if ( apply_filters( 'astra_transparent_header_retina', true ) && '' !== $retina_logo ) {
- $cutom_logo = wp_get_attachment_image_src( $custom_logo_id, 'full' );
- $cutom_logo_url = $cutom_logo[0];
-
- if ( astra_check_is_ie() ) {
- // Replace header logo url to retina logo url.
- $attr['src'] = $retina_logo;
- }
-
- $attr['srcset'] = $cutom_logo_url . ' 1x, ' . $retina_logo . ' 2x';
-
- }
- }
- }
-
- return $attr;
- }
-
- /**
- * Add Meta Options
- *
- * @param array $meta_option Page Meta.
- * @return array
- */
- public function add_options( $meta_option ) {
-
- $meta_option['theme-transparent-header-meta'] = array(
- 'sanitize' => 'FILTER_DEFAULT',
- );
-
- return $meta_option;
- }
-
- /**
- * Transparent Header Meta Field markup
- *
- * Loads appropriate template file based on the style option selected in options panel.
- *
- * @param array $meta Page Meta.
- * @since 1.0.0
- */
- public function add_options_markup( $meta ) {
-
- /**
- * Get options
- */
- $trans_header_meta = ( isset( $meta['theme-transparent-header-meta']['default'] ) ) ? $meta['theme-transparent-header-meta']['default'] : 'default';
- $show_meta_field = ! astra_check_is_bb_themer_layout();
- ?>
-
- <?php if ( $show_meta_field ) { ?>
- <div class="transparent-header-wrapper">
- <p class="post-attributes-label-wrapper">
- <strong> <?php esc_html_e( 'Transparent Header', 'astra' ); ?> </strong><br/>
- </p>
- <select name="theme-transparent-header-meta" id="theme-transparent-header-meta">
- <option value="default" <?php selected( $trans_header_meta, 'default' ); ?>> <?php esc_html_e( 'Customizer Setting', 'astra' ); ?> </option>
- <option value="enabled" <?php selected( $trans_header_meta, 'enabled' ); ?>> <?php esc_html_e( 'Enabled', 'astra' ); ?> </option>
- <option value="disabled" <?php selected( $trans_header_meta, 'disabled' ); ?>> <?php esc_html_e( 'Disabled', 'astra' ); ?> </option>
- </select>
- </div>
- <?php } ?>
-
- <?php
- }
-
- /**
- * Add Styles Callback
- */
- public function customizer_save() {
-
- /* Generate Transparent Header Logo */
- $trans_logo = astra_get_option( 'transparent-header-logo' );
-
- if ( '' !== $trans_logo ) {
- add_filter( 'intermediate_image_sizes_advanced', array( $this, 'transparent_logo_image_sizes' ), 10, 2 );
- $trans_logo_id = attachment_url_to_postid( $trans_logo );
- Astra_Customizer::generate_logo_by_width( $trans_logo_id );
- remove_filter( 'intermediate_image_sizes_advanced', array( $this, 'transparent_logo_image_sizes' ), 10 );
- }
- }
-
- /**
- * Add logo image sizes in filter.
- *
- * @since 1.0.0
- * @param array $sizes Sizes.
- * @param array $metadata attachment data.
- *
- * @return array
- */
- public function transparent_logo_image_sizes( $sizes, $metadata ) {
-
- $logo_width = astra_get_option( 'transparent-header-logo-width' );
-
- if ( is_array( $sizes ) && '' != $logo_width['desktop'] ) {
- $max_value = max( $logo_width );
- $sizes['ast-transparent-logo-size'] = array(
- 'width' => (int) $max_value,
- 'height' => 0,
- 'crop' => false,
- );
- }
-
- return $sizes;
- }
- }
-}
-
-/**
-* Kicking this off by calling 'get_instance()' method
-*/
-Astra_Ext_Transparent_Header_Markup::get_instance();
+<?php +/** + * Sticky Header Markup + * + * @package Astra Addon + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +if ( ! class_exists( 'Astra_ExtTransparenty_Header_Markup' ) ) { + + /** + * Sticky Header Markup Initial Setup + * + * @since 1.0.0 + */ + class Astra_Ext_Transparent_Header_Markup { + + /** + * Member Variable + * + * @var object instance + */ + private static $instance; + + /** + * Initiator + */ + public static function get_instance() { + if ( ! isset( self::$instance ) ) { + self::$instance = new self(); + } + return self::$instance; + } + + /** + * Constructor + */ + public function __construct() { + + add_action( 'body_class', array( $this, 'add_body_class' ) ); + + /* Fixed header markup */ + add_action( 'astra_header', array( $this, 'transparent_header_logo' ), 1 ); + + /** + * Metabox setup + */ + add_filter( 'astra_meta_box_options', array( $this, 'add_options' ) ); + add_action( 'astra_meta_box_markup_after', array( $this, 'add_options_markup' ) ); + + add_action( 'astra_customizer_save', array( $this, 'customizer_save' ) ); + } + + /** + * Add Body Classes + * + * @param array $classes Body Class Array. + * @return array + */ + public function add_body_class( $classes ) { + + $inherit_desk_logo = astra_get_option( 'different-transparent-logo', false ); + $transparent_header_logo = astra_get_option( 'transparent-header-logo', true ); + $transparent_header_logo_retina = astra_get_option( 'transparent-header-retina-logo', true ); + + if ( '1' == $inherit_desk_logo && ( '' !== $transparent_header_logo || '' !== $transparent_header_logo_retina ) ) { + $classes[] = 'ast-replace-site-logo-transparent'; + } + + if ( '1' !== $inherit_desk_logo ) { + $classes[] = 'ast-inherit-site-logo-transparent'; + } + + /** + * Add class 'ast-theme-transparent-header' + */ + + if ( self::is_transparent_header() ) { + $classes[] = 'ast-theme-transparent-header'; + } + + return $classes; + } + + /** + * Astra check if transparent header is enabled. + * + * @return boolean true/false. + */ + public static function is_transparent_header() { + + // Transparent Header. + $enable_trans_header = astra_get_option( 'transparent-header-enable' ); + $trans_meta_option = astra_get_option_meta( 'theme-transparent-header-meta', 'default' ); + + if ( $enable_trans_header ) { + + if ( ( is_archive() || is_search() || is_404() ) && '1' == astra_get_option( 'transparent-header-disable-archive' ) ) { + $enable_trans_header = false; + } + + if ( is_home() && '1' == astra_get_option( 'transparent-header-disable-index' ) && ( 'posts' !== get_option( 'show_on_front' ) ) ) { + $enable_trans_header = false; + } + + if ( is_front_page() && 'posts' == get_option( 'show_on_front' ) && '1' == astra_get_option( 'transparent-header-disable-latest-posts-index' ) ) { + $enable_trans_header = false; + } + + if ( is_page() && '1' == astra_get_option( 'transparent-header-disable-page' ) ) { + $enable_trans_header = false; + } + + if ( is_single() && '1' == astra_get_option( 'transparent-header-disable-posts' ) ) { + $enable_trans_header = false; + } + } + + if ( class_exists( 'Astra_Woocommerce' ) ) { + if ( is_product() && '1' == astra_get_option( 'transparent-header-disable-woo-products' ) ) { + $enable_trans_header = false; + } + } + + // Force Meta settings to override global settings. + if ( 'enabled' === $trans_meta_option ) { + $enable_trans_header = true; + } elseif ( 'disabled' === $trans_meta_option ) { + $enable_trans_header = false; + } + + return apply_filters( 'astra_is_transparent_header', $enable_trans_header ); + } + + /** + * Site Header - <header> + * + * @since 1.0.0 + */ + public function transparent_header_logo() { + + $inherit_desk_logo = astra_get_option( 'different-transparent-logo', false ); + $transparent_header_logo = astra_get_option( 'transparent-header-logo' ); + + if ( self::is_transparent_header() && '1' == $inherit_desk_logo && '' !== $transparent_header_logo ) { + // Logo For None Effect. + add_filter( 'astra_has_custom_logo', '__return_true' ); + add_filter( 'get_custom_logo', array( $this, 'transparent_custom_logo' ), 10, 2 ); + } + } + + + /** + * Replace transparent header logo. + * + * @param sting $html Size name. + * @param int $blog_id Icon. + * + * @return string html markup of logo. + */ + public function transparent_custom_logo( $html, $blog_id ) { + + $trans_logo = astra_get_option( 'transparent-header-logo' ); + $transparent_header_devices = astra_get_option( 'transparent-header-on-devices' ); + + if ( '' !== $trans_logo ) { + + /* Replace transparent header logo and width */ + add_filter( 'wp_get_attachment_image_attributes', array( $this, 'replace_trans_header_attr' ), 10, 3 ); + + $custom_logo_id = attachment_url_to_postid( $trans_logo ); + + $size = 'ast-transparent-logo-size'; + + if ( is_customize_preview() ) { + $size = 'full'; + } + + $html = sprintf( + '<a href="%1$s" class="custom-logo-link transparent-custom-logo" rel="home" itemprop="url">%2$s</a>', + esc_url( home_url( '/' ) ), + wp_get_attachment_image( + $custom_logo_id, + $size, + false, + array( + 'class' => 'custom-logo', + ) + ) + ); + + if ( 'mobile' === $transparent_header_devices ) { + + $html .= sprintf( + '<a href="%1$s" class="custom-logo-link ast-transparent-desktop-logo" rel="home" itemprop="url">%2$s</a>', + esc_url( home_url( '/' ) ), + wp_get_attachment_image( + get_theme_mod( 'custom_logo' ), + $size, + false, + array( + 'class' => 'custom-logo', + ) + ) + ); + } + + if ( 'desktop' === $transparent_header_devices ) { + + $html .= sprintf( + '<a href="%1$s" class="custom-logo-link ast-transparent-mobile-logo" rel="home" itemprop="url">%2$s</a>', + esc_url( home_url( '/' ) ), + wp_get_attachment_image( + get_theme_mod( 'custom_logo' ), + $size, + false, + array( + 'class' => 'custom-logo', + ) + ) + ); + } + + remove_filter( 'wp_get_attachment_image_attributes', array( $this, 'replace_trans_header_attr' ) ); + } + + return $html; + } + + + + /** + * Replace transparent header logo. + * + * @param array $attr Image. + * @param object $attachment Image obj. + * @param sting $size Size name. + * + * @return array Image attr. + */ + public function replace_trans_header_attr( $attr, $attachment, $size ) { + + $trans_logo = astra_get_option( 'transparent-header-logo' ); + $custom_logo_id = attachment_url_to_postid( $trans_logo ); + + if ( $custom_logo_id == $attachment->ID ) { + + $attach_data = array(); + if ( ! is_customize_preview() ) { + $attach_data = wp_get_attachment_image_src( $attachment->ID, 'ast-transparent-logo-size' ); + if ( isset( $attach_data[0] ) ) { + $attr['src'] = $attach_data[0]; + } + } + + $file_type = wp_check_filetype( $attr['src'] ); + $file_extension = $file_type['ext']; + + if ( 'svg' == $file_extension ) { + $attr['class'] = 'astra-logo-svg'; + } + + $diff_retina_logo = astra_get_option( 'different-transparent-retina-logo' ); + + if ( '1' == $diff_retina_logo ) { + + $retina_logo = astra_get_option( 'transparent-header-retina-logo' ); + + $attr['srcset'] = ''; + + if ( apply_filters( 'astra_transparent_header_retina', true ) && '' !== $retina_logo ) { + $cutom_logo = wp_get_attachment_image_src( $custom_logo_id, 'full' ); + $cutom_logo_url = $cutom_logo[0]; + + if ( astra_check_is_ie() ) { + // Replace header logo url to retina logo url. + $attr['src'] = $retina_logo; + } + + $attr['srcset'] = $cutom_logo_url . ' 1x, ' . $retina_logo . ' 2x'; + + } + } + } + + return $attr; + } + + /** + * Add Meta Options + * + * @param array $meta_option Page Meta. + * @return array + */ + public function add_options( $meta_option ) { + + $meta_option['theme-transparent-header-meta'] = array( + 'sanitize' => 'FILTER_DEFAULT', + ); + + return $meta_option; + } + + /** + * Transparent Header Meta Field markup + * + * Loads appropriate template file based on the style option selected in options panel. + * + * @param array $meta Page Meta. + * @since 1.0.0 + */ + public function add_options_markup( $meta ) { + + /** + * Get options + */ + $trans_header_meta = ( isset( $meta['theme-transparent-header-meta']['default'] ) ) ? $meta['theme-transparent-header-meta']['default'] : 'default'; + $show_meta_field = ! astra_check_is_bb_themer_layout(); + ?> + + <?php if ( $show_meta_field ) { ?> + <div class="transparent-header-wrapper"> + <p class="post-attributes-label-wrapper"> + <strong> <?php esc_html_e( 'Transparent Header', 'astra' ); ?> </strong><br/> + </p> + <select name="theme-transparent-header-meta" id="theme-transparent-header-meta"> + <option value="default" <?php selected( $trans_header_meta, 'default' ); ?>> <?php esc_html_e( 'Customizer Setting', 'astra' ); ?> </option> + <option value="enabled" <?php selected( $trans_header_meta, 'enabled' ); ?>> <?php esc_html_e( 'Enabled', 'astra' ); ?> </option> + <option value="disabled" <?php selected( $trans_header_meta, 'disabled' ); ?>> <?php esc_html_e( 'Disabled', 'astra' ); ?> </option> + </select> + </div> + <?php } ?> + + <?php + } + + /** + * Add Styles Callback + */ + public function customizer_save() { + + /* Generate Transparent Header Logo */ + $trans_logo = astra_get_option( 'transparent-header-logo' ); + + if ( '' !== $trans_logo ) { + add_filter( 'intermediate_image_sizes_advanced', array( $this, 'transparent_logo_image_sizes' ), 10, 2 ); + $trans_logo_id = attachment_url_to_postid( $trans_logo ); + Astra_Customizer::generate_logo_by_width( $trans_logo_id ); + remove_filter( 'intermediate_image_sizes_advanced', array( $this, 'transparent_logo_image_sizes' ), 10 ); + } + } + + /** + * Add logo image sizes in filter. + * + * @since 1.0.0 + * @param array $sizes Sizes. + * @param array $metadata attachment data. + * + * @return array + */ + public function transparent_logo_image_sizes( $sizes, $metadata ) { + + $logo_width = astra_get_option( 'transparent-header-logo-width' ); + + if ( is_array( $sizes ) && '' != $logo_width['desktop'] ) { + $max_value = max( $logo_width ); + $sizes['ast-transparent-logo-size'] = array( + 'width' => (int) $max_value, + 'height' => 0, + 'crop' => false, + ); + } + + return $sizes; + } + } +} + +/** +* Kicking this off by calling 'get_instance()' method +*/ +Astra_Ext_Transparent_Header_Markup::get_instance(); diff --git a/inc/addons/transparent-header/classes/class-astra-transparent-header-panels-and-sections.php b/inc/addons/transparent-header/classes/class-astra-transparent-header-panels-and-sections.php index 42a8bc3..724cfa0 100644 --- a/inc/addons/transparent-header/classes/class-astra-transparent-header-panels-and-sections.php +++ b/inc/addons/transparent-header/classes/class-astra-transparent-header-panels-and-sections.php @@ -1,71 +1,71 @@ -<?php
-/**
- * Transparent Header Options for our theme.
- *
- * @package Astra Addon
- * @author Brainstorm Force
- * @copyright Copyright (c) 2020, Brainstorm Force
- * @link https://www.brainstormforce.com
- * @since Astra 1.4.3
- */
-
-// Block direct access to the file.
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-// Bail if Customizer config base class does not exist.
-if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) {
- return;
-}
-
-/**
- * Customizer Sanitizes
- *
- * @since 1.4.3
- */
-if ( ! class_exists( 'Astra_Transparent_Header_Panels_And_Sections' ) ) {
-
- /**
- * Register Transparent Header Customizer Configurations.
- */
- class Astra_Transparent_Header_Panels_And_Sections extends Astra_Customizer_Config_Base {
-
- /**
- * Register Transparent Header Customizer Configurations.
- *
- * @param Array $configurations Astra Customizer Configurations.
- * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
- * @since 1.4.3
- * @return Array Astra Customizer Configurations with updated configurations.
- */
- public function register_configuration( $configurations, $wp_customize ) {
-
- $_configs = array(
-
- array(
- 'name' => 'section-transparent-header',
- 'title' => __( 'Transparent Header', 'astra' ),
- 'panel' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? 'panel-header-builder-group' : 'panel-header-group',
- 'type' => 'section',
- 'priority' => 33,
- ),
-
- array(
- 'name' => 'section-colors-header-group',
- 'type' => 'section',
- 'title' => __( 'Header', 'astra' ),
- 'panel' => 'panel-colors-background',
- 'priority' => 20,
- ),
- );
-
- return array_merge( $configurations, $_configs );
- }
- }
-}
-
-/**
- * Kicking this off by calling 'get_instance()' method
- */
-new Astra_Transparent_Header_Panels_And_Sections();
+<?php +/** + * Transparent Header Options for our theme. + * + * @package Astra Addon + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 1.4.3 + */ + +// Block direct access to the file. +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +// Bail if Customizer config base class does not exist. +if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { + return; +} + +/** + * Customizer Sanitizes + * + * @since 1.4.3 + */ +if ( ! class_exists( 'Astra_Transparent_Header_Panels_And_Sections' ) ) { + + /** + * Register Transparent Header Customizer Configurations. + */ + class Astra_Transparent_Header_Panels_And_Sections extends Astra_Customizer_Config_Base { + + /** + * Register Transparent Header Customizer Configurations. + * + * @param Array $configurations Astra Customizer Configurations. + * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. + * @since 1.4.3 + * @return Array Astra Customizer Configurations with updated configurations. + */ + public function register_configuration( $configurations, $wp_customize ) { + + $_configs = array( + + array( + 'name' => 'section-transparent-header', + 'title' => __( 'Transparent Header', 'astra' ), + 'panel' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? 'panel-header-builder-group' : 'panel-header-group', + 'type' => 'section', + 'priority' => 33, + ), + + array( + 'name' => 'section-colors-header-group', + 'type' => 'section', + 'title' => __( 'Header', 'astra' ), + 'panel' => 'panel-colors-background', + 'priority' => 20, + ), + ); + + return array_merge( $configurations, $_configs ); + } + } +} + +/** + * Kicking this off by calling 'get_instance()' method + */ +new Astra_Transparent_Header_Panels_And_Sections(); diff --git a/inc/addons/transparent-header/classes/dynamic-css/dynamic.css.php b/inc/addons/transparent-header/classes/dynamic-css/dynamic.css.php index 3f8cb0b..7de0a50 100644 --- a/inc/addons/transparent-header/classes/dynamic-css/dynamic.css.php +++ b/inc/addons/transparent-header/classes/dynamic-css/dynamic.css.php @@ -1,498 +1,498 @@ -<?php
-/**
- * Transparent Header - Dynamic CSS
- *
- * @package Astra Addon
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-add_filter( 'astra_dynamic_theme_css', 'astra_ext_transparent_header_dynamic_css' );
-
-/**
- * Dynamic CSS
- *
- * @param String $dynamic_css Astra Dynamic CSS.
- * @param String $dynamic_css_filtered Astra Dynamic CSS Filters.
- * @return String Dynamic CSS.
- */
-function astra_ext_transparent_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) {
-
- if ( true != Astra_Ext_Transparent_Header_Markup::is_transparent_header() ) {
- return $dynamic_css;
- }
-
- /**
- * Set colors
- *
- * If colors extension is_active then get color from it.
- * Else set theme default colors.
- */
- $transparent_header_separator = astra_get_option( 'transparent-header-main-sep' );
- $transparent_header_separator_color = astra_get_option( 'transparent-header-main-sep-color' );
-
- $transparent_header_logo_width = astra_get_option( 'transparent-header-logo-width' );
-
- $transparent_header_inherit = astra_get_option( 'different-transparent-logo' );
- $transparent_header_logo = astra_get_option( 'transparent-header-logo' );
-
- $transparent_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'desktop' );
- $transparent_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'tablet', $transparent_bg_color_desktop );
- $transparent_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'mobile', ( $transparent_bg_color_tablet ) ? $transparent_bg_color_tablet : $transparent_bg_color_desktop );
-
- $transparent_color_site_title_desktop = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'desktop' );
- $transparent_color_site_title_tablet = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'tablet' );
- $transparent_color_site_title_mobile = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'mobile' );
-
- $transparent_color_h_site_title_desktop = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'desktop' );
- $transparent_color_h_site_title_tablet = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'tablet' );
- $transparent_color_h_site_title_mobile = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'mobile' );
-
- $transparent_menu_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'desktop' );
- $transparent_menu_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'desktop' );
- $transparent_menu_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'desktop' );
-
- $transparent_menu_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'tablet' );
- $transparent_menu_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'tablet' );
- $transparent_menu_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'tablet' );
-
- $transparent_menu_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'mobile' );
- $transparent_menu_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'mobile' );
- $transparent_menu_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'mobile' );
-
- $transparent_sub_menu_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'desktop' );
- $transparent_sub_menu_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'desktop' );
- $transparent_sub_menu_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'desktop' );
-
- $transparent_sub_menu_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'tablet' );
- $transparent_sub_menu_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'tablet' );
- $transparent_sub_menu_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'tablet' );
-
- $transparent_sub_menu_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'mobile' );
- $transparent_sub_menu_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'mobile' );
- $transparent_sub_menu_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'mobile' );
-
- $transparent_content_section_text_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'desktop' );
- $transparent_content_section_link_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'desktop' );
- $transparent_content_section_link_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'desktop' );
-
- $transparent_content_section_text_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'tablet' );
- $transparent_content_section_link_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'tablet' );
- $transparent_content_section_link_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'tablet' );
-
- $transparent_content_section_text_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'mobile' );
- $transparent_content_section_link_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'mobile' );
- $transparent_content_section_link_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'mobile' );
-
- $transparent_header_devices = astra_get_option( 'transparent-header-on-devices' );
-
- /**
- * Generate Dynamic CSS
- */
-
- $css = '';
-
- if ( '0' === $transparent_header_inherit && '' != $transparent_header_logo ) {
- $css_output = array(
- '.ast-theme-transparent-header .site-logo-img .custom-logo-link' => array(
- 'display' => 'none',
- ),
- );
- $css .= astra_parse_css( $css_output );
- }
-
- // Desktop Transparent Heder Logo Width.
- $css_output = array(
- '.ast-theme-transparent-header #masthead .site-logo-img .transparent-custom-logo .astra-logo-svg' => array(
- 'width' => astra_get_css_value( $transparent_header_logo_width['desktop'], 'px' ),
- 'height' => astra_get_css_value( ( ! empty( $transparent_header_logo_width['desktop-svg-height'] ) && ! is_customize_preview() ) ? $transparent_header_logo_width['desktop-svg-height'] : '', 'px' ),
- ),
- '.ast-theme-transparent-header #masthead .site-logo-img .transparent-custom-logo img' => array(
- ' max-width' => astra_get_css_value( $transparent_header_logo_width['desktop'], 'px' ),
- ),
- );
- $css .= astra_parse_css( $css_output );
-
- // Tablet Transparent Heder Logo Width.
- $tablet_css_output = array(
- '.ast-theme-transparent-header #masthead .site-logo-img .transparent-custom-logo .astra-logo-svg' => array(
- 'width' => astra_get_css_value( $transparent_header_logo_width['tablet'], 'px' ),
- 'height' => astra_get_css_value( ( ! empty( $transparent_header_logo_width['tablet-svg-height'] ) && ! is_customize_preview() ) ? $transparent_header_logo_width['tablet-svg-height'] : '', 'px' ),
- ),
- '.ast-theme-transparent-header #masthead .site-logo-img .transparent-custom-logo img' => array(
- ' max-width' => astra_get_css_value( $transparent_header_logo_width['tablet'], 'px' ),
- ),
- );
- $css .= astra_parse_css( $tablet_css_output, '', astra_get_tablet_breakpoint() );
-
- // Mobile Transparent Heder Logo Width.
- $mobile_css_output = array(
- '.ast-theme-transparent-header #masthead .site-logo-img .transparent-custom-logo .astra-logo-svg' => array(
- 'width' => astra_get_css_value( $transparent_header_logo_width['mobile'], 'px' ),
- 'height' => astra_get_css_value( ( ! empty( $transparent_header_logo_width['mobile-svg-height'] ) && ! is_customize_preview() ) ? $transparent_header_logo_width['mobile-svg-height'] : '', 'px' ),
- ),
- '.ast-theme-transparent-header #masthead .site-logo-img .transparent-custom-logo img' => array(
- ' max-width' => astra_get_css_value( $transparent_header_logo_width['mobile'], 'px' ),
- ),
- );
- $css .= astra_parse_css( $mobile_css_output, '', astra_get_mobile_breakpoint( 1 ) );
-
- $transparent_header_base = array(
- '.ast-theme-transparent-header #masthead' => array(
- 'position' => 'absolute',
- 'left' => '0',
- 'right' => '0',
- ),
-
- '.ast-theme-transparent-header .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .main-header-bar' => array(
- 'background' => 'none',
- ),
-
- 'body.elementor-editor-active.ast-theme-transparent-header #masthead, .fl-builder-edit .ast-theme-transparent-header #masthead, body.vc_editor.ast-theme-transparent-header #masthead, body.brz-ed.ast-theme-transparent-header #masthead' => array(
- 'z-index' => '0',
- ),
-
- '.ast-header-break-point.ast-replace-site-logo-transparent.ast-theme-transparent-header .custom-mobile-logo-link' => array(
- 'display' => 'none',
- ),
-
- '.ast-header-break-point.ast-replace-site-logo-transparent.ast-theme-transparent-header .transparent-custom-logo' => array(
- 'display' => 'inline-block',
- ),
-
- '.ast-theme-transparent-header .ast-above-header, .ast-theme-transparent-header .ast-above-header.ast-above-header-bar' => array(
- 'background-image' => 'none',
- 'background-color' => 'transparent',
- ),
-
- '.ast-theme-transparent-header .ast-below-header' => array(
- 'background-image' => 'none',
- 'background-color' => 'transparent',
- ),
- );
-
- /**
- * Transparent Header Colors
- */
- $transparent_header_desktop = array(
-
- '.ast-theme-transparent-header .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .main-header-bar-wrap .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .main-header-bar-wrap .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .ast-mobile-header-wrap .main-header-bar' => array(
- 'background-color' => esc_attr( $transparent_bg_color_desktop ),
- ),
- '.ast-theme-transparent-header .main-header-bar .ast-search-menu-icon form' => array(
- 'background-color' => esc_attr( $transparent_bg_color_desktop ),
- ),
-
- '.ast-theme-transparent-header .ast-above-header, .ast-theme-transparent-header .ast-above-header.ast-above-header-bar, .ast-theme-transparent-header .ast-below-header, .ast-header-break-point.ast-theme-transparent-header .ast-above-header, .ast-header-break-point.ast-theme-transparent-header .ast-below-header' => array(
- 'background-color' => esc_attr( $transparent_bg_color_desktop ),
- ),
-
- '.ast-theme-transparent-header .site-title a, .ast-theme-transparent-header .site-title a:focus, .ast-theme-transparent-header .site-title a:hover, .ast-theme-transparent-header .site-title a:visited' => array(
- 'color' => esc_attr( $transparent_color_site_title_desktop ),
- ),
- '.ast-theme-transparent-header .site-header .site-title a:hover' => array(
- 'color' => esc_attr( $transparent_color_h_site_title_desktop ),
- ),
-
- '.ast-theme-transparent-header .site-header .site-description' => array(
- 'color' => esc_attr( $transparent_color_site_title_desktop ),
- ),
-
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .sub-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-bar-wrap .main-header-menu, .ast-flyout-menu-enable.ast-header-break-point.ast-theme-transparent-header .main-header-bar-navigation #site-navigation, .ast-fullscreen-menu-enable.ast-header-break-point.ast-theme-transparent-header .main-header-bar-navigation #site-navigation, .ast-flyout-above-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation-wrap .ast-above-header-navigation, .ast-flyout-below-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-below-header-navigation-wrap .ast-below-header-actual-nav, .ast-fullscreen-above-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation-wrap, .ast-fullscreen-below-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-below-header-navigation-wrap, .ast-theme-transparent-header .main-header-menu .menu-link' => array(
- 'background-color' => esc_attr( $transparent_menu_bg_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu' => array(
- 'background-color' => esc_attr( $transparent_sub_menu_bg_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link' => array(
- 'color' => esc_attr( $transparent_sub_menu_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-link:hover,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.focus > .menu-item,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.current-menu-item > .ast-menu-toggle,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.focus > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-item:hover > .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item > .menu-link, .ast-theme-transparent-header .ast-masthead-custom-menu-items, .ast-theme-transparent-header .ast-masthead-custom-menu-items a, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation > ul.ast-above-header-menu > .menu-item-has-children:not(.current-menu-item) > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu, .ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu, .ast-theme-transparent-header .main-header-menu .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .ast-masthead-custom-menu-items a:hover, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .focus > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-ancestor > .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header .main-header-menu .current-menu-ancestor > .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_h_color_desktop ),
- ),
- // Content Section text color.
- '.ast-theme-transparent-header div.ast-masthead-custom-menu-items, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget-title, .ast-theme-transparent-header .site-header-section [CLASS*="ast-header-html-"] .ast-builder-html-element' => array(
- 'color' => esc_attr( $transparent_content_section_text_color_desktop ),
- ),
- // Content Section link color.
- '.ast-theme-transparent-header div.ast-masthead-custom-menu-items a, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget a, .ast-theme-transparent-header .site-header-section [CLASS*="ast-header-html-"] .ast-builder-html-element a' => array(
- 'color' => esc_attr( $transparent_content_section_link_color_desktop ),
- ),
- // Content Section link hover color.
- '.ast-theme-transparent-header div.ast-masthead-custom-menu-items a:hover, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget a:hover, .ast-theme-transparent-header .site-header-section [CLASS*="ast-header-html-"] .ast-builder-html-element a:hover' => array(
- 'color' => esc_attr( $transparent_content_section_link_h_color_desktop ),
- ),
- );
-
- $transparent_header_tablet = array(
-
- '.ast-theme-transparent-header .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .main-header-bar-wrap .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .main-header-bar-wrap .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .ast-mobile-header-wrap .main-header-bar' => array(
- 'background-color' => esc_attr( $transparent_bg_color_tablet ),
- ),
- '.ast-theme-transparent-header .main-header-bar .ast-search-menu-icon form' => array(
- 'background-color' => esc_attr( $transparent_bg_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-above-header, .ast-theme-transparent-header .ast-above-header.ast-above-header-bar, .ast-theme-transparent-header .ast-below-header, .ast-header-break-point.ast-theme-transparent-header .ast-above-header, .ast-header-break-point.ast-theme-transparent-header .ast-below-header' => array(
- 'background-color' => esc_attr( $transparent_bg_color_tablet ),
- ),
-
- '.ast-theme-transparent-header .site-title a, .ast-theme-transparent-header .site-title a:focus, .ast-theme-transparent-header .site-title a:hover, .ast-theme-transparent-header .site-title a:visited, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a:hover, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a:focus, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a:visited' => array(
- 'color' => esc_attr( $transparent_color_site_title_tablet ),
- ),
- '.ast-theme-transparent-header .site-header .site-title a:hover' => array(
- 'color' => esc_attr( $transparent_color_h_site_title_tablet ),
- ),
-
- '.ast-theme-transparent-header .site-header .site-description' => array(
- 'color' => esc_attr( $transparent_color_site_title_tablet ),
- ),
-
- '.ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-menu .sub-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-bar-wrap .main-header-menu, .ast-flyout-menu-enable.ast-header-break-point.ast-theme-transparent-header .main-header-bar-navigation #site-navigation, .ast-fullscreen-menu-enable.ast-header-break-point.ast-theme-transparent-header .main-header-bar-navigation #site-navigation, .ast-flyout-above-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation-wrap .ast-above-header-navigation, .ast-flyout-below-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-below-header-navigation-wrap .ast-below-header-actual-nav, .ast-fullscreen-above-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation-wrap, .ast-fullscreen-below-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-below-header-navigation-wrap, .ast-theme-transparent-header .main-header-menu .menu-link' => array(
- 'background-color' => esc_attr( $transparent_menu_bg_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation .main-header-menu .menu-item .sub-menu, .ast-theme-transparent-header.astra-hfb-header .ast-builder-menu [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.astra-hfb-header .ast-builder-menu .main-header-bar-navigation [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header.astra-hfb-header .ast-builder-menu [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.astra-hfb-header .ast-builder-menu .main-header-bar-navigation [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu' => array(
- 'background-color' => esc_attr( $transparent_sub_menu_bg_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link' => array(
- 'color' => esc_attr( $transparent_sub_menu_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-link:hover,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.focus > .menu-item,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.current-menu-item > .menu-link,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.current-menu-item > .ast-menu-toggle,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.focus > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-item:hover > .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item > .menu-link, .ast-theme-transparent-header .ast-masthead-custom-menu-items, .ast-theme-transparent-header .ast-masthead-custom-menu-items a,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .ast-masthead-custom-menu-items a:hover, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .focus > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-ancestor > .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header .main-header-menu .current-menu-ancestor > .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_h_color_tablet ),
- ),
- // Content Section text color.
- '.ast-theme-transparent-header div.ast-masthead-custom-menu-items, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget-title, .ast-theme-transparent-header .site-header-section [CLASS*="ast-header-html-"] .ast-builder-html-element' => array(
- 'color' => esc_attr( $transparent_content_section_text_color_tablet ),
- ),
- // Content Section link color.
- '.ast-theme-transparent-header div.ast-masthead-custom-menu-items a, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget a' => array(
- 'color' => esc_attr( $transparent_content_section_link_color_tablet ),
- ),
- // Content Section link hover color.
- '.ast-theme-transparent-header div.ast-masthead-custom-menu-items a:hover, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget a:hover' => array(
- 'color' => esc_attr( $transparent_content_section_link_h_color_tablet ),
- ),
- );
-
- $transparent_header_mobile = array(
-
- '.ast-theme-transparent-header .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .main-header-bar-wrap .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .main-header-bar-wrap .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .ast-mobile-header-wrap .main-header-bar' => array(
- 'background-color' => esc_attr( $transparent_bg_color_mobile ),
- ),
- '.ast-theme-transparent-header .main-header-bar .ast-search-menu-icon form' => array(
- 'background-color' => esc_attr( $transparent_bg_color_mobile ),
- ),
-
- '.ast-theme-transparent-header .ast-above-header, .ast-theme-transparent-header .ast-above-header.ast-above-header-bar, .ast-theme-transparent-header .ast-below-header, .ast-header-break-point.ast-theme-transparent-header .ast-above-header, .ast-header-break-point.ast-theme-transparent-header .ast-below-header' => array(
- 'background-color' => esc_attr( $transparent_bg_color_mobile ),
- ),
-
- '.ast-theme-transparent-header .site-title a, .ast-theme-transparent-header .site-title a:focus, .ast-theme-transparent-header .site-title a:hover, .ast-theme-transparent-header .site-title a:visited, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a:hover, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a:focus, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a:visited' => array(
- 'color' => esc_attr( $transparent_color_site_title_mobile ),
- ),
- '.ast-theme-transparent-header .site-header .site-title a:hover' => array(
- 'color' => esc_attr( $transparent_color_h_site_title_mobile ),
- ),
-
- '.ast-theme-transparent-header .site-header .site-description' => array(
- 'color' => esc_attr( $transparent_color_site_title_mobile ),
- ),
-
- '.ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-menu .sub-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-bar-wrap .main-header-menu, .ast-flyout-menu-enable.ast-header-break-point.ast-theme-transparent-header .main-header-bar-navigation #site-navigation, .ast-fullscreen-menu-enable.ast-header-break-point.ast-theme-transparent-header .main-header-bar-navigation #site-navigation, .ast-flyout-above-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation-wrap .ast-above-header-navigation, .ast-flyout-below-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-below-header-navigation-wrap .ast-below-header-actual-nav, .ast-fullscreen-above-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation-wrap, .ast-fullscreen-below-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-below-header-navigation-wrap, .ast-theme-transparent-header .main-header-menu .menu-link' => array(
- 'background-color' => esc_attr( $transparent_menu_bg_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation .main-header-menu .menu-item .sub-menu, .ast-theme-transparent-header.astra-hfb-header .ast-builder-menu [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.astra-hfb-header .ast-builder-menu .main-header-bar-navigation [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header.astra-hfb-header .ast-builder-menu [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.astra-hfb-header .ast-builder-menu .main-header-bar-navigation [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu' => array(
- 'background-color' => esc_attr( $transparent_sub_menu_bg_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link' => array(
- 'color' => esc_attr( $transparent_sub_menu_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-link:hover,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.focus > .menu-item,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.current-menu-item > .menu-link,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.current-menu-item > .ast-menu-toggle,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.focus > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-item.focus > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-item:hover > .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-link, .ast-theme-transparent-header .ast-masthead-custom-menu-items, .ast-theme-transparent-header .ast-masthead-custom-menu-items a, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .ast-masthead-custom-menu-items a:hover, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .focus > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-ancestor > .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header .main-header-menu .current-menu-ancestor > .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_h_color_mobile ),
- ),
- // Content Section text color.
- '.ast-theme-transparent-header div.ast-masthead-custom-menu-items, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget-title, .ast-theme-transparent-header .site-header-section [CLASS*="ast-header-html-"] .ast-builder-html-element' => array(
- 'color' => esc_attr( $transparent_content_section_text_color_mobile ),
- ),
- // Content Section link color.
- '.ast-theme-transparent-header div.ast-masthead-custom-menu-items a, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget a' => array(
- 'color' => esc_attr( $transparent_content_section_link_color_mobile ),
- ),
- // Content Section link hover color.
- '.ast-theme-transparent-header div.ast-masthead-custom-menu-items a:hover, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget a:hover' => array(
- 'color' => esc_attr( $transparent_content_section_link_h_color_mobile ),
- ),
- );
-
- /* Parse CSS from array() */
- if ( 'both' === $transparent_header_devices || 'desktop' === $transparent_header_devices ) {
- $css .= astra_parse_css( $transparent_header_base, astra_get_tablet_breakpoint() );
-
- // If Transparent header is active on mobile + desktop, enqueue CSS without media queeries.
- // If only for desktop add media query for the transparent header.
- if ( 'both' === $transparent_header_devices ) {
- $css .= astra_parse_css( $transparent_header_desktop );
- } else {
- $css .= astra_parse_css( $transparent_header_desktop, astra_get_tablet_breakpoint( '', 1 ) );
- }
- }
-
- if ( 'mobile' === $transparent_header_devices ) {
- $css .= astra_parse_css(
- array(
- '.transparent-custom-logo' => array(
- 'display' => 'none',
- ),
- ),
- astra_get_tablet_breakpoint()
- );
-
- $css .= astra_parse_css(
- array(
- '.transparent-custom-logo' => array(
- 'display' => 'block',
- ),
- ),
- '',
- astra_get_tablet_breakpoint()
- );
-
- $css .= astra_parse_css(
- array(
- '.ast-transparent-desktop-logo' => array(
- 'display' => 'none',
- ),
- ),
- '',
- astra_get_tablet_breakpoint()
- );
- }
-
- if ( 'desktop' === $transparent_header_devices ) {
- $css .= astra_parse_css(
- array(
- '.transparent-custom-logo' => array(
- 'display' => 'none',
- ),
- ),
- '',
- astra_get_tablet_breakpoint()
- );
-
- $css .= astra_parse_css(
- array(
- '.ast-transparent-mobile-logo' => array(
- 'display' => 'none',
- ),
- ),
- astra_get_tablet_breakpoint()
- );
-
- $css .= astra_parse_css(
- array(
- '.ast-transparent-mobile-logo' => array(
- 'display' => 'block',
- ),
- ),
- '',
- astra_get_tablet_breakpoint()
- );
- }
-
- if ( 'both' === $transparent_header_devices || 'mobile' === $transparent_header_devices ) {
- $css .= astra_parse_css( $transparent_header_base, '', astra_get_tablet_breakpoint() );
- $css .= astra_parse_css( $transparent_header_tablet, '', astra_get_tablet_breakpoint() );
- $css .= astra_parse_css( $transparent_header_mobile, '', astra_get_mobile_breakpoint() );
- }
-
- $mobile_header_type = astra_get_option( 'mobile-header-type' );
-
- if ( 'dropdown' === $mobile_header_type || is_customize_preview() ) {
- $header_child_selector = '[CLASS*="-header-wrap"]:nth-last-child(2) > [CLASS*="-header-bar"]';
- } else {
- $header_child_selector = '[CLASS*="-header-wrap"]:last-child > [CLASS*="-header-bar"]';
- }
-
- if ( 'both' === $transparent_header_devices && $transparent_header_separator ) {
-
- $selector = '.ast-theme-transparent-header .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .main-header-bar';
-
- if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
- $selector = '.ast-theme-transparent-header #ast-desktop-header > ' . $header_child_selector . ', .ast-theme-transparent-header.ast-header-break-point #ast-mobile-header > ' . $header_child_selector;
- }
-
- $css .= astra_parse_css(
- array(
- $selector => array(
- 'border-bottom-width' => astra_get_css_value( $transparent_header_separator, 'px' ),
- 'border-bottom-style' => 'solid',
- 'border-bottom-color' => esc_attr( $transparent_header_separator_color ),
- ),
- )
- );
- }
-
- if ( 'mobile' === $transparent_header_devices && $transparent_header_separator ) {
-
- $selector = '.ast-theme-transparent-header.ast-header-break-point .main-header-bar';
-
- if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
- $selector = '.ast-theme-transparent-header.ast-header-break-point #ast-mobile-header > ' . $header_child_selector;
- }
-
- $css .= astra_parse_css(
- array(
- $selector => array(
- 'border-bottom-width' => astra_get_css_value( $transparent_header_separator, 'px' ),
- 'border-bottom-style' => 'solid',
- 'border-bottom-color' => esc_attr( $transparent_header_separator_color ),
- ),
- ),
- '',
- astra_get_tablet_breakpoint()
- );
- }
-
- if ( 'desktop' === $transparent_header_devices && $transparent_header_separator ) {
-
- $selector = '.ast-theme-transparent-header .main-header-bar';
-
- if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
- $selector = '.ast-theme-transparent-header #ast-desktop-header > ' . $header_child_selector;
- }
-
- $css .= astra_parse_css(
- array(
- $selector => array(
- 'border-bottom-width' => astra_get_css_value( $transparent_header_separator, 'px' ),
- 'border-bottom-style' => 'solid',
- 'border-bottom-color' => esc_attr( $transparent_header_separator_color ),
- ),
- ),
- astra_get_tablet_breakpoint()
- );
- }
-
- $dynamic_css .= $css;
-
- return $dynamic_css;
-}
+<?php +/** + * Transparent Header - Dynamic CSS + * + * @package Astra Addon + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +add_filter( 'astra_dynamic_theme_css', 'astra_ext_transparent_header_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param String $dynamic_css Astra Dynamic CSS. + * @param String $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Dynamic CSS. + */ +function astra_ext_transparent_header_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + if ( true != Astra_Ext_Transparent_Header_Markup::is_transparent_header() ) { + return $dynamic_css; + } + + /** + * Set colors + * + * If colors extension is_active then get color from it. + * Else set theme default colors. + */ + $transparent_header_separator = astra_get_option( 'transparent-header-main-sep' ); + $transparent_header_separator_color = astra_get_option( 'transparent-header-main-sep-color' ); + + $transparent_header_logo_width = astra_get_option( 'transparent-header-logo-width' ); + + $transparent_header_inherit = astra_get_option( 'different-transparent-logo' ); + $transparent_header_logo = astra_get_option( 'transparent-header-logo' ); + + $transparent_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'desktop' ); + $transparent_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'tablet', $transparent_bg_color_desktop ); + $transparent_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'mobile', ( $transparent_bg_color_tablet ) ? $transparent_bg_color_tablet : $transparent_bg_color_desktop ); + + $transparent_color_site_title_desktop = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'desktop' ); + $transparent_color_site_title_tablet = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'tablet' ); + $transparent_color_site_title_mobile = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'mobile' ); + + $transparent_color_h_site_title_desktop = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'desktop' ); + $transparent_color_h_site_title_tablet = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'tablet' ); + $transparent_color_h_site_title_mobile = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'mobile' ); + + $transparent_menu_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'desktop' ); + $transparent_menu_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'desktop' ); + $transparent_menu_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'desktop' ); + + $transparent_menu_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'tablet' ); + $transparent_menu_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'tablet' ); + $transparent_menu_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'tablet' ); + + $transparent_menu_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'mobile' ); + $transparent_menu_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'mobile' ); + $transparent_menu_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'mobile' ); + + $transparent_sub_menu_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'desktop' ); + $transparent_sub_menu_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'desktop' ); + $transparent_sub_menu_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'desktop' ); + + $transparent_sub_menu_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'tablet' ); + $transparent_sub_menu_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'tablet' ); + $transparent_sub_menu_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'tablet' ); + + $transparent_sub_menu_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'mobile' ); + $transparent_sub_menu_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'mobile' ); + $transparent_sub_menu_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'mobile' ); + + $transparent_content_section_text_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'desktop' ); + $transparent_content_section_link_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'desktop' ); + $transparent_content_section_link_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'desktop' ); + + $transparent_content_section_text_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'tablet' ); + $transparent_content_section_link_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'tablet' ); + $transparent_content_section_link_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'tablet' ); + + $transparent_content_section_text_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'mobile' ); + $transparent_content_section_link_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'mobile' ); + $transparent_content_section_link_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'mobile' ); + + $transparent_header_devices = astra_get_option( 'transparent-header-on-devices' ); + + /** + * Generate Dynamic CSS + */ + + $css = ''; + + if ( '0' === $transparent_header_inherit && '' != $transparent_header_logo ) { + $css_output = array( + '.ast-theme-transparent-header .site-logo-img .custom-logo-link' => array( + 'display' => 'none', + ), + ); + $css .= astra_parse_css( $css_output ); + } + + // Desktop Transparent Heder Logo Width. + $css_output = array( + '.ast-theme-transparent-header #masthead .site-logo-img .transparent-custom-logo .astra-logo-svg' => array( + 'width' => astra_get_css_value( $transparent_header_logo_width['desktop'], 'px' ), + 'height' => astra_get_css_value( ( ! empty( $transparent_header_logo_width['desktop-svg-height'] ) && ! is_customize_preview() ) ? $transparent_header_logo_width['desktop-svg-height'] : '', 'px' ), + ), + '.ast-theme-transparent-header #masthead .site-logo-img .transparent-custom-logo img' => array( + ' max-width' => astra_get_css_value( $transparent_header_logo_width['desktop'], 'px' ), + ), + ); + $css .= astra_parse_css( $css_output ); + + // Tablet Transparent Heder Logo Width. + $tablet_css_output = array( + '.ast-theme-transparent-header #masthead .site-logo-img .transparent-custom-logo .astra-logo-svg' => array( + 'width' => astra_get_css_value( $transparent_header_logo_width['tablet'], 'px' ), + 'height' => astra_get_css_value( ( ! empty( $transparent_header_logo_width['tablet-svg-height'] ) && ! is_customize_preview() ) ? $transparent_header_logo_width['tablet-svg-height'] : '', 'px' ), + ), + '.ast-theme-transparent-header #masthead .site-logo-img .transparent-custom-logo img' => array( + ' max-width' => astra_get_css_value( $transparent_header_logo_width['tablet'], 'px' ), + ), + ); + $css .= astra_parse_css( $tablet_css_output, '', astra_get_tablet_breakpoint() ); + + // Mobile Transparent Heder Logo Width. + $mobile_css_output = array( + '.ast-theme-transparent-header #masthead .site-logo-img .transparent-custom-logo .astra-logo-svg' => array( + 'width' => astra_get_css_value( $transparent_header_logo_width['mobile'], 'px' ), + 'height' => astra_get_css_value( ( ! empty( $transparent_header_logo_width['mobile-svg-height'] ) && ! is_customize_preview() ) ? $transparent_header_logo_width['mobile-svg-height'] : '', 'px' ), + ), + '.ast-theme-transparent-header #masthead .site-logo-img .transparent-custom-logo img' => array( + ' max-width' => astra_get_css_value( $transparent_header_logo_width['mobile'], 'px' ), + ), + ); + $css .= astra_parse_css( $mobile_css_output, '', astra_get_mobile_breakpoint( 1 ) ); + + $transparent_header_base = array( + '.ast-theme-transparent-header #masthead' => array( + 'position' => 'absolute', + 'left' => '0', + 'right' => '0', + ), + + '.ast-theme-transparent-header .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .main-header-bar' => array( + 'background' => 'none', + ), + + 'body.elementor-editor-active.ast-theme-transparent-header #masthead, .fl-builder-edit .ast-theme-transparent-header #masthead, body.vc_editor.ast-theme-transparent-header #masthead, body.brz-ed.ast-theme-transparent-header #masthead' => array( + 'z-index' => '0', + ), + + '.ast-header-break-point.ast-replace-site-logo-transparent.ast-theme-transparent-header .custom-mobile-logo-link' => array( + 'display' => 'none', + ), + + '.ast-header-break-point.ast-replace-site-logo-transparent.ast-theme-transparent-header .transparent-custom-logo' => array( + 'display' => 'inline-block', + ), + + '.ast-theme-transparent-header .ast-above-header, .ast-theme-transparent-header .ast-above-header.ast-above-header-bar' => array( + 'background-image' => 'none', + 'background-color' => 'transparent', + ), + + '.ast-theme-transparent-header .ast-below-header' => array( + 'background-image' => 'none', + 'background-color' => 'transparent', + ), + ); + + /** + * Transparent Header Colors + */ + $transparent_header_desktop = array( + + '.ast-theme-transparent-header .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .main-header-bar-wrap .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .main-header-bar-wrap .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .ast-mobile-header-wrap .main-header-bar' => array( + 'background-color' => esc_attr( $transparent_bg_color_desktop ), + ), + '.ast-theme-transparent-header .main-header-bar .ast-search-menu-icon form' => array( + 'background-color' => esc_attr( $transparent_bg_color_desktop ), + ), + + '.ast-theme-transparent-header .ast-above-header, .ast-theme-transparent-header .ast-above-header.ast-above-header-bar, .ast-theme-transparent-header .ast-below-header, .ast-header-break-point.ast-theme-transparent-header .ast-above-header, .ast-header-break-point.ast-theme-transparent-header .ast-below-header' => array( + 'background-color' => esc_attr( $transparent_bg_color_desktop ), + ), + + '.ast-theme-transparent-header .site-title a, .ast-theme-transparent-header .site-title a:focus, .ast-theme-transparent-header .site-title a:hover, .ast-theme-transparent-header .site-title a:visited' => array( + 'color' => esc_attr( $transparent_color_site_title_desktop ), + ), + '.ast-theme-transparent-header .site-header .site-title a:hover' => array( + 'color' => esc_attr( $transparent_color_h_site_title_desktop ), + ), + + '.ast-theme-transparent-header .site-header .site-description' => array( + 'color' => esc_attr( $transparent_color_site_title_desktop ), + ), + + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .sub-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-bar-wrap .main-header-menu, .ast-flyout-menu-enable.ast-header-break-point.ast-theme-transparent-header .main-header-bar-navigation #site-navigation, .ast-fullscreen-menu-enable.ast-header-break-point.ast-theme-transparent-header .main-header-bar-navigation #site-navigation, .ast-flyout-above-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation-wrap .ast-above-header-navigation, .ast-flyout-below-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-below-header-navigation-wrap .ast-below-header-actual-nav, .ast-fullscreen-above-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation-wrap, .ast-fullscreen-below-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-below-header-navigation-wrap, .ast-theme-transparent-header .main-header-menu .menu-link' => array( + 'background-color' => esc_attr( $transparent_menu_bg_color_desktop ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu' => array( + 'background-color' => esc_attr( $transparent_sub_menu_bg_color_desktop ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link' => array( + 'color' => esc_attr( $transparent_sub_menu_color_desktop ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-link:hover,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.focus > .menu-item,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.current-menu-item > .ast-menu-toggle,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.focus > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-item:hover > .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_desktop ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item > .menu-link, .ast-theme-transparent-header .ast-masthead-custom-menu-items, .ast-theme-transparent-header .ast-masthead-custom-menu-items a, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation > ul.ast-above-header-menu > .menu-item-has-children:not(.current-menu-item) > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu, .ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu, .ast-theme-transparent-header .main-header-menu .menu-link' => array( + 'color' => esc_attr( $transparent_menu_color_desktop ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .ast-masthead-custom-menu-items a:hover, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .focus > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-ancestor > .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header .main-header-menu .current-menu-ancestor > .menu-link' => array( + 'color' => esc_attr( $transparent_menu_h_color_desktop ), + ), + // Content Section text color. + '.ast-theme-transparent-header div.ast-masthead-custom-menu-items, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget-title, .ast-theme-transparent-header .site-header-section [CLASS*="ast-header-html-"] .ast-builder-html-element' => array( + 'color' => esc_attr( $transparent_content_section_text_color_desktop ), + ), + // Content Section link color. + '.ast-theme-transparent-header div.ast-masthead-custom-menu-items a, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget a, .ast-theme-transparent-header .site-header-section [CLASS*="ast-header-html-"] .ast-builder-html-element a' => array( + 'color' => esc_attr( $transparent_content_section_link_color_desktop ), + ), + // Content Section link hover color. + '.ast-theme-transparent-header div.ast-masthead-custom-menu-items a:hover, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget a:hover, .ast-theme-transparent-header .site-header-section [CLASS*="ast-header-html-"] .ast-builder-html-element a:hover' => array( + 'color' => esc_attr( $transparent_content_section_link_h_color_desktop ), + ), + ); + + $transparent_header_tablet = array( + + '.ast-theme-transparent-header .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .main-header-bar-wrap .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .main-header-bar-wrap .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .ast-mobile-header-wrap .main-header-bar' => array( + 'background-color' => esc_attr( $transparent_bg_color_tablet ), + ), + '.ast-theme-transparent-header .main-header-bar .ast-search-menu-icon form' => array( + 'background-color' => esc_attr( $transparent_bg_color_tablet ), + ), + '.ast-theme-transparent-header .ast-above-header, .ast-theme-transparent-header .ast-above-header.ast-above-header-bar, .ast-theme-transparent-header .ast-below-header, .ast-header-break-point.ast-theme-transparent-header .ast-above-header, .ast-header-break-point.ast-theme-transparent-header .ast-below-header' => array( + 'background-color' => esc_attr( $transparent_bg_color_tablet ), + ), + + '.ast-theme-transparent-header .site-title a, .ast-theme-transparent-header .site-title a:focus, .ast-theme-transparent-header .site-title a:hover, .ast-theme-transparent-header .site-title a:visited, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a:hover, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a:focus, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a:visited' => array( + 'color' => esc_attr( $transparent_color_site_title_tablet ), + ), + '.ast-theme-transparent-header .site-header .site-title a:hover' => array( + 'color' => esc_attr( $transparent_color_h_site_title_tablet ), + ), + + '.ast-theme-transparent-header .site-header .site-description' => array( + 'color' => esc_attr( $transparent_color_site_title_tablet ), + ), + + '.ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-menu .sub-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-bar-wrap .main-header-menu, .ast-flyout-menu-enable.ast-header-break-point.ast-theme-transparent-header .main-header-bar-navigation #site-navigation, .ast-fullscreen-menu-enable.ast-header-break-point.ast-theme-transparent-header .main-header-bar-navigation #site-navigation, .ast-flyout-above-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation-wrap .ast-above-header-navigation, .ast-flyout-below-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-below-header-navigation-wrap .ast-below-header-actual-nav, .ast-fullscreen-above-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation-wrap, .ast-fullscreen-below-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-below-header-navigation-wrap, .ast-theme-transparent-header .main-header-menu .menu-link' => array( + 'background-color' => esc_attr( $transparent_menu_bg_color_tablet ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation .main-header-menu .menu-item .sub-menu, .ast-theme-transparent-header.astra-hfb-header .ast-builder-menu [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.astra-hfb-header .ast-builder-menu .main-header-bar-navigation [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header.astra-hfb-header .ast-builder-menu [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.astra-hfb-header .ast-builder-menu .main-header-bar-navigation [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu' => array( + 'background-color' => esc_attr( $transparent_sub_menu_bg_color_tablet ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link' => array( + 'color' => esc_attr( $transparent_sub_menu_color_tablet ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-link:hover,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.focus > .menu-item,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.current-menu-item > .menu-link,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.current-menu-item > .ast-menu-toggle,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.focus > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-item:hover > .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_tablet ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item > .menu-link, .ast-theme-transparent-header .ast-masthead-custom-menu-items, .ast-theme-transparent-header .ast-masthead-custom-menu-items a,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-link' => array( + 'color' => esc_attr( $transparent_menu_color_tablet ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .ast-masthead-custom-menu-items a:hover, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .focus > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-ancestor > .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header .main-header-menu .current-menu-ancestor > .menu-link' => array( + 'color' => esc_attr( $transparent_menu_h_color_tablet ), + ), + // Content Section text color. + '.ast-theme-transparent-header div.ast-masthead-custom-menu-items, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget-title, .ast-theme-transparent-header .site-header-section [CLASS*="ast-header-html-"] .ast-builder-html-element' => array( + 'color' => esc_attr( $transparent_content_section_text_color_tablet ), + ), + // Content Section link color. + '.ast-theme-transparent-header div.ast-masthead-custom-menu-items a, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget a' => array( + 'color' => esc_attr( $transparent_content_section_link_color_tablet ), + ), + // Content Section link hover color. + '.ast-theme-transparent-header div.ast-masthead-custom-menu-items a:hover, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget a:hover' => array( + 'color' => esc_attr( $transparent_content_section_link_h_color_tablet ), + ), + ); + + $transparent_header_mobile = array( + + '.ast-theme-transparent-header .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .main-header-bar-wrap .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .main-header-bar-wrap .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .ast-mobile-header-wrap .main-header-bar' => array( + 'background-color' => esc_attr( $transparent_bg_color_mobile ), + ), + '.ast-theme-transparent-header .main-header-bar .ast-search-menu-icon form' => array( + 'background-color' => esc_attr( $transparent_bg_color_mobile ), + ), + + '.ast-theme-transparent-header .ast-above-header, .ast-theme-transparent-header .ast-above-header.ast-above-header-bar, .ast-theme-transparent-header .ast-below-header, .ast-header-break-point.ast-theme-transparent-header .ast-above-header, .ast-header-break-point.ast-theme-transparent-header .ast-below-header' => array( + 'background-color' => esc_attr( $transparent_bg_color_mobile ), + ), + + '.ast-theme-transparent-header .site-title a, .ast-theme-transparent-header .site-title a:focus, .ast-theme-transparent-header .site-title a:hover, .ast-theme-transparent-header .site-title a:visited, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a:hover, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a:focus, .ast-theme-transparent-header .ast-builder-layout-element .ast-site-identity .site-title a:visited' => array( + 'color' => esc_attr( $transparent_color_site_title_mobile ), + ), + '.ast-theme-transparent-header .site-header .site-title a:hover' => array( + 'color' => esc_attr( $transparent_color_h_site_title_mobile ), + ), + + '.ast-theme-transparent-header .site-header .site-description' => array( + 'color' => esc_attr( $transparent_color_site_title_mobile ), + ), + + '.ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-menu .sub-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-builder-menu .main-header-bar-wrap .main-header-menu, .ast-flyout-menu-enable.ast-header-break-point.ast-theme-transparent-header .main-header-bar-navigation #site-navigation, .ast-fullscreen-menu-enable.ast-header-break-point.ast-theme-transparent-header .main-header-bar-navigation #site-navigation, .ast-flyout-above-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation-wrap .ast-above-header-navigation, .ast-flyout-below-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-below-header-navigation-wrap .ast-below-header-actual-nav, .ast-fullscreen-above-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation-wrap, .ast-fullscreen-below-menu-enable.ast-header-break-point.ast-theme-transparent-header .ast-below-header-navigation-wrap, .ast-theme-transparent-header .main-header-menu .menu-link' => array( + 'background-color' => esc_attr( $transparent_menu_bg_color_mobile ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation .main-header-menu .menu-item .sub-menu, .ast-theme-transparent-header.astra-hfb-header .ast-builder-menu [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.astra-hfb-header .ast-builder-menu .main-header-bar-navigation [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .ast-builder-menu .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header.astra-hfb-header .ast-builder-menu [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.astra-hfb-header .ast-builder-menu .main-header-bar-navigation [CLASS*="ast-builder-menu-"] .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu' => array( + 'background-color' => esc_attr( $transparent_sub_menu_bg_color_mobile ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link' => array( + 'color' => esc_attr( $transparent_sub_menu_color_mobile ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-link:hover,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.focus > .menu-item,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.current-menu-item > .menu-link,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.current-menu-item > .ast-menu-toggle,.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item .sub-menu .menu-item.focus > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-item.focus > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item .sub-menu .menu-item:hover > .menu-link, .ast-header-break-point.ast-flyout-menu-enable.ast-header-break-point .main-header-bar-navigation .main-header-menu .menu-item .sub-menu .menu-link' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_mobile ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-link, .ast-theme-transparent-header .ast-masthead-custom-menu-items, .ast-theme-transparent-header .ast-masthead-custom-menu-items a, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-link' => array( + 'color' => esc_attr( $transparent_menu_color_mobile ), + ), + '.ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .ast-masthead-custom-menu-items a:hover, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .focus > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-builder-menu .main-header-menu .current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-ancestor > .menu-link, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header [CLASS*="ast-builder-menu-"] .main-header-menu .current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .main-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .main-header-menu .current-menu-item > .menu-link, .ast-theme-transparent-header .main-header-menu .current-menu-ancestor > .menu-link' => array( + 'color' => esc_attr( $transparent_menu_h_color_mobile ), + ), + // Content Section text color. + '.ast-theme-transparent-header div.ast-masthead-custom-menu-items, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget-title, .ast-theme-transparent-header .site-header-section [CLASS*="ast-header-html-"] .ast-builder-html-element' => array( + 'color' => esc_attr( $transparent_content_section_text_color_mobile ), + ), + // Content Section link color. + '.ast-theme-transparent-header div.ast-masthead-custom-menu-items a, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget a' => array( + 'color' => esc_attr( $transparent_content_section_link_color_mobile ), + ), + // Content Section link hover color. + '.ast-theme-transparent-header div.ast-masthead-custom-menu-items a:hover, .ast-theme-transparent-header div.ast-masthead-custom-menu-items .widget a:hover' => array( + 'color' => esc_attr( $transparent_content_section_link_h_color_mobile ), + ), + ); + + /* Parse CSS from array() */ + if ( 'both' === $transparent_header_devices || 'desktop' === $transparent_header_devices ) { + $css .= astra_parse_css( $transparent_header_base, astra_get_tablet_breakpoint() ); + + // If Transparent header is active on mobile + desktop, enqueue CSS without media queeries. + // If only for desktop add media query for the transparent header. + if ( 'both' === $transparent_header_devices ) { + $css .= astra_parse_css( $transparent_header_desktop ); + } else { + $css .= astra_parse_css( $transparent_header_desktop, astra_get_tablet_breakpoint( '', 1 ) ); + } + } + + if ( 'mobile' === $transparent_header_devices ) { + $css .= astra_parse_css( + array( + '.transparent-custom-logo' => array( + 'display' => 'none', + ), + ), + astra_get_tablet_breakpoint() + ); + + $css .= astra_parse_css( + array( + '.transparent-custom-logo' => array( + 'display' => 'block', + ), + ), + '', + astra_get_tablet_breakpoint() + ); + + $css .= astra_parse_css( + array( + '.ast-transparent-desktop-logo' => array( + 'display' => 'none', + ), + ), + '', + astra_get_tablet_breakpoint() + ); + } + + if ( 'desktop' === $transparent_header_devices ) { + $css .= astra_parse_css( + array( + '.transparent-custom-logo' => array( + 'display' => 'none', + ), + ), + '', + astra_get_tablet_breakpoint() + ); + + $css .= astra_parse_css( + array( + '.ast-transparent-mobile-logo' => array( + 'display' => 'none', + ), + ), + astra_get_tablet_breakpoint() + ); + + $css .= astra_parse_css( + array( + '.ast-transparent-mobile-logo' => array( + 'display' => 'block', + ), + ), + '', + astra_get_tablet_breakpoint() + ); + } + + if ( 'both' === $transparent_header_devices || 'mobile' === $transparent_header_devices ) { + $css .= astra_parse_css( $transparent_header_base, '', astra_get_tablet_breakpoint() ); + $css .= astra_parse_css( $transparent_header_tablet, '', astra_get_tablet_breakpoint() ); + $css .= astra_parse_css( $transparent_header_mobile, '', astra_get_mobile_breakpoint() ); + } + + $mobile_header_type = astra_get_option( 'mobile-header-type' ); + + if ( 'dropdown' === $mobile_header_type || is_customize_preview() ) { + $header_child_selector = '[CLASS*="-header-wrap"]:nth-last-child(2) > [CLASS*="-header-bar"]'; + } else { + $header_child_selector = '[CLASS*="-header-wrap"]:last-child > [CLASS*="-header-bar"]'; + } + + if ( 'both' === $transparent_header_devices && $transparent_header_separator ) { + + $selector = '.ast-theme-transparent-header .main-header-bar, .ast-theme-transparent-header.ast-header-break-point .main-header-bar'; + + if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { + $selector = '.ast-theme-transparent-header #ast-desktop-header > ' . $header_child_selector . ', .ast-theme-transparent-header.ast-header-break-point #ast-mobile-header > ' . $header_child_selector; + } + + $css .= astra_parse_css( + array( + $selector => array( + 'border-bottom-width' => astra_get_css_value( $transparent_header_separator, 'px' ), + 'border-bottom-style' => 'solid', + 'border-bottom-color' => esc_attr( $transparent_header_separator_color ), + ), + ) + ); + } + + if ( 'mobile' === $transparent_header_devices && $transparent_header_separator ) { + + $selector = '.ast-theme-transparent-header.ast-header-break-point .main-header-bar'; + + if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { + $selector = '.ast-theme-transparent-header.ast-header-break-point #ast-mobile-header > ' . $header_child_selector; + } + + $css .= astra_parse_css( + array( + $selector => array( + 'border-bottom-width' => astra_get_css_value( $transparent_header_separator, 'px' ), + 'border-bottom-style' => 'solid', + 'border-bottom-color' => esc_attr( $transparent_header_separator_color ), + ), + ), + '', + astra_get_tablet_breakpoint() + ); + } + + if ( 'desktop' === $transparent_header_devices && $transparent_header_separator ) { + + $selector = '.ast-theme-transparent-header .main-header-bar'; + + if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { + $selector = '.ast-theme-transparent-header #ast-desktop-header > ' . $header_child_selector; + } + + $css .= astra_parse_css( + array( + $selector => array( + 'border-bottom-width' => astra_get_css_value( $transparent_header_separator, 'px' ), + 'border-bottom-style' => 'solid', + 'border-bottom-color' => esc_attr( $transparent_header_separator_color ), + ), + ), + astra_get_tablet_breakpoint() + ); + } + + $dynamic_css .= $css; + + return $dynamic_css; +} diff --git a/inc/addons/transparent-header/classes/dynamic-css/header-sections-dynamic.css.php b/inc/addons/transparent-header/classes/dynamic-css/header-sections-dynamic.css.php index 25acf32..a2dcecf 100644 --- a/inc/addons/transparent-header/classes/dynamic-css/header-sections-dynamic.css.php +++ b/inc/addons/transparent-header/classes/dynamic-css/header-sections-dynamic.css.php @@ -1,561 +1,561 @@ -<?php
-/**
- * Transparent Header - Dynamic CSS
- *
- * @package Astra Addon
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-/**
- * Transparent Above Header
- */
-add_filter( 'astra_dynamic_theme_css', 'astra_ext_transparent_above_header_sections_dynamic_css' );
-
-/**
- * Dynamic CSS
- *
- * @param string $dynamic_css Astra Dynamic CSS.
- * @param string $dynamic_css_filtered Astra Dynamic CSS Filters.
- * @return String Generated dynamic CSS for above header transparent header.
- */
-function astra_ext_transparent_above_header_sections_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) {
-
- $above_header_layout = astra_get_option( 'above-header-layout', 'disabled' );
-
- if ( 'disabled' === $above_header_layout ) {
- return $dynamic_css;
- }
-
- if ( false == Astra_Ext_Transparent_Header_Markup::is_transparent_header() ) {
- return $dynamic_css;
- }
-
- /**
- * Set colors
- */
-
- $transparent_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'desktop' );
- $transparent_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'tablet' );
- $transparent_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'mobile' );
-
- $transparent_color_site_title_desktop = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'desktop' );
- $transparent_color_site_title_tablet = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'tablet' );
- $transparent_color_site_title_mobile = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'mobile' );
-
- $transparent_color_h_site_title_desktop = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'desktop' );
- $transparent_color_h_site_title_tablet = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'tablet' );
- $transparent_color_h_site_title_mobile = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'mobile' );
-
- $transparent_menu_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'desktop' );
- $transparent_menu_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'desktop' );
- $transparent_menu_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'desktop' );
-
- $transparent_menu_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'tablet' );
- $transparent_menu_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'tablet' );
- $transparent_menu_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'tablet' );
-
- $transparent_menu_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'mobile' );
- $transparent_menu_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'mobile' );
- $transparent_menu_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'mobile' );
-
- $transparent_sub_menu_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'desktop' );
- $transparent_sub_menu_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'desktop' );
- $transparent_sub_menu_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'desktop' );
-
- $transparent_sub_menu_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'tablet' );
- $transparent_sub_menu_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'tablet' );
- $transparent_sub_menu_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'tablet' );
-
- $transparent_sub_menu_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'mobile' );
- $transparent_sub_menu_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'mobile' );
- $transparent_sub_menu_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'mobile' );
-
- $transparent_content_section_text_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'desktop' );
- $transparent_content_section_link_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'desktop' );
- $transparent_content_section_link_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'desktop' );
-
- $transparent_content_section_text_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'tablet' );
- $transparent_content_section_link_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'tablet' );
- $transparent_content_section_link_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'tablet' );
-
- $transparent_content_section_text_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'mobile' );
- $transparent_content_section_link_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'mobile' );
- $transparent_content_section_link_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'mobile' );
-
- /**
- * Generate Dynamic CSS
- */
-
- $css = '';
- /**
- * Transparent Header Colors
- */
- $transparent_header_desktop = array(
- '.ast-theme-transparent-header .ast-above-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-above-header-section-separated .ast-above-header-navigation ul.ast-above-header-menu' => array(
- 'background-color' => esc_attr( $transparent_menu_bg_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-above-header .ast-search-menu-icon form' => array(
- 'background-color' => esc_attr( $transparent_bg_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-above-header .slide-search .search-field' => array(
- 'background-color' => esc_attr( $transparent_bg_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-above-header .slide-search .search-field:focus' => array(
- 'background-color' => esc_attr( $transparent_bg_color_desktop ),
- ),
-
- '.ast-theme-transparent-header .ast-above-header-navigation .menu-item.current-menu-item > .menu-link,.ast-theme-transparent-header .ast-above-header-navigation .menu-item.current-menu-ancestor > .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_h_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-above-header-navigation .menu-item:hover > .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_h_color_desktop ),
- ),
-
- '.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation > ul.ast-above-header-menu > .menu-item-has-children:not(.current-menu-item) > .ast-menu-toggle' => array(
- 'color' => esc_attr( $transparent_menu_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu' => array(
- 'background-color' => esc_attr( $transparent_sub_menu_bg_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:hover > .menu-item, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:focus > .menu-item, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.focus > .menu-item,.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.focus > .ast-menu-toggle' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item.focus > .ast-menu-toggle' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_desktop ),
- ),
-
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu, .ast-theme-transparent-header .ast-above-header-navigation .ast-above-header-menu .sub-menu a' => array(
- 'color' => esc_attr( $transparent_sub_menu_color_desktop ),
- ),
-
- // Content Section text color.
- '.ast-theme-transparent-header .ast-above-header-section .user-select, .ast-theme-transparent-header .ast-above-header-section .widget, .ast-theme-transparent-header .ast-above-header-section .widget-title' => array(
- 'color' => esc_attr( $transparent_content_section_text_color_desktop ),
- ),
- // Content Section link color.
- '.ast-theme-transparent-header .ast-above-header-section .user-select a, .ast-theme-transparent-header .ast-above-header-section .widget a' => array(
- 'color' => esc_attr( $transparent_content_section_link_color_desktop ),
- ),
- // Content Section link hover color.
- '.ast-theme-transparent-header .ast-above-header-section .user-select a:hover, .ast-theme-transparent-header .ast-above-header-section .widget a:hover' => array(
- 'color' => esc_attr( $transparent_content_section_link_h_color_desktop ),
- ),
-
- );
-
- $transparent_header_tablet = array(
- '.ast-theme-transparent-header .ast-above-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-above-header-section-separated .ast-above-header-navigation ul.ast-above-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-below-header-section-separated .ast-below-header-actual-nav' => array(
- 'background-color' => esc_attr( $transparent_menu_bg_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-above-header .ast-search-menu-icon form' => array(
- 'background-color' => esc_attr( $transparent_bg_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-above-header .slide-search .search-field' => array(
- 'background-color' => esc_attr( $transparent_bg_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-above-header .slide-search .search-field:focus' => array(
- 'background-color' => esc_attr( $transparent_bg_color_tablet ),
- ),
-
- '.ast-theme-transparent-header .ast-above-header-navigation .menu-item.current-menu-item > .menu-link,.ast-theme-transparent-header .ast-above-header-navigation .menu-item.current-menu-ancestor > .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_h_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-above-header-navigation .menu-item:hover > .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_h_color_tablet ),
- ),
-
- '.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation > ul.ast-above-header-menu > .menu-item-has-children:not(.current-menu-item) > .ast-menu-toggle' => array(
- 'color' => esc_attr( $transparent_menu_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu' => array(
- 'background-color' => esc_attr( $transparent_sub_menu_bg_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:hover > .menu-item, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:focus > .menu-item, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.focus > .menu-item,.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.focus > .ast-menu-toggle' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item.focus > .ast-menu-toggle' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_tablet ),
- ),
-
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu, .ast-theme-transparent-header .ast-above-header-navigation .ast-above-header-menu .sub-menu a' => array(
- 'color' => esc_attr( $transparent_sub_menu_color_tablet ),
- ),
-
- // Content Section text color.
- '.ast-theme-transparent-header .ast-above-header-section .user-select, .ast-theme-transparent-header .ast-above-header-section .widget, .ast-theme-transparent-header .ast-above-header-section .widget-title' => array(
- 'color' => esc_attr( $transparent_content_section_text_color_tablet ),
- ),
- // Content Section link color.
- '.ast-theme-transparent-header .ast-above-header-section .user-select a, .ast-theme-transparent-header .ast-above-header-section .widget a' => array(
- 'color' => esc_attr( $transparent_content_section_link_color_tablet ),
- ),
- // Content Section link hover color.
- '.ast-theme-transparent-header .ast-above-header-section .user-select a:hover, .ast-theme-transparent-header .ast-above-header-section .widget a:hover' => array(
- 'color' => esc_attr( $transparent_content_section_link_h_color_tablet ),
- ),
- );
-
- $transparent_header_mobile = array(
- '.ast-theme-transparent-header .ast-above-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-above-header-section-separated .ast-above-header-navigation ul.ast-above-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-below-header-section-separated .ast-below-header-actual-nav' => array(
- 'background-color' => esc_attr( $transparent_menu_bg_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-above-header .ast-search-menu-icon form' => array(
- 'background-color' => esc_attr( $transparent_bg_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-above-header .slide-search .search-field' => array(
- 'background-color' => esc_attr( $transparent_bg_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-above-header .slide-search .search-field:focus' => array(
- 'background-color' => esc_attr( $transparent_bg_color_mobile ),
- ),
-
- '.ast-theme-transparent-header .ast-above-header-navigation .menu-item.current-menu-item > .menu-link,.ast-theme-transparent-header .ast-above-header-navigation .menu-item.current-menu-ancestor > .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_h_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-above-header-navigation .menu-item:hover > .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_h_color_mobile ),
- ),
-
- '.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation > ul.ast-above-header-menu > .menu-item-has-children:not(.current-menu-item) > .ast-menu-toggle' => array(
- 'color' => esc_attr( $transparent_menu_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu' => array(
- 'background-color' => esc_attr( $transparent_sub_menu_bg_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:hover > .menu-item, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:focus > .menu-item, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.focus > .menu-item,.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.focus > .ast-menu-toggle' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item.focus > .ast-menu-toggle' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_mobile ),
- ),
-
- '.ast-theme-transparent-header .ast-above-header-menu .sub-menu, .ast-theme-transparent-header .ast-above-header-navigation .ast-above-header-menu .sub-menu a' => array(
- 'color' => esc_attr( $transparent_sub_menu_color_mobile ),
- ),
-
- // Content Section text color.
- '.ast-theme-transparent-header .ast-above-header-section .user-select, .ast-theme-transparent-header .ast-above-header-section .widget, .ast-theme-transparent-header .ast-above-header-section .widget-title' => array(
- 'color' => esc_attr( $transparent_content_section_text_color_mobile ),
- ),
- // Content Section link color.
- '.ast-theme-transparent-header .ast-above-header-section .user-select a, .ast-theme-transparent-header .ast-above-header-section .widget a' => array(
- 'color' => esc_attr( $transparent_content_section_link_color_mobile ),
- ),
- // Content Section link hover color.
- '.ast-theme-transparent-header .ast-above-header-section .user-select a:hover, .ast-theme-transparent-header .ast-above-header-section .widget a:hover' => array(
- 'color' => esc_attr( $transparent_content_section_link_h_color_mobile ),
- ),
- );
-
- /* Parse CSS from array() */
- $css .= astra_parse_css( $transparent_header_desktop );
- $css .= astra_parse_css( $transparent_header_tablet, '', astra_get_tablet_breakpoint() );
- $css .= astra_parse_css( $transparent_header_mobile, '', astra_get_mobile_breakpoint() );
-
- return $dynamic_css . $css;
-
-}
-
-
-
-/**
- * Transparent Below Header
- */
-add_filter( 'astra_dynamic_theme_css', 'astra_ext_transparent_below_header_sections_dynamic_css' );
-
-/**
- * Dynamic CSS
- *
- * @param string $dynamic_css Astra Dynamic CSS.
- * @param string $dynamic_css_filtered Astra Dynamic CSS Filters.
- * @return String Generated dynamic CSS.
- */
-function astra_ext_transparent_below_header_sections_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) {
-
- // set page width depending on site layout.
- $below_header_layout = astra_get_option( 'below-header-layout', 'disabled' );
-
- if ( 'disabled' === $below_header_layout ) {
- return $dynamic_css;
- }
-
- if ( false == Astra_Ext_Transparent_Header_Markup::is_transparent_header() ) {
- return $dynamic_css;
- }
-
- /**
- * Set colors
- */
-
- $transparent_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'desktop' );
- $transparent_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'tablet' );
- $transparent_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'mobile' );
-
- $transparent_color_site_title_desktop = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'desktop' );
- $transparent_color_site_title_tablet = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'tablet' );
- $transparent_color_site_title_mobile = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'mobile' );
-
- $transparent_color_h_site_title_desktop = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'desktop' );
- $transparent_color_h_site_title_tablet = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'tablet' );
- $transparent_color_h_site_title_mobile = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'mobile' );
-
- $transparent_menu_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'desktop' );
- $transparent_menu_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'desktop' );
- $transparent_menu_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'desktop' );
-
- $transparent_menu_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'tablet' );
- $transparent_menu_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'tablet' );
- $transparent_menu_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'tablet' );
-
- $transparent_menu_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'mobile' );
- $transparent_menu_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'mobile' );
- $transparent_menu_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'mobile' );
-
- $transparent_sub_menu_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'desktop' );
- $transparent_sub_menu_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'desktop' );
- $transparent_sub_menu_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'desktop' );
-
- $transparent_sub_menu_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'tablet' );
- $transparent_sub_menu_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'tablet' );
- $transparent_sub_menu_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'tablet' );
-
- $transparent_sub_menu_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'mobile' );
- $transparent_sub_menu_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'mobile' );
- $transparent_sub_menu_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'mobile' );
-
- $transparent_content_section_text_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'desktop' );
- $transparent_content_section_link_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'desktop' );
- $transparent_content_section_link_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'desktop' );
-
- $transparent_content_section_text_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'tablet' );
- $transparent_content_section_link_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'tablet' );
- $transparent_content_section_link_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'tablet' );
-
- $transparent_content_section_text_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'mobile' );
- $transparent_content_section_link_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'mobile' );
- $transparent_content_section_link_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'mobile' );
-
- /**
- * Generate Dynamic CSS
- */
-
- $css = '';
- /**
- * Transparent Header Colors
- */
- $transparent_header_desktop = array(
- '.ast-theme-transparent-header.ast-no-toggle-below-menu-enable.ast-header-break-point .ast-below-header-navigation-wrap, .ast-theme-transparent-header .ast-below-header-actual-nav, .ast-theme-transparent-header.ast-header-break-point .ast-below-header-actual-nav' => array(
- 'background-color' => esc_attr( $transparent_menu_bg_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-below-header .ast-search-menu-icon form' => array(
- 'background-color' => esc_attr( $transparent_bg_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-below-header .slide-search .search-field' => array(
- 'background-color' => esc_attr( $transparent_bg_color_desktop ),
- ),
- '.ast-theme-transparent-header .ast-below-header .slide-search .search-field:focus' => array(
- 'background-color' => esc_attr( $transparent_bg_color_desktop ),
- ),
- /**
- * Below Header Navigation
- */
-
- '.ast-theme-transparent-header .ast-below-header-menu, .ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu' => array(
- 'color' => esc_attr( $transparent_menu_color_desktop ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.focus > .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_h_color_desktop ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .ast-menu-toggle' => array(
- 'color' => esc_attr( $transparent_menu_h_color_desktop ),
- ),
-
- /**
- * Below Header Dropdown Navigation
- */
-
- '.ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item:hover > .menu-item, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item:focus > .menu-item, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.focus > .menu-item' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_desktop ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_desktop ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .sub-menu' => array(
- 'background-color' => esc_attr( $transparent_sub_menu_bg_color_desktop ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .sub-menu, .ast-theme-transparent-header .ast-below-header-menu .sub-menu a' => array(
- 'color' => esc_attr( $transparent_sub_menu_color_desktop ),
- ),
-
- /**
- * Content Colors & Typography
- */
- '.ast-theme-transparent-header .below-header-user-select, .ast-theme-transparent-header .below-header-user-select .widget,.ast-theme-transparent-header .below-header-user-select .widget-title' => array(
- 'color' => esc_attr( $transparent_content_section_text_color_desktop ),
- ),
-
- '.ast-theme-transparent-header .below-header-user-select a, .ast-theme-transparent-header .below-header-user-select .widget a' => array(
- 'color' => esc_attr( $transparent_content_section_link_color_desktop ),
- ),
-
- '.ast-theme-transparent-header .below-header-user-select a:hover, .ast-theme-transparent-header .below-header-user-select .widget a:hover' => array(
- 'color' => esc_attr( $transparent_content_section_link_h_color_desktop ),
- ),
- );
-
- $transparent_header_tablet = array(
-
- '.ast-theme-transparent-header.ast-no-toggle-below-menu-enable.ast-header-break-point .ast-below-header-navigation-wrap, .ast-theme-transparent-header .ast-below-header-actual-nav, .ast-theme-transparent-header.ast-header-break-point .ast-below-header-actual-nav' => array(
- 'background-color' => esc_attr( $transparent_menu_bg_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-below-header .ast-search-menu-icon form' => array(
- 'background-color' => esc_attr( $transparent_bg_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-below-header .slide-search .search-field' => array(
- 'background-color' => esc_attr( $transparent_bg_color_tablet ),
- ),
- '.ast-theme-transparent-header .ast-below-header .slide-search .search-field:focus' => array(
- 'background-color' => esc_attr( $transparent_bg_color_tablet ),
- ),
- /**
- * Below Header Navigation
- */
-
- '.ast-theme-transparent-header .ast-below-header-menu, .ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu' => array(
- 'color' => esc_attr( $transparent_menu_color_tablet ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.focus > .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_h_color_tablet ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .ast-menu-toggle' => array(
- 'color' => esc_attr( $transparent_menu_h_color_tablet ),
- ),
-
- /**
- * Below Header Dropdown Navigation
- */
-
- '.ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item:hover > .menu-item, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item:focus > .menu-item, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.focus > .menu-item' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_tablet ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_tablet ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .sub-menu' => array(
- 'background-color' => esc_attr( $transparent_sub_menu_bg_color_tablet ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .sub-menu, .ast-theme-transparent-header .ast-below-header-menu .sub-menu a' => array(
- 'color' => esc_attr( $transparent_sub_menu_color_tablet ),
- ),
-
- /**
- * Content Colors & Typography
- */
- '.ast-theme-transparent-header .below-header-user-select, .ast-theme-transparent-header .below-header-user-select .widget,.ast-theme-transparent-header .below-header-user-select .widget-title' => array(
- 'color' => esc_attr( $transparent_content_section_text_color_tablet ),
- ),
-
- '.ast-theme-transparent-header .below-header-user-select a, .ast-theme-transparent-header .below-header-user-select .widget a' => array(
- 'color' => esc_attr( $transparent_content_section_link_color_tablet ),
- ),
-
- '.ast-theme-transparent-header .below-header-user-select a:hover, .ast-theme-transparent-header .below-header-user-select .widget a:hover' => array(
- 'color' => esc_attr( $transparent_content_section_link_h_color_tablet ),
- ),
- );
-
- $transparent_header_mobile = array(
-
- '.ast-theme-transparent-header.ast-no-toggle-below-menu-enable.ast-header-break-point .ast-below-header-navigation-wrap, .ast-theme-transparent-header .ast-below-header-actual-nav, .ast-theme-transparent-header.ast-header-break-point .ast-below-header-actual-nav' => array(
- 'background-color' => esc_attr( $transparent_menu_bg_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-below-header .ast-search-menu-icon form' => array(
- 'background-color' => esc_attr( $transparent_bg_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-below-header .slide-search .search-field' => array(
- 'background-color' => esc_attr( $transparent_bg_color_mobile ),
- ),
- '.ast-theme-transparent-header .ast-below-header .slide-search .search-field:focus' => array(
- 'background-color' => esc_attr( $transparent_bg_color_mobile ),
- ),
- /**
- * Below Header Navigation
- */
-
- '.ast-theme-transparent-header .ast-below-header-menu, .ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu' => array(
- 'color' => esc_attr( $transparent_menu_color_mobile ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.focus > .menu-link' => array(
- 'color' => esc_attr( $transparent_menu_h_color_mobile ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .ast-menu-toggle' => array(
- 'color' => esc_attr( $transparent_menu_h_color_mobile ),
- ),
-
- /**
- * Below Header Dropdown Navigation
- */
-
- '.ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item:hover > .menu-item, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item:focus > .menu-item, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.focus > .menu-item' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_mobile ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link' => array(
- 'color' => esc_attr( $transparent_sub_menu_h_color_mobile ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .sub-menu' => array(
- 'background-color' => esc_attr( $transparent_sub_menu_bg_color_mobile ),
- ),
-
- '.ast-theme-transparent-header .ast-below-header-menu .sub-menu, .ast-theme-transparent-header .ast-below-header-menu .sub-menu a' => array(
- 'color' => esc_attr( $transparent_sub_menu_color_mobile ),
- ),
-
- /**
- * Content Colors & Typography
- */
- '.ast-theme-transparent-header .below-header-user-select, .ast-theme-transparent-header .below-header-user-select .widget,.ast-theme-transparent-header .below-header-user-select .widget-title' => array(
- 'color' => esc_attr( $transparent_content_section_text_color_mobile ),
- ),
-
- '.ast-theme-transparent-header .below-header-user-select a, .ast-theme-transparent-header .below-header-user-select .widget a' => array(
- 'color' => esc_attr( $transparent_content_section_link_color_mobile ),
- ),
-
- '.ast-theme-transparent-header .below-header-user-select a:hover, .ast-theme-transparent-header .below-header-user-select .widget a:hover' => array(
- 'color' => esc_attr( $transparent_content_section_link_h_color_mobile ),
- ),
- );
-
- /* Parse CSS from array() */
- $css .= astra_parse_css( $transparent_header_desktop );
- $css .= astra_parse_css( $transparent_header_tablet, '', astra_get_tablet_breakpoint() );
- $css .= astra_parse_css( $transparent_header_mobile, '', astra_get_mobile_breakpoint() );
-
- return $dynamic_css . $css;
-}
+<?php +/** + * Transparent Header - Dynamic CSS + * + * @package Astra Addon + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Transparent Above Header + */ +add_filter( 'astra_dynamic_theme_css', 'astra_ext_transparent_above_header_sections_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS for above header transparent header. + */ +function astra_ext_transparent_above_header_sections_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + $above_header_layout = astra_get_option( 'above-header-layout', 'disabled' ); + + if ( 'disabled' === $above_header_layout ) { + return $dynamic_css; + } + + if ( false == Astra_Ext_Transparent_Header_Markup::is_transparent_header() ) { + return $dynamic_css; + } + + /** + * Set colors + */ + + $transparent_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'desktop' ); + $transparent_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'tablet' ); + $transparent_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'mobile' ); + + $transparent_color_site_title_desktop = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'desktop' ); + $transparent_color_site_title_tablet = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'tablet' ); + $transparent_color_site_title_mobile = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'mobile' ); + + $transparent_color_h_site_title_desktop = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'desktop' ); + $transparent_color_h_site_title_tablet = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'tablet' ); + $transparent_color_h_site_title_mobile = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'mobile' ); + + $transparent_menu_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'desktop' ); + $transparent_menu_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'desktop' ); + $transparent_menu_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'desktop' ); + + $transparent_menu_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'tablet' ); + $transparent_menu_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'tablet' ); + $transparent_menu_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'tablet' ); + + $transparent_menu_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'mobile' ); + $transparent_menu_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'mobile' ); + $transparent_menu_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'mobile' ); + + $transparent_sub_menu_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'desktop' ); + $transparent_sub_menu_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'desktop' ); + $transparent_sub_menu_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'desktop' ); + + $transparent_sub_menu_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'tablet' ); + $transparent_sub_menu_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'tablet' ); + $transparent_sub_menu_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'tablet' ); + + $transparent_sub_menu_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'mobile' ); + $transparent_sub_menu_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'mobile' ); + $transparent_sub_menu_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'mobile' ); + + $transparent_content_section_text_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'desktop' ); + $transparent_content_section_link_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'desktop' ); + $transparent_content_section_link_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'desktop' ); + + $transparent_content_section_text_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'tablet' ); + $transparent_content_section_link_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'tablet' ); + $transparent_content_section_link_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'tablet' ); + + $transparent_content_section_text_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'mobile' ); + $transparent_content_section_link_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'mobile' ); + $transparent_content_section_link_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'mobile' ); + + /** + * Generate Dynamic CSS + */ + + $css = ''; + /** + * Transparent Header Colors + */ + $transparent_header_desktop = array( + '.ast-theme-transparent-header .ast-above-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-above-header-section-separated .ast-above-header-navigation ul.ast-above-header-menu' => array( + 'background-color' => esc_attr( $transparent_menu_bg_color_desktop ), + ), + '.ast-theme-transparent-header .ast-above-header .ast-search-menu-icon form' => array( + 'background-color' => esc_attr( $transparent_bg_color_desktop ), + ), + '.ast-theme-transparent-header .ast-above-header .slide-search .search-field' => array( + 'background-color' => esc_attr( $transparent_bg_color_desktop ), + ), + '.ast-theme-transparent-header .ast-above-header .slide-search .search-field:focus' => array( + 'background-color' => esc_attr( $transparent_bg_color_desktop ), + ), + + '.ast-theme-transparent-header .ast-above-header-navigation .menu-item.current-menu-item > .menu-link,.ast-theme-transparent-header .ast-above-header-navigation .menu-item.current-menu-ancestor > .menu-link' => array( + 'color' => esc_attr( $transparent_menu_h_color_desktop ), + ), + '.ast-theme-transparent-header .ast-above-header-navigation .menu-item:hover > .menu-link' => array( + 'color' => esc_attr( $transparent_menu_h_color_desktop ), + ), + + '.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation > ul.ast-above-header-menu > .menu-item-has-children:not(.current-menu-item) > .ast-menu-toggle' => array( + 'color' => esc_attr( $transparent_menu_color_desktop ), + ), + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu' => array( + 'background-color' => esc_attr( $transparent_sub_menu_bg_color_desktop ), + ), + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:hover > .menu-item, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:focus > .menu-item, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.focus > .menu-item,.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.focus > .ast-menu-toggle' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_desktop ), + ), + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item.focus > .ast-menu-toggle' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_desktop ), + ), + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_desktop ), + ), + + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu, .ast-theme-transparent-header .ast-above-header-navigation .ast-above-header-menu .sub-menu a' => array( + 'color' => esc_attr( $transparent_sub_menu_color_desktop ), + ), + + // Content Section text color. + '.ast-theme-transparent-header .ast-above-header-section .user-select, .ast-theme-transparent-header .ast-above-header-section .widget, .ast-theme-transparent-header .ast-above-header-section .widget-title' => array( + 'color' => esc_attr( $transparent_content_section_text_color_desktop ), + ), + // Content Section link color. + '.ast-theme-transparent-header .ast-above-header-section .user-select a, .ast-theme-transparent-header .ast-above-header-section .widget a' => array( + 'color' => esc_attr( $transparent_content_section_link_color_desktop ), + ), + // Content Section link hover color. + '.ast-theme-transparent-header .ast-above-header-section .user-select a:hover, .ast-theme-transparent-header .ast-above-header-section .widget a:hover' => array( + 'color' => esc_attr( $transparent_content_section_link_h_color_desktop ), + ), + + ); + + $transparent_header_tablet = array( + '.ast-theme-transparent-header .ast-above-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-above-header-section-separated .ast-above-header-navigation ul.ast-above-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-below-header-section-separated .ast-below-header-actual-nav' => array( + 'background-color' => esc_attr( $transparent_menu_bg_color_tablet ), + ), + '.ast-theme-transparent-header .ast-above-header .ast-search-menu-icon form' => array( + 'background-color' => esc_attr( $transparent_bg_color_tablet ), + ), + '.ast-theme-transparent-header .ast-above-header .slide-search .search-field' => array( + 'background-color' => esc_attr( $transparent_bg_color_tablet ), + ), + '.ast-theme-transparent-header .ast-above-header .slide-search .search-field:focus' => array( + 'background-color' => esc_attr( $transparent_bg_color_tablet ), + ), + + '.ast-theme-transparent-header .ast-above-header-navigation .menu-item.current-menu-item > .menu-link,.ast-theme-transparent-header .ast-above-header-navigation .menu-item.current-menu-ancestor > .menu-link' => array( + 'color' => esc_attr( $transparent_menu_h_color_tablet ), + ), + '.ast-theme-transparent-header .ast-above-header-navigation .menu-item:hover > .menu-link' => array( + 'color' => esc_attr( $transparent_menu_h_color_tablet ), + ), + + '.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation > ul.ast-above-header-menu > .menu-item-has-children:not(.current-menu-item) > .ast-menu-toggle' => array( + 'color' => esc_attr( $transparent_menu_color_tablet ), + ), + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu' => array( + 'background-color' => esc_attr( $transparent_sub_menu_bg_color_tablet ), + ), + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:hover > .menu-item, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:focus > .menu-item, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.focus > .menu-item,.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.focus > .ast-menu-toggle' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_tablet ), + ), + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item.focus > .ast-menu-toggle' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_tablet ), + ), + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_tablet ), + ), + + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu, .ast-theme-transparent-header .ast-above-header-navigation .ast-above-header-menu .sub-menu a' => array( + 'color' => esc_attr( $transparent_sub_menu_color_tablet ), + ), + + // Content Section text color. + '.ast-theme-transparent-header .ast-above-header-section .user-select, .ast-theme-transparent-header .ast-above-header-section .widget, .ast-theme-transparent-header .ast-above-header-section .widget-title' => array( + 'color' => esc_attr( $transparent_content_section_text_color_tablet ), + ), + // Content Section link color. + '.ast-theme-transparent-header .ast-above-header-section .user-select a, .ast-theme-transparent-header .ast-above-header-section .widget a' => array( + 'color' => esc_attr( $transparent_content_section_link_color_tablet ), + ), + // Content Section link hover color. + '.ast-theme-transparent-header .ast-above-header-section .user-select a:hover, .ast-theme-transparent-header .ast-above-header-section .widget a:hover' => array( + 'color' => esc_attr( $transparent_content_section_link_h_color_tablet ), + ), + ); + + $transparent_header_mobile = array( + '.ast-theme-transparent-header .ast-above-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-above-header-section-separated .ast-above-header-navigation ul.ast-above-header-menu, .ast-theme-transparent-header.ast-header-break-point .ast-below-header-section-separated .ast-below-header-actual-nav' => array( + 'background-color' => esc_attr( $transparent_menu_bg_color_mobile ), + ), + '.ast-theme-transparent-header .ast-above-header .ast-search-menu-icon form' => array( + 'background-color' => esc_attr( $transparent_bg_color_mobile ), + ), + '.ast-theme-transparent-header .ast-above-header .slide-search .search-field' => array( + 'background-color' => esc_attr( $transparent_bg_color_mobile ), + ), + '.ast-theme-transparent-header .ast-above-header .slide-search .search-field:focus' => array( + 'background-color' => esc_attr( $transparent_bg_color_mobile ), + ), + + '.ast-theme-transparent-header .ast-above-header-navigation .menu-item.current-menu-item > .menu-link,.ast-theme-transparent-header .ast-above-header-navigation .menu-item.current-menu-ancestor > .menu-link' => array( + 'color' => esc_attr( $transparent_menu_h_color_mobile ), + ), + '.ast-theme-transparent-header .ast-above-header-navigation .menu-item:hover > .menu-link' => array( + 'color' => esc_attr( $transparent_menu_h_color_mobile ), + ), + + '.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation a, .ast-header-break-point.ast-theme-transparent-header .ast-above-header-navigation > ul.ast-above-header-menu > .menu-item-has-children:not(.current-menu-item) > .ast-menu-toggle' => array( + 'color' => esc_attr( $transparent_menu_color_mobile ), + ), + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu' => array( + 'background-color' => esc_attr( $transparent_sub_menu_bg_color_mobile ), + ), + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:hover > .menu-item, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:focus > .menu-item, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.focus > .menu-item,.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.focus > .ast-menu-toggle' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_mobile ), + ), + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item.focus > .ast-menu-toggle' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_mobile ), + ), + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-above-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_mobile ), + ), + + '.ast-theme-transparent-header .ast-above-header-menu .sub-menu, .ast-theme-transparent-header .ast-above-header-navigation .ast-above-header-menu .sub-menu a' => array( + 'color' => esc_attr( $transparent_sub_menu_color_mobile ), + ), + + // Content Section text color. + '.ast-theme-transparent-header .ast-above-header-section .user-select, .ast-theme-transparent-header .ast-above-header-section .widget, .ast-theme-transparent-header .ast-above-header-section .widget-title' => array( + 'color' => esc_attr( $transparent_content_section_text_color_mobile ), + ), + // Content Section link color. + '.ast-theme-transparent-header .ast-above-header-section .user-select a, .ast-theme-transparent-header .ast-above-header-section .widget a' => array( + 'color' => esc_attr( $transparent_content_section_link_color_mobile ), + ), + // Content Section link hover color. + '.ast-theme-transparent-header .ast-above-header-section .user-select a:hover, .ast-theme-transparent-header .ast-above-header-section .widget a:hover' => array( + 'color' => esc_attr( $transparent_content_section_link_h_color_mobile ), + ), + ); + + /* Parse CSS from array() */ + $css .= astra_parse_css( $transparent_header_desktop ); + $css .= astra_parse_css( $transparent_header_tablet, '', astra_get_tablet_breakpoint() ); + $css .= astra_parse_css( $transparent_header_mobile, '', astra_get_mobile_breakpoint() ); + + return $dynamic_css . $css; + +} + + + +/** + * Transparent Below Header + */ +add_filter( 'astra_dynamic_theme_css', 'astra_ext_transparent_below_header_sections_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS. + */ +function astra_ext_transparent_below_header_sections_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + // set page width depending on site layout. + $below_header_layout = astra_get_option( 'below-header-layout', 'disabled' ); + + if ( 'disabled' === $below_header_layout ) { + return $dynamic_css; + } + + if ( false == Astra_Ext_Transparent_Header_Markup::is_transparent_header() ) { + return $dynamic_css; + } + + /** + * Set colors + */ + + $transparent_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'desktop' ); + $transparent_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'tablet' ); + $transparent_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-header-bg-color-responsive' ), 'mobile' ); + + $transparent_color_site_title_desktop = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'desktop' ); + $transparent_color_site_title_tablet = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'tablet' ); + $transparent_color_site_title_mobile = astra_get_prop( astra_get_option( 'transparent-header-color-site-title-responsive' ), 'mobile' ); + + $transparent_color_h_site_title_desktop = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'desktop' ); + $transparent_color_h_site_title_tablet = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'tablet' ); + $transparent_color_h_site_title_mobile = astra_get_prop( astra_get_option( 'transparent-header-color-h-site-title-responsive' ), 'mobile' ); + + $transparent_menu_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'desktop' ); + $transparent_menu_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'desktop' ); + $transparent_menu_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'desktop' ); + + $transparent_menu_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'tablet' ); + $transparent_menu_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'tablet' ); + $transparent_menu_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'tablet' ); + + $transparent_menu_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-bg-color-responsive' ), 'mobile' ); + $transparent_menu_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-color-responsive' ), 'mobile' ); + $transparent_menu_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-menu-h-color-responsive' ), 'mobile' ); + + $transparent_sub_menu_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'desktop' ); + $transparent_sub_menu_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'desktop' ); + $transparent_sub_menu_bg_color_desktop = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'desktop' ); + + $transparent_sub_menu_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'tablet' ); + $transparent_sub_menu_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'tablet' ); + $transparent_sub_menu_bg_color_tablet = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'tablet' ); + + $transparent_sub_menu_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-color-responsive' ), 'mobile' ); + $transparent_sub_menu_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-h-color-responsive' ), 'mobile' ); + $transparent_sub_menu_bg_color_mobile = astra_get_prop( astra_get_option( 'transparent-submenu-bg-color-responsive' ), 'mobile' ); + + $transparent_content_section_text_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'desktop' ); + $transparent_content_section_link_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'desktop' ); + $transparent_content_section_link_h_color_desktop = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'desktop' ); + + $transparent_content_section_text_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'tablet' ); + $transparent_content_section_link_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'tablet' ); + $transparent_content_section_link_h_color_tablet = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'tablet' ); + + $transparent_content_section_text_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-text-color-responsive' ), 'mobile' ); + $transparent_content_section_link_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-link-color-responsive' ), 'mobile' ); + $transparent_content_section_link_h_color_mobile = astra_get_prop( astra_get_option( 'transparent-content-section-link-h-color-responsive' ), 'mobile' ); + + /** + * Generate Dynamic CSS + */ + + $css = ''; + /** + * Transparent Header Colors + */ + $transparent_header_desktop = array( + '.ast-theme-transparent-header.ast-no-toggle-below-menu-enable.ast-header-break-point .ast-below-header-navigation-wrap, .ast-theme-transparent-header .ast-below-header-actual-nav, .ast-theme-transparent-header.ast-header-break-point .ast-below-header-actual-nav' => array( + 'background-color' => esc_attr( $transparent_menu_bg_color_desktop ), + ), + '.ast-theme-transparent-header .ast-below-header .ast-search-menu-icon form' => array( + 'background-color' => esc_attr( $transparent_bg_color_desktop ), + ), + '.ast-theme-transparent-header .ast-below-header .slide-search .search-field' => array( + 'background-color' => esc_attr( $transparent_bg_color_desktop ), + ), + '.ast-theme-transparent-header .ast-below-header .slide-search .search-field:focus' => array( + 'background-color' => esc_attr( $transparent_bg_color_desktop ), + ), + /** + * Below Header Navigation + */ + + '.ast-theme-transparent-header .ast-below-header-menu, .ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu' => array( + 'color' => esc_attr( $transparent_menu_color_desktop ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.focus > .menu-link' => array( + 'color' => esc_attr( $transparent_menu_h_color_desktop ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .ast-menu-toggle' => array( + 'color' => esc_attr( $transparent_menu_h_color_desktop ), + ), + + /** + * Below Header Dropdown Navigation + */ + + '.ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item:hover > .menu-item, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item:focus > .menu-item, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.focus > .menu-item' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_desktop ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_desktop ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .sub-menu' => array( + 'background-color' => esc_attr( $transparent_sub_menu_bg_color_desktop ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .sub-menu, .ast-theme-transparent-header .ast-below-header-menu .sub-menu a' => array( + 'color' => esc_attr( $transparent_sub_menu_color_desktop ), + ), + + /** + * Content Colors & Typography + */ + '.ast-theme-transparent-header .below-header-user-select, .ast-theme-transparent-header .below-header-user-select .widget,.ast-theme-transparent-header .below-header-user-select .widget-title' => array( + 'color' => esc_attr( $transparent_content_section_text_color_desktop ), + ), + + '.ast-theme-transparent-header .below-header-user-select a, .ast-theme-transparent-header .below-header-user-select .widget a' => array( + 'color' => esc_attr( $transparent_content_section_link_color_desktop ), + ), + + '.ast-theme-transparent-header .below-header-user-select a:hover, .ast-theme-transparent-header .below-header-user-select .widget a:hover' => array( + 'color' => esc_attr( $transparent_content_section_link_h_color_desktop ), + ), + ); + + $transparent_header_tablet = array( + + '.ast-theme-transparent-header.ast-no-toggle-below-menu-enable.ast-header-break-point .ast-below-header-navigation-wrap, .ast-theme-transparent-header .ast-below-header-actual-nav, .ast-theme-transparent-header.ast-header-break-point .ast-below-header-actual-nav' => array( + 'background-color' => esc_attr( $transparent_menu_bg_color_tablet ), + ), + '.ast-theme-transparent-header .ast-below-header .ast-search-menu-icon form' => array( + 'background-color' => esc_attr( $transparent_bg_color_tablet ), + ), + '.ast-theme-transparent-header .ast-below-header .slide-search .search-field' => array( + 'background-color' => esc_attr( $transparent_bg_color_tablet ), + ), + '.ast-theme-transparent-header .ast-below-header .slide-search .search-field:focus' => array( + 'background-color' => esc_attr( $transparent_bg_color_tablet ), + ), + /** + * Below Header Navigation + */ + + '.ast-theme-transparent-header .ast-below-header-menu, .ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu' => array( + 'color' => esc_attr( $transparent_menu_color_tablet ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.focus > .menu-link' => array( + 'color' => esc_attr( $transparent_menu_h_color_tablet ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .ast-menu-toggle' => array( + 'color' => esc_attr( $transparent_menu_h_color_tablet ), + ), + + /** + * Below Header Dropdown Navigation + */ + + '.ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item:hover > .menu-item, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item:focus > .menu-item, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.focus > .menu-item' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_tablet ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_tablet ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .sub-menu' => array( + 'background-color' => esc_attr( $transparent_sub_menu_bg_color_tablet ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .sub-menu, .ast-theme-transparent-header .ast-below-header-menu .sub-menu a' => array( + 'color' => esc_attr( $transparent_sub_menu_color_tablet ), + ), + + /** + * Content Colors & Typography + */ + '.ast-theme-transparent-header .below-header-user-select, .ast-theme-transparent-header .below-header-user-select .widget,.ast-theme-transparent-header .below-header-user-select .widget-title' => array( + 'color' => esc_attr( $transparent_content_section_text_color_tablet ), + ), + + '.ast-theme-transparent-header .below-header-user-select a, .ast-theme-transparent-header .below-header-user-select .widget a' => array( + 'color' => esc_attr( $transparent_content_section_link_color_tablet ), + ), + + '.ast-theme-transparent-header .below-header-user-select a:hover, .ast-theme-transparent-header .below-header-user-select .widget a:hover' => array( + 'color' => esc_attr( $transparent_content_section_link_h_color_tablet ), + ), + ); + + $transparent_header_mobile = array( + + '.ast-theme-transparent-header.ast-no-toggle-below-menu-enable.ast-header-break-point .ast-below-header-navigation-wrap, .ast-theme-transparent-header .ast-below-header-actual-nav, .ast-theme-transparent-header.ast-header-break-point .ast-below-header-actual-nav' => array( + 'background-color' => esc_attr( $transparent_menu_bg_color_mobile ), + ), + '.ast-theme-transparent-header .ast-below-header .ast-search-menu-icon form' => array( + 'background-color' => esc_attr( $transparent_bg_color_mobile ), + ), + '.ast-theme-transparent-header .ast-below-header .slide-search .search-field' => array( + 'background-color' => esc_attr( $transparent_bg_color_mobile ), + ), + '.ast-theme-transparent-header .ast-below-header .slide-search .search-field:focus' => array( + 'background-color' => esc_attr( $transparent_bg_color_mobile ), + ), + /** + * Below Header Navigation + */ + + '.ast-theme-transparent-header .ast-below-header-menu, .ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu a, .ast-header-break-point.ast-theme-transparent-header .ast-below-header-menu' => array( + 'color' => esc_attr( $transparent_menu_color_mobile ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.focus > .menu-link' => array( + 'color' => esc_attr( $transparent_menu_h_color_mobile ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-ancestor > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .menu-item.current-menu-item > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .ast-menu-toggle, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .ast-menu-toggle' => array( + 'color' => esc_attr( $transparent_menu_h_color_mobile ), + ), + + /** + * Below Header Dropdown Navigation + */ + + '.ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item:hover > .menu-item, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item:focus > .menu-item, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.focus > .menu-item' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_mobile ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-ancestor.focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:hover > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item:focus > .menu-link, .ast-theme-transparent-header .ast-below-header-menu .sub-menu .menu-item.current-menu-item.focus > .menu-link' => array( + 'color' => esc_attr( $transparent_sub_menu_h_color_mobile ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .sub-menu' => array( + 'background-color' => esc_attr( $transparent_sub_menu_bg_color_mobile ), + ), + + '.ast-theme-transparent-header .ast-below-header-menu .sub-menu, .ast-theme-transparent-header .ast-below-header-menu .sub-menu a' => array( + 'color' => esc_attr( $transparent_sub_menu_color_mobile ), + ), + + /** + * Content Colors & Typography + */ + '.ast-theme-transparent-header .below-header-user-select, .ast-theme-transparent-header .below-header-user-select .widget,.ast-theme-transparent-header .below-header-user-select .widget-title' => array( + 'color' => esc_attr( $transparent_content_section_text_color_mobile ), + ), + + '.ast-theme-transparent-header .below-header-user-select a, .ast-theme-transparent-header .below-header-user-select .widget a' => array( + 'color' => esc_attr( $transparent_content_section_link_color_mobile ), + ), + + '.ast-theme-transparent-header .below-header-user-select a:hover, .ast-theme-transparent-header .below-header-user-select .widget a:hover' => array( + 'color' => esc_attr( $transparent_content_section_link_h_color_mobile ), + ), + ); + + /* Parse CSS from array() */ + $css .= astra_parse_css( $transparent_header_desktop ); + $css .= astra_parse_css( $transparent_header_tablet, '', astra_get_tablet_breakpoint() ); + $css .= astra_parse_css( $transparent_header_mobile, '', astra_get_mobile_breakpoint() ); + + return $dynamic_css . $css; +} diff --git a/inc/addons/transparent-header/classes/index.php b/inc/addons/transparent-header/classes/index.php index 02f2fd6..7860b5b 100644 --- a/inc/addons/transparent-header/classes/index.php +++ b/inc/addons/transparent-header/classes/index.php @@ -1,9 +1,9 @@ -<?php
-/**
- * Index file
- *
- * @package Astra Addon
- * @since Astra 1.0.0
- */
-
-/* Silence is golden, and we agree. */
+<?php +/** + * Index file + * + * @package Astra Addon + * @since Astra 1.0.0 + */ + +/* Silence is golden, and we agree. */ diff --git a/inc/addons/transparent-header/classes/sections/class-astra-customizer-colors-transparent-header-configs.php b/inc/addons/transparent-header/classes/sections/class-astra-customizer-colors-transparent-header-configs.php index a6ddb1a..28aae9e 100644 --- a/inc/addons/transparent-header/classes/sections/class-astra-customizer-colors-transparent-header-configs.php +++ b/inc/addons/transparent-header/classes/sections/class-astra-customizer-colors-transparent-header-configs.php @@ -1,252 +1,252 @@ -<?php
-/**
- * Colors and Background - Header Options for our theme.
- *
- * @package Astra Addon
- * @author Brainstorm Force
- * @copyright Copyright (c) 2020, Brainstorm Force
- * @link https://www.brainstormforce.com
- * @since Astra 1.4.3
- */
-
-// Block direct access to the file.
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-// Bail if Customizer config base class does not exist.
-if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) {
- return;
-}
-
-/**
- * Customizer Sanitizes
- *
- * @since 1.4.3
- */
-if ( ! class_exists( 'Astra_Customizer_Colors_Transparent_Header_Configs' ) ) {
-
- /**
- * Register Colors and Background - Header Options Customizer Configurations.
- */
- class Astra_Customizer_Colors_Transparent_Header_Configs extends Astra_Customizer_Config_Base {
-
- /**
- * Register Colors and Background - Header Options Customizer Configurations.
- *
- * @param Array $configurations Astra Customizer Configurations.
- * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
- * @since 1.4.3
- * @return Array Astra Customizer Configurations with updated configurations.
- */
- public function register_configuration( $configurations, $wp_customize ) {
-
- $_configs = array(
-
- /**
- * Option: Header background overlay color
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-bg-color-responsive]',
- 'default' => astra_get_option( 'transparent-header-bg-color-responsive' ),
- 'section' => 'section-transparent-header',
- 'type' => 'control',
- 'priority' => 34,
- 'transport' => 'postMessage',
- 'control' => 'ast-responsive-color',
- 'title' => __( 'Background Overlay', 'astra' ),
- 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab,
- 'responsive' => true,
- 'rgba' => true,
- ),
-
- /**
- * Option: Site Title Color
- */
- array(
- 'name' => 'transparent-header-color-site-title-responsive',
- 'default' => astra_get_option( 'transparent-header-color-site-title-responsive' ),
- 'type' => 'sub-control',
- 'priority' => 1,
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors]',
- 'section' => 'section-transparent-header',
- 'control' => 'ast-responsive-color',
- 'transport' => 'postMessage',
- 'title' => __( 'Normal', 'astra' ),
- 'tab' => __( 'Normal', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- ),
-
- /**
- * Option: Site Title Hover Color
- */
- array(
- 'name' => 'transparent-header-color-h-site-title-responsive',
- 'default' => astra_get_option( 'transparent-header-color-h-site-title-responsive' ),
- 'type' => 'sub-control',
- 'priority' => 1,
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors]',
- 'section' => 'section-transparent-header',
- 'control' => 'ast-responsive-color',
- 'transport' => 'postMessage',
- 'title' => __( 'Hover', 'astra' ),
- 'tab' => __( 'Hover', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- ),
-
- /**
- * Option: Primary Menu Color
- */
- array(
- 'name' => 'transparent-menu-color-responsive',
- 'default' => astra_get_option( 'transparent-menu-color-responsive' ),
- 'type' => 'sub-control',
- 'priority' => 2,
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-menu]',
- 'section' => 'section-transparent-header',
- 'control' => 'ast-responsive-color',
- 'transport' => 'postMessage',
- 'tab' => __( 'Normal', 'astra' ),
- 'title' => __( 'Normal', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- ),
-
- /**
- * Option: Menu Background Color
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-menu-bg-color-responsive]',
- 'default' => astra_get_option( 'transparent-menu-bg-color-responsive' ),
- 'type' => 'control',
- 'priority' => 36,
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'control' => 'ast-responsive-color',
- 'tab' => __( 'Normal', 'astra' ),
- 'title' => __( 'Background', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab,
- ),
-
- /**
- * Option: Menu Hover Color
- */
- array(
- 'name' => 'transparent-menu-h-color-responsive',
- 'default' => astra_get_option( 'transparent-menu-h-color-responsive' ),
- 'type' => 'sub-control',
- 'priority' => 3,
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-menu]',
- 'section' => 'section-transparent-header',
- 'control' => 'ast-responsive-color',
- 'transport' => 'postMessage',
- 'tab' => __( 'Hover', 'astra' ),
- 'title' => __( 'Hover / Active', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- ),
-
- /**
- * Option: Sub menu text color.
- */
- array(
- 'name' => 'transparent-submenu-color-responsive',
- 'default' => astra_get_option( 'transparent-submenu-color-responsive' ),
- 'type' => 'sub-control',
- 'priority' => 3,
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-submenu]',
- 'section' => 'section-transparent-header',
- 'control' => 'ast-responsive-color',
- 'transport' => 'postMessage',
- 'tab' => __( 'Normal', 'astra' ),
- 'title' => __( 'Normal', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- ),
-
- /**
- * Option: Sub menu background color.
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-submenu-bg-color-responsive]',
- 'default' => astra_get_option( 'transparent-submenu-bg-color-responsive' ),
- 'type' => 'control',
- 'priority' => 38,
- 'section' => 'section-transparent-header',
- 'control' => 'ast-responsive-color',
- 'transport' => 'postMessage',
- 'tab' => __( 'Normal', 'astra' ),
- 'title' => __( 'Background', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab,
- ),
-
- /**
- * Option: Sub menu active hover color.
- */
- array(
- 'name' => 'transparent-submenu-h-color-responsive',
- 'default' => astra_get_option( 'transparent-submenu-h-color-responsive' ),
- 'type' => 'sub-control',
- 'priority' => 3,
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-submenu]',
- 'section' => 'section-transparent-header',
- 'control' => 'ast-responsive-color',
- 'transport' => 'postMessage',
- 'tab' => __( 'Hover', 'astra' ),
- 'title' => __( 'Hover / Active', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- ),
-
- /**
- * Option: Content Section Link color.
- */
- array(
- 'name' => 'transparent-content-section-link-color-responsive',
- 'default' => astra_get_option( 'transparent-content-section-link-color-responsive' ),
- 'type' => 'sub-control',
- 'priority' => 4,
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-content]',
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'control' => 'ast-responsive-color',
- 'tab' => __( 'Normal', 'astra' ),
- 'title' => __( 'Normal', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- ),
-
- /**
- * Option: Content Section Link Hover color.
- */
- array(
- 'name' => 'transparent-content-section-link-h-color-responsive',
- 'default' => astra_get_option( 'transparent-content-section-link-h-color-responsive' ),
- 'type' => 'sub-control',
- 'priority' => 4,
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-content]',
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'control' => 'ast-responsive-color',
- 'tab' => __( 'Hover', 'astra' ),
- 'title' => __( 'Hover', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- ),
- );
-
- return array_merge( $configurations, $_configs );
- }
- }
-}
-
-/**
- * Kicking this off by calling 'get_instance()' method
- */
-new Astra_Customizer_Colors_Transparent_Header_Configs();
+<?php +/** + * Colors and Background - Header Options for our theme. + * + * @package Astra Addon + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 1.4.3 + */ + +// Block direct access to the file. +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +// Bail if Customizer config base class does not exist. +if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { + return; +} + +/** + * Customizer Sanitizes + * + * @since 1.4.3 + */ +if ( ! class_exists( 'Astra_Customizer_Colors_Transparent_Header_Configs' ) ) { + + /** + * Register Colors and Background - Header Options Customizer Configurations. + */ + class Astra_Customizer_Colors_Transparent_Header_Configs extends Astra_Customizer_Config_Base { + + /** + * Register Colors and Background - Header Options Customizer Configurations. + * + * @param Array $configurations Astra Customizer Configurations. + * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. + * @since 1.4.3 + * @return Array Astra Customizer Configurations with updated configurations. + */ + public function register_configuration( $configurations, $wp_customize ) { + + $_configs = array( + + /** + * Option: Header background overlay color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-bg-color-responsive]', + 'default' => astra_get_option( 'transparent-header-bg-color-responsive' ), + 'section' => 'section-transparent-header', + 'type' => 'control', + 'priority' => 34, + 'transport' => 'postMessage', + 'control' => 'ast-responsive-color', + 'title' => __( 'Background Overlay', 'astra' ), + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + 'responsive' => true, + 'rgba' => true, + ), + + /** + * Option: Site Title Color + */ + array( + 'name' => 'transparent-header-color-site-title-responsive', + 'default' => astra_get_option( 'transparent-header-color-site-title-responsive' ), + 'type' => 'sub-control', + 'priority' => 1, + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors]', + 'section' => 'section-transparent-header', + 'control' => 'ast-responsive-color', + 'transport' => 'postMessage', + 'title' => __( 'Normal', 'astra' ), + 'tab' => __( 'Normal', 'astra' ), + 'responsive' => true, + 'rgba' => true, + ), + + /** + * Option: Site Title Hover Color + */ + array( + 'name' => 'transparent-header-color-h-site-title-responsive', + 'default' => astra_get_option( 'transparent-header-color-h-site-title-responsive' ), + 'type' => 'sub-control', + 'priority' => 1, + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors]', + 'section' => 'section-transparent-header', + 'control' => 'ast-responsive-color', + 'transport' => 'postMessage', + 'title' => __( 'Hover', 'astra' ), + 'tab' => __( 'Hover', 'astra' ), + 'responsive' => true, + 'rgba' => true, + ), + + /** + * Option: Primary Menu Color + */ + array( + 'name' => 'transparent-menu-color-responsive', + 'default' => astra_get_option( 'transparent-menu-color-responsive' ), + 'type' => 'sub-control', + 'priority' => 2, + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-menu]', + 'section' => 'section-transparent-header', + 'control' => 'ast-responsive-color', + 'transport' => 'postMessage', + 'tab' => __( 'Normal', 'astra' ), + 'title' => __( 'Normal', 'astra' ), + 'responsive' => true, + 'rgba' => true, + ), + + /** + * Option: Menu Background Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-menu-bg-color-responsive]', + 'default' => astra_get_option( 'transparent-menu-bg-color-responsive' ), + 'type' => 'control', + 'priority' => 36, + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'control' => 'ast-responsive-color', + 'tab' => __( 'Normal', 'astra' ), + 'title' => __( 'Background', 'astra' ), + 'responsive' => true, + 'rgba' => true, + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + ), + + /** + * Option: Menu Hover Color + */ + array( + 'name' => 'transparent-menu-h-color-responsive', + 'default' => astra_get_option( 'transparent-menu-h-color-responsive' ), + 'type' => 'sub-control', + 'priority' => 3, + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-menu]', + 'section' => 'section-transparent-header', + 'control' => 'ast-responsive-color', + 'transport' => 'postMessage', + 'tab' => __( 'Hover', 'astra' ), + 'title' => __( 'Hover / Active', 'astra' ), + 'responsive' => true, + 'rgba' => true, + ), + + /** + * Option: Sub menu text color. + */ + array( + 'name' => 'transparent-submenu-color-responsive', + 'default' => astra_get_option( 'transparent-submenu-color-responsive' ), + 'type' => 'sub-control', + 'priority' => 3, + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-submenu]', + 'section' => 'section-transparent-header', + 'control' => 'ast-responsive-color', + 'transport' => 'postMessage', + 'tab' => __( 'Normal', 'astra' ), + 'title' => __( 'Normal', 'astra' ), + 'responsive' => true, + 'rgba' => true, + ), + + /** + * Option: Sub menu background color. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-submenu-bg-color-responsive]', + 'default' => astra_get_option( 'transparent-submenu-bg-color-responsive' ), + 'type' => 'control', + 'priority' => 38, + 'section' => 'section-transparent-header', + 'control' => 'ast-responsive-color', + 'transport' => 'postMessage', + 'tab' => __( 'Normal', 'astra' ), + 'title' => __( 'Background', 'astra' ), + 'responsive' => true, + 'rgba' => true, + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + ), + + /** + * Option: Sub menu active hover color. + */ + array( + 'name' => 'transparent-submenu-h-color-responsive', + 'default' => astra_get_option( 'transparent-submenu-h-color-responsive' ), + 'type' => 'sub-control', + 'priority' => 3, + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-submenu]', + 'section' => 'section-transparent-header', + 'control' => 'ast-responsive-color', + 'transport' => 'postMessage', + 'tab' => __( 'Hover', 'astra' ), + 'title' => __( 'Hover / Active', 'astra' ), + 'responsive' => true, + 'rgba' => true, + ), + + /** + * Option: Content Section Link color. + */ + array( + 'name' => 'transparent-content-section-link-color-responsive', + 'default' => astra_get_option( 'transparent-content-section-link-color-responsive' ), + 'type' => 'sub-control', + 'priority' => 4, + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-content]', + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'control' => 'ast-responsive-color', + 'tab' => __( 'Normal', 'astra' ), + 'title' => __( 'Normal', 'astra' ), + 'responsive' => true, + 'rgba' => true, + ), + + /** + * Option: Content Section Link Hover color. + */ + array( + 'name' => 'transparent-content-section-link-h-color-responsive', + 'default' => astra_get_option( 'transparent-content-section-link-h-color-responsive' ), + 'type' => 'sub-control', + 'priority' => 4, + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-content]', + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'control' => 'ast-responsive-color', + 'tab' => __( 'Hover', 'astra' ), + 'title' => __( 'Hover', 'astra' ), + 'responsive' => true, + 'rgba' => true, + ), + ); + + return array_merge( $configurations, $_configs ); + } + } +} + +/** + * Kicking this off by calling 'get_instance()' method + */ +new Astra_Customizer_Colors_Transparent_Header_Configs(); diff --git a/inc/addons/transparent-header/classes/sections/class-astra-customizer-transparent-header-configs.php b/inc/addons/transparent-header/classes/sections/class-astra-customizer-transparent-header-configs.php index fc820fb..693c2b2 100644 --- a/inc/addons/transparent-header/classes/sections/class-astra-customizer-transparent-header-configs.php +++ b/inc/addons/transparent-header/classes/sections/class-astra-customizer-transparent-header-configs.php @@ -1,1200 +1,1200 @@ -<?php
-/**
- * Transparent Header Options for our theme.
- *
- * @package Astra Addon
- * @author Brainstorm Force
- * @copyright Copyright (c) 2020, Brainstorm Force
- * @link https://www.brainstormforce.com
- * @since Astra 1.4.3
- */
-
-// Block direct access to the file.
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-// Bail if Customizer config base class does not exist.
-if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) {
- return;
-}
-
-/**
- * Customizer Sanitizes
- *
- * @since 1.4.3
- */
-if ( ! class_exists( 'Astra_Customizer_Transparent_Header_Configs' ) ) {
-
- /**
- * Register Transparent Header Customizer Configurations.
- */
- class Astra_Customizer_Transparent_Header_Configs extends Astra_Customizer_Config_Base {
-
- /**
- * Register Transparent Header Customizer Configurations.
- *
- * @param Array $configurations Astra Customizer Configurations.
- * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager.
- * @since 1.4.3
- * @return Array Astra Customizer Configurations with updated configurations.
- */
- public function register_configuration( $configurations, $wp_customize ) {
-
- $_section = 'section-transparent-header';
-
- $_configs = array(
-
- /**
- * Option: Enable Transparent Header
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]',
- 'default' => astra_get_option( 'transparent-header-enable' ),
- 'type' => 'control',
- 'section' => $_section,
- 'title' => __( 'Enable on Complete Website', 'astra' ),
- 'priority' => 20,
- 'control' => 'ast-toggle-control',
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Disable Transparent Header on Archive Pages
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-disable-archive]',
- 'default' => astra_get_option( 'transparent-header-disable-archive' ),
- 'type' => 'control',
- 'section' => $_section,
- 'context' => array(
- Astra_Builder_Helper::$general_tab_config,
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]',
- 'operator' => '==',
- 'value' => '1',
- ),
- ),
- 'title' => __( 'Disable on 404, Search & Archives?', 'astra' ),
- 'description' => __( 'This setting is generally not recommended on special pages such as archive, search, 404, etc. If you would like to enable it, uncheck this option', 'astra' ),
- 'priority' => 25,
- 'control' => 'ast-toggle-control',
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Disable Transparent Header on Archive Pages
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-disable-index]',
- 'default' => astra_get_option( 'transparent-header-disable-index' ),
- 'type' => 'control',
- 'section' => $_section,
- 'context' => array(
- Astra_Builder_Helper::$general_tab_config,
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]',
- 'operator' => '==',
- 'value' => '1',
- ),
- ),
- 'title' => __( 'Disable on Blog page?', 'astra' ),
- 'description' => __( 'Blog Page is when Latest Posts are selected to be displayed on a particular page.', 'astra' ),
- 'priority' => 25,
- 'control' => 'ast-toggle-control',
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
-
- /**
- * Option: Disable Transparent Header on Your latest posts index Page
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-disable-latest-posts-index]',
- 'default' => astra_get_option( 'transparent-header-disable-latest-posts-index' ),
- 'type' => 'control',
- 'section' => $_section,
- 'context' => array(
- Astra_Builder_Helper::$general_tab_config,
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]',
- 'operator' => '==',
- 'value' => '1',
- ),
- ),
- 'title' => __( 'Disable on Latest Posts Page?', 'astra' ),
- 'description' => __( "Latest Posts page is your site's front page when the latest posts are displayed on the home page.", 'astra' ),
- 'priority' => 25,
- 'control' => 'ast-toggle-control',
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
-
- /**
- * Option: Disable Transparent Header on Pages
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-disable-page]',
- 'default' => astra_get_option( 'transparent-header-disable-page' ),
- 'type' => 'control',
- 'section' => $_section,
- 'context' => array(
- Astra_Builder_Helper::$general_tab_config,
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]',
- 'operator' => '==',
- 'value' => '1',
- ),
- ),
- 'title' => __( 'Disable on Pages?', 'astra' ),
- 'priority' => 25,
- 'control' => 'ast-toggle-control',
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
-
- /**
- * Option: Disable Transparent Header on Posts
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-disable-posts]',
- 'default' => astra_get_option( 'transparent-header-disable-posts' ),
- 'type' => 'control',
- 'section' => $_section,
- 'context' => array(
- Astra_Builder_Helper::$general_tab_config,
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]',
- 'operator' => '==',
- 'value' => '1',
- ),
- ),
- 'title' => __( 'Disable on Posts?', 'astra' ),
- 'priority' => 25,
- 'control' => 'ast-toggle-control',
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Sticky Header Display On
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-on-devices]',
- 'default' => astra_get_option( 'transparent-header-on-devices' ),
- 'type' => 'control',
- 'section' => $_section,
- 'priority' => 27,
- 'title' => __( 'Enable On', 'astra' ),
- 'control' => 'ast-selector',
- 'choices' => array(
- 'desktop' => __( 'Desktop', 'astra' ),
- 'mobile' => __( 'Mobile', 'astra' ),
- 'both' => __( 'Desktop + Mobile', 'astra' ),
- ),
- 'responsive' => false,
- 'renderAs' => 'text',
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
-
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]',
- 'default' => astra_get_option( 'different-transparent-logo', false ),
- 'type' => 'control',
- 'section' => $_section,
- 'title' => __( 'Different Logo for Transparent Header?', 'astra' ),
- 'priority' => 30,
- 'control' => 'ast-toggle-control',
- ),
-
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[different-transparent-logo-separator]',
- 'type' => 'control',
- 'section' => $_section,
- 'settings' => array(),
- 'priority' => 30,
- 'control' => 'ast-divider',
- 'context' => array(
- Astra_Builder_Helper::$general_tab_config,
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]',
- 'operator' => '==',
- 'value' => true,
- ),
- ),
- ),
-
- /**
- * Option: Transparent header logo selector
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-logo]',
- 'default' => astra_get_option( 'transparent-header-logo' ),
- 'type' => 'control',
- 'control' => 'image',
- 'sanitize_callback' => 'esc_url_raw',
- 'section' => $_section,
- 'context' => array(
- Astra_Builder_Helper::$general_tab_config,
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]',
- 'operator' => '==',
- 'value' => true,
- ),
- ),
- 'priority' => 30.1,
- 'title' => __( 'Logo', 'astra' ),
- 'library_filter' => array( 'gif', 'jpg', 'jpeg', 'png', 'ico' ),
- 'partial' => array(
- 'selector' => '.ast-replace-site-logo-transparent .site-branding .site-logo-img',
- 'container_inclusive' => false,
- ),
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Different retina logo
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[different-transparent-retina-logo]',
- 'default' => astra_get_option( 'different-transparent-retina-logo' ),
- 'type' => 'control',
- 'section' => $_section,
- 'title' => __( 'Different Logo For Retina Devices?', 'astra' ),
- 'context' => array(
- Astra_Builder_Helper::$general_tab_config,
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]',
- 'operator' => '==',
- 'value' => true,
- ),
- ),
- 'priority' => 30.2,
- 'control' => 'ast-toggle-control',
- 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-top-divider' ),
- ),
-
- /**
- * Option: Transparent header logo selector
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-retina-logo]',
- 'default' => astra_get_option( 'transparent-header-retina-logo' ),
- 'type' => 'control',
- 'control' => 'image',
- 'sanitize_callback' => 'esc_url_raw',
- 'section' => $_section,
- 'context' => array(
- Astra_Builder_Helper::$general_tab_config,
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-retina-logo]',
- 'operator' => '==',
- 'value' => true,
- ),
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]',
- 'operator' => '==',
- 'value' => true,
- ),
- ),
- 'priority' => 30.3,
- 'title' => __( 'Retina Logo', 'astra' ),
- 'library_filter' => array( 'gif', 'jpg', 'jpeg', 'png', 'ico' ),
- 'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
- ),
-
- /**
- * Option: Transparent header logo width
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-logo-width]',
- 'default' => astra_get_option( 'transparent-header-logo-width' ),
- 'type' => 'control',
- 'transport' => 'postMessage',
- 'control' => 'ast-responsive-slider',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ),
- 'section' => $_section,
- 'context' => array(
- Astra_Builder_Helper::$general_tab_config,
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]',
- 'operator' => '==',
- 'value' => true,
- ),
- ),
- 'suffix' => 'px',
- 'priority' => 30.4,
- 'title' => __( 'Logo Width', 'astra' ),
- 'input_attrs' => array(
- 'min' => 50,
- 'step' => 1,
- 'max' => 600,
- ),
- ),
-
- /**
- * Option: Bottom Border Size
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-main-sep]',
- 'default' => astra_get_option( 'transparent-header-main-sep' ),
- 'type' => 'control',
- 'transport' => 'postMessage',
- 'control' => 'ast-slider',
- 'section' => $_section,
- 'priority' => 32,
- 'title' => __( 'Bottom Border Size', 'astra' ),
- 'suffix' => 'px',
- 'input_attrs' => array(
- 'min' => 0,
- 'step' => 1,
- 'max' => 600,
- ),
- 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab,
- ),
-
- /**
- * Option: Bottom Border Color
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-main-sep-color]',
- 'default' => astra_get_option( 'transparent-header-main-sep-color' ),
- 'type' => 'control',
- 'transport' => 'postMessage',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'section' => $_section,
- 'priority' => 32,
- 'title' => __( 'Bottom Border Color', 'astra' ),
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-main-sep]',
- 'operator' => '>=',
- 'value' => 1,
- ),
- ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config,
- ),
- ),
-
- /**
- * Option: Transparent Header Styling
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[divider-sec-transparent-styling]',
- 'type' => 'control',
- 'control' => 'ast-heading',
- 'section' => $_section,
- 'title' => __( 'Colors & Background', 'astra' ),
- 'priority' => 32,
- 'settings' => array(),
- 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab,
- ),
-
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-colors]',
- 'default' => astra_get_option( 'transparent-header-colors' ),
- 'type' => 'control',
- 'control' => 'ast-color-group',
- 'title' => __( 'Site Title', 'astra' ),
- 'section' => $_section,
- 'transport' => 'postMessage',
- 'priority' => 34,
- 'context' => ( Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab,
- 'responsive' => true,
- 'divider' => array( 'ast_class' => 'ast-top-divider' ),
- ),
-
-
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-menu]',
- 'default' => astra_get_option( 'transparent-header-colors-menu' ),
- 'type' => 'control',
- 'control' => 'ast-color-group',
- 'title' => __( 'Text / Link', 'astra' ),
- 'section' => $_section,
- 'transport' => 'postMessage',
- 'priority' => 35,
- 'context' => ( Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab,
- 'responsive' => true,
- 'divider' => array(
- 'ast_class' => 'ast-top-divider',
- 'ast_title' => __( 'Menu Color', 'astra' ),
- ),
- ),
-
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-submenu]',
- 'default' => astra_get_option( 'transparent-header-colors-submenu' ),
- 'type' => 'control',
- 'control' => 'ast-color-group',
- 'title' => __( 'Text / Link', 'astra' ),
- 'section' => $_section,
- 'transport' => 'postMessage',
- 'priority' => 37,
- 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab,
- 'responsive' => true,
- 'divider' => array(
- 'ast_class' => 'ast-top-divider',
- 'ast_title' => __( 'Submenu Color', 'astra' ),
- ),
- ),
- );
-
- if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) {
- $_hfb_configs = array(
- /**
- * Option: Header Builder Tabs
- */
- array(
- 'name' => $_section . '-ast-context-tabs',
- 'section' => $_section,
- 'type' => 'control',
- 'control' => 'ast-builder-header-control',
- 'priority' => 0,
- 'description' => '',
- ),
-
- /**
- * Option: Transparent Header Builder - Social Element configs.
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-social-text-colors-content]',
- 'default' => astra_get_option( 'transparent-header-social-colors-content' ),
- 'type' => 'control',
- 'control' => 'ast-color-group',
- 'title' => __( 'Text', 'astra' ),
- 'section' => $_section,
- 'transport' => 'postMessage',
- 'priority' => 40,
- 'context' => Astra_Builder_Helper::$design_tab,
- 'responsive' => true,
- 'divider' => array(
- 'ast_class' => 'ast-top-divider',
- 'ast_title' => __( 'Social Color', 'astra' ),
- ),
- ),
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-social-background-colors-content]',
- 'default' => astra_get_option( 'transparent-header-social-colors-content' ),
- 'type' => 'control',
- 'control' => 'ast-color-group',
- 'title' => __( 'Background', 'astra' ),
- 'section' => $_section,
- 'transport' => 'postMessage',
- 'priority' => 40,
- 'context' => Astra_Builder_Helper::$design_tab,
- 'responsive' => true,
- ),
-
-
- /**
- * Option: Social Text Color
- */
- array(
- 'name' => 'transparent-header-social-icons-color',
- 'transport' => 'postMessage',
- 'default' => astra_get_option( 'transparent-header-social-icons-color' ),
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-social-text-colors-content]',
- 'section' => 'section-transparent-header',
- 'tab' => __( 'Normal', 'astra' ),
- 'control' => 'ast-responsive-color',
- 'responsive' => true,
- 'rgba' => true,
- 'priority' => 5,
- 'context' => Astra_Builder_Helper::$design_tab,
- 'title' => __( 'Normal', 'astra' ),
- ),
-
- /**
- * Option: Social Text Hover Color
- */
- array(
- 'name' => 'transparent-header-social-icons-h-color',
- 'default' => astra_get_option( 'transparent-header-social-icons-h-color' ),
- 'transport' => 'postMessage',
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-social-text-colors-content]',
- 'section' => 'section-transparent-header',
- 'tab' => __( 'Hover', 'astra' ),
- 'control' => 'ast-responsive-color',
- 'responsive' => true,
- 'rgba' => true,
- 'priority' => 7,
- 'context' => Astra_Builder_Helper::$design_tab,
- 'title' => __( 'Hover', 'astra' ),
- ),
-
- /**
- * Option: Social Background Color
- */
- array(
- 'name' => 'transparent-header-social-icons-bg-color',
- 'default' => astra_get_option( 'transparent-header-social-icons-bg-color' ),
- 'transport' => 'postMessage',
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-social-background-colors-content]',
- 'section' => 'section-transparent-header',
- 'tab' => __( 'Normal', 'astra' ),
- 'control' => 'ast-responsive-color',
- 'responsive' => true,
- 'rgba' => true,
- 'priority' => 9,
- 'context' => Astra_Builder_Helper::$design_tab,
- 'title' => __( 'Normal', 'astra' ),
- ),
-
- /**
- * Option: Social Background Hover Color
- */
- array(
- 'name' => 'transparent-header-social-icons-bg-h-color',
- 'default' => astra_get_option( 'transparent-header-social-icons-bg-h-color' ),
- 'transport' => 'postMessage',
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-social-background-colors-content]',
- 'section' => 'section-transparent-header',
- 'tab' => __( 'Hover', 'astra' ),
- 'control' => 'ast-responsive-color',
- 'responsive' => true,
- 'rgba' => true,
- 'priority' => 11,
- 'context' => Astra_Builder_Helper::$design_tab,
- 'title' => __( 'Hover', 'astra' ),
- ),
-
- /**
- * Option: Transparent Header Builder - HTML Elements configs.
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-html-colors-group]',
- 'default' => astra_get_option( 'transparent-header-html-colors-group' ),
- 'type' => 'control',
- 'control' => 'ast-color-group',
- 'title' => __( 'Link', 'astra' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 75,
- 'context' => Astra_Builder_Helper::$design_tab,
- ),
-
- // Option: HTML Text Color.
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-html-text-color]',
- 'default' => astra_get_option( 'transparent-header-html-text-color' ),
- 'type' => 'control',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 74,
- 'title' => __( 'Text', 'astra' ),
- 'context' => Astra_Builder_Helper::$design_tab,
- 'divider' => array(
- 'ast_class' => 'ast-top-divider',
- 'ast_title' => __( 'HTML Color', 'astra' ),
- ),
- ),
-
- // Option: HTML Link Color.
- array(
- 'name' => 'transparent-header-html-link-color',
- 'default' => astra_get_option( 'transparent-header-html-link-color' ),
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-html-colors-group]',
- 'type' => 'sub-control',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 5,
- 'title' => __( 'Normal', 'astra' ),
- 'context' => Astra_Builder_Helper::$general_tab,
- ),
-
- // Option: HTML Link Hover Color.
- array(
- 'name' => 'transparent-header-html-link-h-color',
- 'default' => astra_get_option( 'transparent-header-html-link-h-color' ),
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-html-colors-group]',
- 'type' => 'sub-control',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 5,
- 'title' => __( 'Hover', 'astra' ),
- 'context' => Astra_Builder_Helper::$general_tab,
- ),
-
- /**
- * Option: Transparent Header Builder - Search Elements configs.
- */
-
- // Option: Search Color.
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-search-icon-color]',
- 'default' => astra_get_option( 'transparent-header-search-icon-color' ),
- 'type' => 'control',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 45,
- 'title' => __( 'Icon', 'astra' ),
- 'context' => Astra_Builder_Helper::$design_tab,
-
- 'divider' => array(
- 'ast_class' => 'ast-top-divider',
- 'ast_title' => __( 'Search Color', 'astra' ),
- ),
- ),
-
- /**
- * Search Box Background Color
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-search-box-background-color]',
- 'default' => astra_get_option( 'transparent-header-search-box-background-color' ),
- 'type' => 'control',
- 'section' => 'section-transparent-header',
- 'priority' => 45,
- 'transport' => 'postMessage',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'title' => __( 'Box Background', 'astra' ),
- 'context' => array(
- Astra_Builder_Helper::$design_tab_config,
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[header-search-box-type]',
- 'operator' => 'in',
- 'value' => array( 'slide-search', 'search-box' ),
- ),
- ),
- ),
-
- /**
- * Option: Transparent Header Builder - Widget Elements configs.
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-widget-link-colors-group]',
- 'default' => astra_get_option( 'transparent-header-widget-colors-group' ),
- 'type' => 'control',
- 'control' => 'ast-color-group',
- 'title' => __( 'Link', 'astra' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 50,
- 'context' => Astra_Builder_Helper::$design_tab,
- ),
-
- // Option: Widget Title Color.
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-widget-title-color]',
- 'default' => astra_get_option( 'transparent-header-widget-title-color' ),
- 'type' => 'control',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 49,
- 'title' => __( 'Title', 'astra' ),
- 'context' => Astra_Builder_Helper::$design_tab,
- 'divider' => array(
- 'ast_class' => 'ast-top-divider',
- 'ast_title' => __( 'Widget Color', 'astra' ),
- ),
- ),
-
- // Option: Widget Content Color.
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-widget-content-color]',
- 'default' => astra_get_option( 'transparent-header-widget-content-color' ),
- 'type' => 'control',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 49,
- 'title' => __( 'Content', 'astra' ),
- 'context' => Astra_Builder_Helper::$design_tab,
- ),
-
- // Option: Widget Link Color.
- array(
- 'name' => 'transparent-header-widget-link-color',
- 'default' => astra_get_option( 'transparent-header-widget-link-color' ),
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-widget-link-colors-group]',
- 'type' => 'sub-control',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 15,
- 'tab' => __( 'Normal', 'astra' ),
- 'title' => __( 'Normal', 'astra' ),
- 'context' => Astra_Builder_Helper::$general_tab,
- ),
-
- // Option: Widget Link Hover Color.
- array(
- 'name' => 'transparent-header-widget-link-h-color',
- 'default' => astra_get_option( 'transparent-header-widget-link-h-color' ),
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-widget-link-colors-group]',
- 'type' => 'sub-control',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'tab' => __( 'Hover', 'astra' ),
- 'priority' => 20,
- 'title' => __( 'Hover', 'astra' ),
- 'context' => Astra_Builder_Helper::$general_tab,
- ),
-
- /**
- * Group: Transparent Header Button Colors Group
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-buttons-text-group]',
- 'default' => astra_get_option( 'transparent-header-buttons-group' ),
- 'type' => 'control',
- 'control' => 'ast-color-group',
- 'title' => __( 'Text', 'astra' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 60,
- 'context' => Astra_Builder_Helper::$design_tab,
- 'divider' => array(
- 'ast_class' => 'ast-top-divider',
- 'ast_title' => __( 'HTML Color', 'astra' ),
- ),
- ),
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-buttons-background-group]',
- 'default' => astra_get_option( 'transparent-header-buttons-group' ),
- 'type' => 'control',
- 'control' => 'ast-color-group',
- 'title' => __( 'Background', 'astra' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 60,
- 'context' => Astra_Builder_Helper::$design_tab,
- ),
-
- /**
- * Option: Button Text Color
- */
- array(
- 'name' => 'transparent-header-button-text-color',
- 'transport' => 'postMessage',
- 'default' => astra_get_option( 'transparent-header-button-text-color' ),
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-buttons-text-group]',
- 'section' => 'section-transparent-header',
- 'tab' => __( 'Normal', 'astra' ),
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'priority' => 5,
- 'title' => __( 'Normal', 'astra' ),
- ),
-
- /**
- * Option: Button Text Hover Color
- */
- array(
- 'name' => 'transparent-header-button-text-h-color',
- 'default' => astra_get_option( 'transparent-header-button-text-h-color' ),
- 'transport' => 'postMessage',
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-buttons-text-group]',
- 'section' => 'section-transparent-header',
- 'tab' => __( 'Hover', 'astra' ),
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'priority' => 7,
- 'title' => __( 'Hover', 'astra' ),
- ),
-
- /**
- * Option: Button Background Color
- */
- array(
- 'name' => 'transparent-header-button-bg-color',
- 'default' => astra_get_option( 'transparent-header-button-bg-color' ),
- 'transport' => 'postMessage',
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-buttons-background-group]',
- 'section' => 'section-transparent-header',
- 'tab' => __( 'Normal', 'astra' ),
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'priority' => 9,
- 'title' => __( 'Normal', 'astra' ),
- ),
-
- /**
- * Option: Button Button Hover Color
- */
- array(
- 'name' => 'transparent-header-button-bg-h-color',
- 'default' => astra_get_option( 'transparent-header-button-bg-h-color' ),
- 'transport' => 'postMessage',
- 'type' => 'sub-control',
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-buttons-background-group]',
- 'section' => 'section-transparent-header',
- 'tab' => __( 'Hover', 'astra' ),
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'priority' => 11,
- 'title' => __( 'Hover', 'astra' ),
- ),
-
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-account-icon-color]',
- 'default' => astra_get_option( 'transparent-account-icon-color' ),
- 'type' => 'control',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 65,
- 'title' => __( 'Icon', 'astra' ),
- 'divider' => array(
- 'ast_class' => 'ast-top-divider',
- 'ast_title' => __( 'Account', 'astra' ),
- ),
- 'context' => array(
- Astra_Builder_Helper::$design_tab_config,
- array(
- 'relation' => 'OR',
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[header-account-login-style]',
- 'operator' => '==',
- 'value' => 'icon',
- ),
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[header-account-login-style]',
- 'operator' => '==',
- 'value' => 'text',
- ),
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[header-account-logout-style]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- ),
- ),
- ),
-
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-account-type-text-color]',
- 'default' => astra_get_option( 'transparent-account-type-text-color' ),
- 'type' => 'control',
- 'section' => $_section,
- 'priority' => 65,
- 'transport' => 'postMessage',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'title' => __( 'Text', 'astra' ),
- 'context' => array(
- Astra_Builder_Helper::$design_tab_config,
- array(
- 'relation' => 'OR',
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[header-account-login-style]',
- 'operator' => '==',
- 'value' => 'icon',
- ),
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[header-account-login-style]',
- 'operator' => '==',
- 'value' => 'text',
- ),
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[header-account-logout-style]',
- 'operator' => '!=',
- 'value' => 'none',
- ),
- ),
- ),
- ),
-
- /**
- * Option: Toggle Button Color
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-toggle-btn-color]',
- 'default' => astra_get_option( 'transparent-header-toggle-btn-color' ),
- 'type' => 'control',
- 'control' => 'ast-color',
- 'title' => __( 'Icon', 'astra' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 70,
- 'context' => Astra_Builder_Helper::$design_tab,
- 'divider' => array(
- 'ast_class' => 'ast-top-divider',
- 'ast_title' => __( 'Toggle Color', 'astra' ),
- ),
- ),
-
- /**
- * Option: Toggle Button Bg Color
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-toggle-btn-bg-color]',
- 'default' => astra_get_option( 'transparent-header-toggle-btn-bg-color' ),
- 'type' => 'control',
- 'control' => 'ast-color',
- 'title' => __( 'Background', 'astra' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 70,
- 'context' => Astra_Builder_Helper::$design_tab,
- ),
-
- /**
- * Option: Toggle Button Border Color
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-toggle-border-color]',
- 'default' => astra_get_option( 'transparent-header-toggle-border-color' ),
- 'type' => 'control',
- 'control' => 'ast-color',
- 'title' => __( 'Border', 'astra' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 70,
- 'context' => Astra_Builder_Helper::$design_tab,
- ),
- );
-
- $_configs = array_merge( $_configs, $_hfb_configs );
-
- } else {
- $_old_content_configs = array(
-
- /**
- * Option: Content Section Text color.
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-content-section-text-color-responsive]',
- 'default' => astra_get_option( 'transparent-content-section-text-color-responsive' ),
- 'type' => 'control',
- 'priority' => 39,
- 'section' => $_section,
- 'transport' => 'postMessage',
- 'control' => 'ast-responsive-color',
- 'title' => __( 'Text', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- 'divider' => array(
- 'ast_class' => 'ast-top-divider',
- 'ast_title' => __( 'Content', 'astra' ),
- ),
- ),
- /**
- * Option: Header Builder Tabs
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-content]',
- 'default' => astra_get_option( 'transparent-header-colors-content' ),
- 'type' => 'control',
- 'control' => 'ast-color-group',
- 'title' => __( 'Link', 'astra' ),
- 'section' => $_section,
- 'transport' => 'postMessage',
- 'priority' => 39,
- 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab,
- 'responsive' => true,
- ),
- );
-
- $_configs = array_merge( $_configs, $_old_content_configs );
- }
-
- if ( defined( 'ASTRA_EXT_VER' ) && ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ) {
-
- $pro_elements_transparent_config = array(
-
- /**
- * Search Box Background Color
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-search-box-placeholder-color]',
- 'default' => astra_get_option( 'transparent-header-search-box-placeholder-color' ),
- 'type' => 'control',
- 'section' => 'section-transparent-header',
- 'priority' => 45,
- 'transport' => 'postMessage',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'title' => __( 'Text / Placeholder', 'astra' ),
- 'context' => array(
- Astra_Builder_Helper::$design_tab_config,
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[header-search-box-type]',
- 'operator' => 'in',
- 'value' => array( 'slide-search', 'search-box' ),
- ),
- ),
- ),
-
- /**
- * Option: Transparent Header Builder - Divider Elements configs.
- */
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-divider-color]',
- 'default' => astra_get_option( 'transparent-header-divider-color' ),
- 'type' => 'control',
- 'control' => 'ast-color',
- 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
- 'transport' => 'postMessage',
- 'priority' => 64,
- 'title' => __( 'Divider', 'astra' ),
- 'section' => 'section-transparent-header',
- 'context' => Astra_Builder_Helper::$design_tab,
- 'divider' => array( 'ast_class' => 'ast-top-divider' ),
- ),
-
- array(
- 'name' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]',
- 'default' => astra_get_option( 'transparent-account-menu-colors' ),
- 'type' => 'control',
- 'control' => 'ast-settings-group',
- 'title' => __( 'Account Menu Color', 'astra' ),
- 'section' => 'section-transparent-header',
- 'transport' => 'postMessage',
- 'priority' => 66,
- 'context' => array(
- Astra_Builder_Helper::$design_tab_config,
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[header-account-action-type]',
- 'operator' => '==',
- 'value' => 'menu',
- ),
- ),
- ),
-
- // Option: Menu Color.
- array(
- 'name' => 'transparent-account-menu-color-responsive',
- 'default' => astra_get_option( 'transparent-account-menu-color-responsive' ),
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]',
- 'type' => 'sub-control',
- 'control' => 'ast-responsive-color',
- 'transport' => 'postMessage',
- 'tab' => __( 'Normal', 'astra' ),
- 'section' => 'section-transparent-header',
- 'title' => __( 'Link / Text Color', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- 'priority' => 7,
- 'context' => array(
- array(
- 'setting' => ASTRA_THEME_SETTINGS . '[header-account-action-type]',
- 'operator' => '==',
- 'value' => 'menu',
- ),
- Astra_Builder_Helper::$design_tab,
- ),
- ),
-
- // Option: Background Color.
- array(
- 'name' => 'transparent-account-menu-bg-obj-responsive',
- 'default' => astra_get_option( 'transparent-account-menu-bg-obj-responsive' ),
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]',
- 'type' => 'sub-control',
- 'control' => 'ast-responsive-color',
- 'transport' => 'postMessage',
- 'section' => 'section-transparent-header',
- 'title' => __( 'Background Color', 'astra' ),
- 'tab' => __( 'Normal', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- 'priority' => 8,
- 'context' => Astra_Builder_Helper::$design_tab,
- ),
-
- // Option: Menu Hover Color.
- array(
- 'name' => 'transparent-account-menu-h-color-responsive',
- 'default' => astra_get_option( 'transparent-account-menu-h-color-responsive' ),
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]',
- 'tab' => __( 'Hover', 'astra' ),
- 'type' => 'sub-control',
- 'control' => 'ast-responsive-color',
- 'transport' => 'postMessage',
- 'title' => __( 'Link Color', 'astra' ),
- 'section' => 'section-transparent-header',
- 'responsive' => true,
- 'rgba' => true,
- 'priority' => 19,
- 'context' => Astra_Builder_Helper::$design_tab,
- ),
-
- // Option: Menu Hover Background Color.
- array(
- 'name' => 'transparent-account-menu-h-bg-color-responsive',
- 'default' => astra_get_option( 'transparent-account-menu-h-bg-color-responsive' ),
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]',
- 'type' => 'sub-control',
- 'title' => __( 'Background Color', 'astra' ),
- 'section' => 'section-transparent-header',
- 'control' => 'ast-responsive-color',
- 'transport' => 'postMessage',
- 'tab' => __( 'Hover', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- 'priority' => 21,
- 'context' => Astra_Builder_Helper::$design_tab,
- ),
-
- // Option: Active Menu Color.
- array(
- 'name' => 'transparent-account-menu-a-color-responsive',
- 'default' => astra_get_option( 'transparent-account-menu-a-color-responsive' ),
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]',
- 'type' => 'sub-control',
- 'section' => 'section-transparent-header',
- 'control' => 'ast-responsive-color',
- 'transport' => 'postMessage',
- 'tab' => __( 'Active', 'astra' ),
- 'title' => __( 'Link Color', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- 'priority' => 31,
- 'context' => Astra_Builder_Helper::$design_tab,
- ),
-
- // Option: Active Menu Background Color.
- array(
- 'name' => 'transparent-account-menu-a-bg-color-responsive',
- 'default' => astra_get_option( 'transparent-account-menu-a-bg-color-responsive' ),
- 'parent' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]',
- 'type' => 'sub-control',
- 'control' => 'ast-responsive-color',
- 'transport' => 'postMessage',
- 'section' => 'section-transparent-header',
- 'title' => __( 'Background Color', 'astra' ),
- 'tab' => __( 'Active', 'astra' ),
- 'responsive' => true,
- 'rgba' => true,
- 'priority' => 33,
- 'context' => Astra_Builder_Helper::$design_tab,
- ),
- );
-
- $_configs = array_merge( $_configs, $pro_elements_transparent_config );
- }
-
- return array_merge( $configurations, $_configs );
- }
- }
-}
-
-/**
- * Kicking this off by calling 'get_instance()' method
- */
-new Astra_Customizer_Transparent_Header_Configs();
+<?php +/** + * Transparent Header Options for our theme. + * + * @package Astra Addon + * @author Brainstorm Force + * @copyright Copyright (c) 2020, Brainstorm Force + * @link https://www.brainstormforce.com + * @since Astra 1.4.3 + */ + +// Block direct access to the file. +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +// Bail if Customizer config base class does not exist. +if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { + return; +} + +/** + * Customizer Sanitizes + * + * @since 1.4.3 + */ +if ( ! class_exists( 'Astra_Customizer_Transparent_Header_Configs' ) ) { + + /** + * Register Transparent Header Customizer Configurations. + */ + class Astra_Customizer_Transparent_Header_Configs extends Astra_Customizer_Config_Base { + + /** + * Register Transparent Header Customizer Configurations. + * + * @param Array $configurations Astra Customizer Configurations. + * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. + * @since 1.4.3 + * @return Array Astra Customizer Configurations with updated configurations. + */ + public function register_configuration( $configurations, $wp_customize ) { + + $_section = 'section-transparent-header'; + + $_configs = array( + + /** + * Option: Enable Transparent Header + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]', + 'default' => astra_get_option( 'transparent-header-enable' ), + 'type' => 'control', + 'section' => $_section, + 'title' => __( 'Enable on Complete Website', 'astra' ), + 'priority' => 20, + 'control' => 'ast-toggle-control', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Disable Transparent Header on Archive Pages + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-disable-archive]', + 'default' => astra_get_option( 'transparent-header-disable-archive' ), + 'type' => 'control', + 'section' => $_section, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]', + 'operator' => '==', + 'value' => '1', + ), + ), + 'title' => __( 'Disable on 404, Search & Archives?', 'astra' ), + 'description' => __( 'This setting is generally not recommended on special pages such as archive, search, 404, etc. If you would like to enable it, uncheck this option', 'astra' ), + 'priority' => 25, + 'control' => 'ast-toggle-control', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Disable Transparent Header on Archive Pages + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-disable-index]', + 'default' => astra_get_option( 'transparent-header-disable-index' ), + 'type' => 'control', + 'section' => $_section, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]', + 'operator' => '==', + 'value' => '1', + ), + ), + 'title' => __( 'Disable on Blog page?', 'astra' ), + 'description' => __( 'Blog Page is when Latest Posts are selected to be displayed on a particular page.', 'astra' ), + 'priority' => 25, + 'control' => 'ast-toggle-control', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + + /** + * Option: Disable Transparent Header on Your latest posts index Page + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-disable-latest-posts-index]', + 'default' => astra_get_option( 'transparent-header-disable-latest-posts-index' ), + 'type' => 'control', + 'section' => $_section, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]', + 'operator' => '==', + 'value' => '1', + ), + ), + 'title' => __( 'Disable on Latest Posts Page?', 'astra' ), + 'description' => __( "Latest Posts page is your site's front page when the latest posts are displayed on the home page.", 'astra' ), + 'priority' => 25, + 'control' => 'ast-toggle-control', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + + /** + * Option: Disable Transparent Header on Pages + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-disable-page]', + 'default' => astra_get_option( 'transparent-header-disable-page' ), + 'type' => 'control', + 'section' => $_section, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]', + 'operator' => '==', + 'value' => '1', + ), + ), + 'title' => __( 'Disable on Pages?', 'astra' ), + 'priority' => 25, + 'control' => 'ast-toggle-control', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + + /** + * Option: Disable Transparent Header on Posts + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-disable-posts]', + 'default' => astra_get_option( 'transparent-header-disable-posts' ), + 'type' => 'control', + 'section' => $_section, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-enable]', + 'operator' => '==', + 'value' => '1', + ), + ), + 'title' => __( 'Disable on Posts?', 'astra' ), + 'priority' => 25, + 'control' => 'ast-toggle-control', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Sticky Header Display On + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-on-devices]', + 'default' => astra_get_option( 'transparent-header-on-devices' ), + 'type' => 'control', + 'section' => $_section, + 'priority' => 27, + 'title' => __( 'Enable On', 'astra' ), + 'control' => 'ast-selector', + 'choices' => array( + 'desktop' => __( 'Desktop', 'astra' ), + 'mobile' => __( 'Mobile', 'astra' ), + 'both' => __( 'Desktop + Mobile', 'astra' ), + ), + 'responsive' => false, + 'renderAs' => 'text', + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + + array( + 'name' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]', + 'default' => astra_get_option( 'different-transparent-logo', false ), + 'type' => 'control', + 'section' => $_section, + 'title' => __( 'Different Logo for Transparent Header?', 'astra' ), + 'priority' => 30, + 'control' => 'ast-toggle-control', + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[different-transparent-logo-separator]', + 'type' => 'control', + 'section' => $_section, + 'settings' => array(), + 'priority' => 30, + 'control' => 'ast-divider', + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]', + 'operator' => '==', + 'value' => true, + ), + ), + ), + + /** + * Option: Transparent header logo selector + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-logo]', + 'default' => astra_get_option( 'transparent-header-logo' ), + 'type' => 'control', + 'control' => 'image', + 'sanitize_callback' => 'esc_url_raw', + 'section' => $_section, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]', + 'operator' => '==', + 'value' => true, + ), + ), + 'priority' => 30.1, + 'title' => __( 'Logo', 'astra' ), + 'library_filter' => array( 'gif', 'jpg', 'jpeg', 'png', 'ico' ), + 'partial' => array( + 'selector' => '.ast-replace-site-logo-transparent .site-branding .site-logo-img', + 'container_inclusive' => false, + ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Different retina logo + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[different-transparent-retina-logo]', + 'default' => astra_get_option( 'different-transparent-retina-logo' ), + 'type' => 'control', + 'section' => $_section, + 'title' => __( 'Different Logo For Retina Devices?', 'astra' ), + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]', + 'operator' => '==', + 'value' => true, + ), + ), + 'priority' => 30.2, + 'control' => 'ast-toggle-control', + 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-top-divider' ), + ), + + /** + * Option: Transparent header logo selector + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-retina-logo]', + 'default' => astra_get_option( 'transparent-header-retina-logo' ), + 'type' => 'control', + 'control' => 'image', + 'sanitize_callback' => 'esc_url_raw', + 'section' => $_section, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-retina-logo]', + 'operator' => '==', + 'value' => true, + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]', + 'operator' => '==', + 'value' => true, + ), + ), + 'priority' => 30.3, + 'title' => __( 'Retina Logo', 'astra' ), + 'library_filter' => array( 'gif', 'jpg', 'jpeg', 'png', 'ico' ), + 'divider' => array( 'ast_class' => 'ast-bottom-divider' ), + ), + + /** + * Option: Transparent header logo width + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-logo-width]', + 'default' => astra_get_option( 'transparent-header-logo-width' ), + 'type' => 'control', + 'transport' => 'postMessage', + 'control' => 'ast-responsive-slider', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), + 'section' => $_section, + 'context' => array( + Astra_Builder_Helper::$general_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[different-transparent-logo]', + 'operator' => '==', + 'value' => true, + ), + ), + 'suffix' => 'px', + 'priority' => 30.4, + 'title' => __( 'Logo Width', 'astra' ), + 'input_attrs' => array( + 'min' => 50, + 'step' => 1, + 'max' => 600, + ), + ), + + /** + * Option: Bottom Border Size + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-main-sep]', + 'default' => astra_get_option( 'transparent-header-main-sep' ), + 'type' => 'control', + 'transport' => 'postMessage', + 'control' => 'ast-slider', + 'section' => $_section, + 'priority' => 32, + 'title' => __( 'Bottom Border Size', 'astra' ), + 'suffix' => 'px', + 'input_attrs' => array( + 'min' => 0, + 'step' => 1, + 'max' => 600, + ), + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + ), + + /** + * Option: Bottom Border Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-main-sep-color]', + 'default' => astra_get_option( 'transparent-header-main-sep-color' ), + 'type' => 'control', + 'transport' => 'postMessage', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'section' => $_section, + 'priority' => 32, + 'title' => __( 'Bottom Border Color', 'astra' ), + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[transparent-header-main-sep]', + 'operator' => '>=', + 'value' => 1, + ), + ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab_config : Astra_Builder_Helper::$general_tab_config, + ), + ), + + /** + * Option: Transparent Header Styling + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[divider-sec-transparent-styling]', + 'type' => 'control', + 'control' => 'ast-heading', + 'section' => $_section, + 'title' => __( 'Colors & Background', 'astra' ), + 'priority' => 32, + 'settings' => array(), + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-colors]', + 'default' => astra_get_option( 'transparent-header-colors' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Site Title', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => 34, + 'context' => ( Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + 'responsive' => true, + 'divider' => array( 'ast_class' => 'ast-top-divider' ), + ), + + + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-menu]', + 'default' => astra_get_option( 'transparent-header-colors-menu' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Text / Link', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => 35, + 'context' => ( Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + 'responsive' => true, + 'divider' => array( + 'ast_class' => 'ast-top-divider', + 'ast_title' => __( 'Menu Color', 'astra' ), + ), + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-submenu]', + 'default' => astra_get_option( 'transparent-header-colors-submenu' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Text / Link', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => 37, + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + 'responsive' => true, + 'divider' => array( + 'ast_class' => 'ast-top-divider', + 'ast_title' => __( 'Submenu Color', 'astra' ), + ), + ), + ); + + if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { + $_hfb_configs = array( + /** + * Option: Header Builder Tabs + */ + array( + 'name' => $_section . '-ast-context-tabs', + 'section' => $_section, + 'type' => 'control', + 'control' => 'ast-builder-header-control', + 'priority' => 0, + 'description' => '', + ), + + /** + * Option: Transparent Header Builder - Social Element configs. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-social-text-colors-content]', + 'default' => astra_get_option( 'transparent-header-social-colors-content' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Text', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => 40, + 'context' => Astra_Builder_Helper::$design_tab, + 'responsive' => true, + 'divider' => array( + 'ast_class' => 'ast-top-divider', + 'ast_title' => __( 'Social Color', 'astra' ), + ), + ), + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-social-background-colors-content]', + 'default' => astra_get_option( 'transparent-header-social-colors-content' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Background', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => 40, + 'context' => Astra_Builder_Helper::$design_tab, + 'responsive' => true, + ), + + + /** + * Option: Social Text Color + */ + array( + 'name' => 'transparent-header-social-icons-color', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'transparent-header-social-icons-color' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-social-text-colors-content]', + 'section' => 'section-transparent-header', + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 5, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Normal', 'astra' ), + ), + + /** + * Option: Social Text Hover Color + */ + array( + 'name' => 'transparent-header-social-icons-h-color', + 'default' => astra_get_option( 'transparent-header-social-icons-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-social-text-colors-content]', + 'section' => 'section-transparent-header', + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 7, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Hover', 'astra' ), + ), + + /** + * Option: Social Background Color + */ + array( + 'name' => 'transparent-header-social-icons-bg-color', + 'default' => astra_get_option( 'transparent-header-social-icons-bg-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-social-background-colors-content]', + 'section' => 'section-transparent-header', + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 9, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Normal', 'astra' ), + ), + + /** + * Option: Social Background Hover Color + */ + array( + 'name' => 'transparent-header-social-icons-bg-h-color', + 'default' => astra_get_option( 'transparent-header-social-icons-bg-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-social-background-colors-content]', + 'section' => 'section-transparent-header', + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-responsive-color', + 'responsive' => true, + 'rgba' => true, + 'priority' => 11, + 'context' => Astra_Builder_Helper::$design_tab, + 'title' => __( 'Hover', 'astra' ), + ), + + /** + * Option: Transparent Header Builder - HTML Elements configs. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-html-colors-group]', + 'default' => astra_get_option( 'transparent-header-html-colors-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Link', 'astra' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 75, + 'context' => Astra_Builder_Helper::$design_tab, + ), + + // Option: HTML Text Color. + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-html-text-color]', + 'default' => astra_get_option( 'transparent-header-html-text-color' ), + 'type' => 'control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 74, + 'title' => __( 'Text', 'astra' ), + 'context' => Astra_Builder_Helper::$design_tab, + 'divider' => array( + 'ast_class' => 'ast-top-divider', + 'ast_title' => __( 'HTML Color', 'astra' ), + ), + ), + + // Option: HTML Link Color. + array( + 'name' => 'transparent-header-html-link-color', + 'default' => astra_get_option( 'transparent-header-html-link-color' ), + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-html-colors-group]', + 'type' => 'sub-control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 5, + 'title' => __( 'Normal', 'astra' ), + 'context' => Astra_Builder_Helper::$general_tab, + ), + + // Option: HTML Link Hover Color. + array( + 'name' => 'transparent-header-html-link-h-color', + 'default' => astra_get_option( 'transparent-header-html-link-h-color' ), + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-html-colors-group]', + 'type' => 'sub-control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 5, + 'title' => __( 'Hover', 'astra' ), + 'context' => Astra_Builder_Helper::$general_tab, + ), + + /** + * Option: Transparent Header Builder - Search Elements configs. + */ + + // Option: Search Color. + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-search-icon-color]', + 'default' => astra_get_option( 'transparent-header-search-icon-color' ), + 'type' => 'control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 45, + 'title' => __( 'Icon', 'astra' ), + 'context' => Astra_Builder_Helper::$design_tab, + + 'divider' => array( + 'ast_class' => 'ast-top-divider', + 'ast_title' => __( 'Search Color', 'astra' ), + ), + ), + + /** + * Search Box Background Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-search-box-background-color]', + 'default' => astra_get_option( 'transparent-header-search-box-background-color' ), + 'type' => 'control', + 'section' => 'section-transparent-header', + 'priority' => 45, + 'transport' => 'postMessage', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'title' => __( 'Box Background', 'astra' ), + 'context' => array( + Astra_Builder_Helper::$design_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-search-box-type]', + 'operator' => 'in', + 'value' => array( 'slide-search', 'search-box' ), + ), + ), + ), + + /** + * Option: Transparent Header Builder - Widget Elements configs. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-widget-link-colors-group]', + 'default' => astra_get_option( 'transparent-header-widget-colors-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Link', 'astra' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 50, + 'context' => Astra_Builder_Helper::$design_tab, + ), + + // Option: Widget Title Color. + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-widget-title-color]', + 'default' => astra_get_option( 'transparent-header-widget-title-color' ), + 'type' => 'control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 49, + 'title' => __( 'Title', 'astra' ), + 'context' => Astra_Builder_Helper::$design_tab, + 'divider' => array( + 'ast_class' => 'ast-top-divider', + 'ast_title' => __( 'Widget Color', 'astra' ), + ), + ), + + // Option: Widget Content Color. + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-widget-content-color]', + 'default' => astra_get_option( 'transparent-header-widget-content-color' ), + 'type' => 'control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 49, + 'title' => __( 'Content', 'astra' ), + 'context' => Astra_Builder_Helper::$design_tab, + ), + + // Option: Widget Link Color. + array( + 'name' => 'transparent-header-widget-link-color', + 'default' => astra_get_option( 'transparent-header-widget-link-color' ), + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-widget-link-colors-group]', + 'type' => 'sub-control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 15, + 'tab' => __( 'Normal', 'astra' ), + 'title' => __( 'Normal', 'astra' ), + 'context' => Astra_Builder_Helper::$general_tab, + ), + + // Option: Widget Link Hover Color. + array( + 'name' => 'transparent-header-widget-link-h-color', + 'default' => astra_get_option( 'transparent-header-widget-link-h-color' ), + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-widget-link-colors-group]', + 'type' => 'sub-control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'tab' => __( 'Hover', 'astra' ), + 'priority' => 20, + 'title' => __( 'Hover', 'astra' ), + 'context' => Astra_Builder_Helper::$general_tab, + ), + + /** + * Group: Transparent Header Button Colors Group + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-buttons-text-group]', + 'default' => astra_get_option( 'transparent-header-buttons-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Text', 'astra' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 60, + 'context' => Astra_Builder_Helper::$design_tab, + 'divider' => array( + 'ast_class' => 'ast-top-divider', + 'ast_title' => __( 'HTML Color', 'astra' ), + ), + ), + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-buttons-background-group]', + 'default' => astra_get_option( 'transparent-header-buttons-group' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Background', 'astra' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 60, + 'context' => Astra_Builder_Helper::$design_tab, + ), + + /** + * Option: Button Text Color + */ + array( + 'name' => 'transparent-header-button-text-color', + 'transport' => 'postMessage', + 'default' => astra_get_option( 'transparent-header-button-text-color' ), + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-buttons-text-group]', + 'section' => 'section-transparent-header', + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 5, + 'title' => __( 'Normal', 'astra' ), + ), + + /** + * Option: Button Text Hover Color + */ + array( + 'name' => 'transparent-header-button-text-h-color', + 'default' => astra_get_option( 'transparent-header-button-text-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-buttons-text-group]', + 'section' => 'section-transparent-header', + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 7, + 'title' => __( 'Hover', 'astra' ), + ), + + /** + * Option: Button Background Color + */ + array( + 'name' => 'transparent-header-button-bg-color', + 'default' => astra_get_option( 'transparent-header-button-bg-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-buttons-background-group]', + 'section' => 'section-transparent-header', + 'tab' => __( 'Normal', 'astra' ), + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 9, + 'title' => __( 'Normal', 'astra' ), + ), + + /** + * Option: Button Button Hover Color + */ + array( + 'name' => 'transparent-header-button-bg-h-color', + 'default' => astra_get_option( 'transparent-header-button-bg-h-color' ), + 'transport' => 'postMessage', + 'type' => 'sub-control', + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-header-buttons-background-group]', + 'section' => 'section-transparent-header', + 'tab' => __( 'Hover', 'astra' ), + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'priority' => 11, + 'title' => __( 'Hover', 'astra' ), + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-account-icon-color]', + 'default' => astra_get_option( 'transparent-account-icon-color' ), + 'type' => 'control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 65, + 'title' => __( 'Icon', 'astra' ), + 'divider' => array( + 'ast_class' => 'ast-top-divider', + 'ast_title' => __( 'Account', 'astra' ), + ), + 'context' => array( + Astra_Builder_Helper::$design_tab_config, + array( + 'relation' => 'OR', + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-account-login-style]', + 'operator' => '==', + 'value' => 'icon', + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-account-login-style]', + 'operator' => '==', + 'value' => 'text', + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-account-logout-style]', + 'operator' => '!=', + 'value' => 'none', + ), + ), + ), + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-account-type-text-color]', + 'default' => astra_get_option( 'transparent-account-type-text-color' ), + 'type' => 'control', + 'section' => $_section, + 'priority' => 65, + 'transport' => 'postMessage', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'title' => __( 'Text', 'astra' ), + 'context' => array( + Astra_Builder_Helper::$design_tab_config, + array( + 'relation' => 'OR', + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-account-login-style]', + 'operator' => '==', + 'value' => 'icon', + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-account-login-style]', + 'operator' => '==', + 'value' => 'text', + ), + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-account-logout-style]', + 'operator' => '!=', + 'value' => 'none', + ), + ), + ), + ), + + /** + * Option: Toggle Button Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-toggle-btn-color]', + 'default' => astra_get_option( 'transparent-header-toggle-btn-color' ), + 'type' => 'control', + 'control' => 'ast-color', + 'title' => __( 'Icon', 'astra' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 70, + 'context' => Astra_Builder_Helper::$design_tab, + 'divider' => array( + 'ast_class' => 'ast-top-divider', + 'ast_title' => __( 'Toggle Color', 'astra' ), + ), + ), + + /** + * Option: Toggle Button Bg Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-toggle-btn-bg-color]', + 'default' => astra_get_option( 'transparent-header-toggle-btn-bg-color' ), + 'type' => 'control', + 'control' => 'ast-color', + 'title' => __( 'Background', 'astra' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 70, + 'context' => Astra_Builder_Helper::$design_tab, + ), + + /** + * Option: Toggle Button Border Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-toggle-border-color]', + 'default' => astra_get_option( 'transparent-header-toggle-border-color' ), + 'type' => 'control', + 'control' => 'ast-color', + 'title' => __( 'Border', 'astra' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 70, + 'context' => Astra_Builder_Helper::$design_tab, + ), + ); + + $_configs = array_merge( $_configs, $_hfb_configs ); + + } else { + $_old_content_configs = array( + + /** + * Option: Content Section Text color. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-content-section-text-color-responsive]', + 'default' => astra_get_option( 'transparent-content-section-text-color-responsive' ), + 'type' => 'control', + 'priority' => 39, + 'section' => $_section, + 'transport' => 'postMessage', + 'control' => 'ast-responsive-color', + 'title' => __( 'Text', 'astra' ), + 'responsive' => true, + 'rgba' => true, + 'divider' => array( + 'ast_class' => 'ast-top-divider', + 'ast_title' => __( 'Content', 'astra' ), + ), + ), + /** + * Option: Header Builder Tabs + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-colors-content]', + 'default' => astra_get_option( 'transparent-header-colors-content' ), + 'type' => 'control', + 'control' => 'ast-color-group', + 'title' => __( 'Link', 'astra' ), + 'section' => $_section, + 'transport' => 'postMessage', + 'priority' => 39, + 'context' => ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ? Astra_Builder_Helper::$design_tab : Astra_Builder_Helper::$general_tab, + 'responsive' => true, + ), + ); + + $_configs = array_merge( $_configs, $_old_content_configs ); + } + + if ( defined( 'ASTRA_EXT_VER' ) && ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) ) { + + $pro_elements_transparent_config = array( + + /** + * Search Box Background Color + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-search-box-placeholder-color]', + 'default' => astra_get_option( 'transparent-header-search-box-placeholder-color' ), + 'type' => 'control', + 'section' => 'section-transparent-header', + 'priority' => 45, + 'transport' => 'postMessage', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'title' => __( 'Text / Placeholder', 'astra' ), + 'context' => array( + Astra_Builder_Helper::$design_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-search-box-type]', + 'operator' => 'in', + 'value' => array( 'slide-search', 'search-box' ), + ), + ), + ), + + /** + * Option: Transparent Header Builder - Divider Elements configs. + */ + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-header-divider-color]', + 'default' => astra_get_option( 'transparent-header-divider-color' ), + 'type' => 'control', + 'control' => 'ast-color', + 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ), + 'transport' => 'postMessage', + 'priority' => 64, + 'title' => __( 'Divider', 'astra' ), + 'section' => 'section-transparent-header', + 'context' => Astra_Builder_Helper::$design_tab, + 'divider' => array( 'ast_class' => 'ast-top-divider' ), + ), + + array( + 'name' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]', + 'default' => astra_get_option( 'transparent-account-menu-colors' ), + 'type' => 'control', + 'control' => 'ast-settings-group', + 'title' => __( 'Account Menu Color', 'astra' ), + 'section' => 'section-transparent-header', + 'transport' => 'postMessage', + 'priority' => 66, + 'context' => array( + Astra_Builder_Helper::$design_tab_config, + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-account-action-type]', + 'operator' => '==', + 'value' => 'menu', + ), + ), + ), + + // Option: Menu Color. + array( + 'name' => 'transparent-account-menu-color-responsive', + 'default' => astra_get_option( 'transparent-account-menu-color-responsive' ), + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]', + 'type' => 'sub-control', + 'control' => 'ast-responsive-color', + 'transport' => 'postMessage', + 'tab' => __( 'Normal', 'astra' ), + 'section' => 'section-transparent-header', + 'title' => __( 'Link / Text Color', 'astra' ), + 'responsive' => true, + 'rgba' => true, + 'priority' => 7, + 'context' => array( + array( + 'setting' => ASTRA_THEME_SETTINGS . '[header-account-action-type]', + 'operator' => '==', + 'value' => 'menu', + ), + Astra_Builder_Helper::$design_tab, + ), + ), + + // Option: Background Color. + array( + 'name' => 'transparent-account-menu-bg-obj-responsive', + 'default' => astra_get_option( 'transparent-account-menu-bg-obj-responsive' ), + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]', + 'type' => 'sub-control', + 'control' => 'ast-responsive-color', + 'transport' => 'postMessage', + 'section' => 'section-transparent-header', + 'title' => __( 'Background Color', 'astra' ), + 'tab' => __( 'Normal', 'astra' ), + 'responsive' => true, + 'rgba' => true, + 'priority' => 8, + 'context' => Astra_Builder_Helper::$design_tab, + ), + + // Option: Menu Hover Color. + array( + 'name' => 'transparent-account-menu-h-color-responsive', + 'default' => astra_get_option( 'transparent-account-menu-h-color-responsive' ), + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]', + 'tab' => __( 'Hover', 'astra' ), + 'type' => 'sub-control', + 'control' => 'ast-responsive-color', + 'transport' => 'postMessage', + 'title' => __( 'Link Color', 'astra' ), + 'section' => 'section-transparent-header', + 'responsive' => true, + 'rgba' => true, + 'priority' => 19, + 'context' => Astra_Builder_Helper::$design_tab, + ), + + // Option: Menu Hover Background Color. + array( + 'name' => 'transparent-account-menu-h-bg-color-responsive', + 'default' => astra_get_option( 'transparent-account-menu-h-bg-color-responsive' ), + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]', + 'type' => 'sub-control', + 'title' => __( 'Background Color', 'astra' ), + 'section' => 'section-transparent-header', + 'control' => 'ast-responsive-color', + 'transport' => 'postMessage', + 'tab' => __( 'Hover', 'astra' ), + 'responsive' => true, + 'rgba' => true, + 'priority' => 21, + 'context' => Astra_Builder_Helper::$design_tab, + ), + + // Option: Active Menu Color. + array( + 'name' => 'transparent-account-menu-a-color-responsive', + 'default' => astra_get_option( 'transparent-account-menu-a-color-responsive' ), + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]', + 'type' => 'sub-control', + 'section' => 'section-transparent-header', + 'control' => 'ast-responsive-color', + 'transport' => 'postMessage', + 'tab' => __( 'Active', 'astra' ), + 'title' => __( 'Link Color', 'astra' ), + 'responsive' => true, + 'rgba' => true, + 'priority' => 31, + 'context' => Astra_Builder_Helper::$design_tab, + ), + + // Option: Active Menu Background Color. + array( + 'name' => 'transparent-account-menu-a-bg-color-responsive', + 'default' => astra_get_option( 'transparent-account-menu-a-bg-color-responsive' ), + 'parent' => ASTRA_THEME_SETTINGS . '[transparent-account-menu-colors]', + 'type' => 'sub-control', + 'control' => 'ast-responsive-color', + 'transport' => 'postMessage', + 'section' => 'section-transparent-header', + 'title' => __( 'Background Color', 'astra' ), + 'tab' => __( 'Active', 'astra' ), + 'responsive' => true, + 'rgba' => true, + 'priority' => 33, + 'context' => Astra_Builder_Helper::$design_tab, + ), + ); + + $_configs = array_merge( $_configs, $pro_elements_transparent_config ); + } + + return array_merge( $configurations, $_configs ); + } + } +} + +/** + * Kicking this off by calling 'get_instance()' method + */ +new Astra_Customizer_Transparent_Header_Configs(); diff --git a/inc/addons/transparent-header/classes/sections/index.php b/inc/addons/transparent-header/classes/sections/index.php index 02f2fd6..7860b5b 100644 --- a/inc/addons/transparent-header/classes/sections/index.php +++ b/inc/addons/transparent-header/classes/sections/index.php @@ -1,9 +1,9 @@ -<?php
-/**
- * Index file
- *
- * @package Astra Addon
- * @since Astra 1.0.0
- */
-
-/* Silence is golden, and we agree. */
+<?php +/** + * Index file + * + * @package Astra Addon + * @since Astra 1.0.0 + */ + +/* Silence is golden, and we agree. */ diff --git a/inc/addons/transparent-header/index.php b/inc/addons/transparent-header/index.php index 02f2fd6..7860b5b 100644 --- a/inc/addons/transparent-header/index.php +++ b/inc/addons/transparent-header/index.php @@ -1,9 +1,9 @@ -<?php
-/**
- * Index file
- *
- * @package Astra Addon
- * @since Astra 1.0.0
- */
-
-/* Silence is golden, and we agree. */
+<?php +/** + * Index file + * + * @package Astra Addon + * @since Astra 1.0.0 + */ + +/* Silence is golden, and we agree. */ |