summaryrefslogtreecommitdiff
path: root/inc/addons/breadcrumbs
diff options
context:
space:
mode:
Diffstat (limited to 'inc/addons/breadcrumbs')
-rw-r--r--inc/addons/breadcrumbs/assets/js/minified/customizer-preview.min.js1
-rw-r--r--inc/addons/breadcrumbs/assets/js/unminified/customizer-preview.js113
-rw-r--r--inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php1402
-rw-r--r--inc/addons/breadcrumbs/class-astra-breadcrumbs-loader.php190
-rw-r--r--inc/addons/breadcrumbs/class-astra-breadcrumbs-markup.php157
-rw-r--r--inc/addons/breadcrumbs/class-astra-breadcrumbs.php105
-rw-r--r--inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-color-configs.php206
-rw-r--r--inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-configs.php503
-rw-r--r--inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-typo-configs.php179
-rw-r--r--inc/addons/breadcrumbs/dynamic-css/dynamic.css.php539
10 files changed, 3395 insertions, 0 deletions
diff --git a/inc/addons/breadcrumbs/assets/js/minified/customizer-preview.min.js b/inc/addons/breadcrumbs/assets/js/minified/customizer-preview.min.js
new file mode 100644
index 0000000..dbb2244
--- /dev/null
+++ b/inc/addons/breadcrumbs/assets/js/minified/customizer-preview.min.js
@@ -0,0 +1 @@
+jQuery,astra_responsive_font_size("astra-settings[breadcrumb-font-size]",".ast-breadcrumbs-wrapper .trail-items span, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator"),astra_generate_outside_font_family_css("astra-settings[breadcrumb-font-family]",".ast-breadcrumbs-wrapper .trail-items span, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator"),astra_generate_font_weight_css("astra-settings[breadcrumb-font-family]","astra-settings[breadcrumb-font-weight]","font-weight",".ast-breadcrumbs-wrapper .trail-items span, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator"),astra_css("astra-settings[breadcrumb-text-transform]","text-transform",".ast-breadcrumbs-wrapper .trail-items span, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator"),astra_css("astra-settings[breadcrumb-line-height]","line-height",".ast-breadcrumbs-wrapper .ast-breadcrumbs-name, .ast-breadcrumbs-wrapper .ast-breadcrumbs-item, .ast-breadcrumbs-wrapper .ast-breadcrumbs .separator, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator"),astra_color_responsive_css("breadcrumb","astra-settings[breadcrumb-active-color-responsive]","color",".ast-breadcrumbs-wrapper .trail-items .trail-end, .ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast .breadcrumb_last, .ast-breadcrumbs-wrapper .current-item, .ast-breadcrumbs-wrapper .last"),astra_color_responsive_css("breadcrumb","astra-settings[breadcrumb-text-color-responsive]","color",".ast-breadcrumbs-wrapper .trail-items a, .ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast a, .ast-breadcrumbs-wrapper .breadcrumbs a, .ast-breadcrumbs-wrapper .rank-math-breadcrumb a"),astra_color_responsive_css("breadcrumb","astra-settings[breadcrumb-hover-color-responsive]","color",".ast-breadcrumbs-wrapper .trail-items a:hover, .ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast a:hover, .ast-breadcrumbs-wrapper .breadcrumbs a:hover, .ast-breadcrumbs-wrapper .rank-math-breadcrumb a:hover"),astra_color_responsive_css("breadcrumb","astra-settings[breadcrumb-separator-color]","color",".ast-breadcrumbs-wrapper .trail-items li::after, .ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .rank-math-breadcrumb .separator"),astra_color_responsive_css("breadcrumb","astra-settings[breadcrumb-bg-color]","background-color",".ast-breadcrumbs-wrapper, .main-header-bar.ast-header-breadcrumb, .ast-primary-sticky-header-active .main-header-bar.ast-header-breadcrumb"),astra_css("astra-settings[breadcrumb-alignment]","text-align",".ast-breadcrumbs-wrapper"),wp.customize("astra-settings[breadcrumb-spacing]",function(r){r.bind(function(r){var a=wp.customize("astra-settings[breadcrumb-position]").get();"astra_header_markup_after"==a||"astra_header_after"==a?astra_responsive_spacing("astra-settings[breadcrumb-spacing]",".main-header-bar.ast-header-breadcrumb","padding",["top","right","bottom","left"]):"astra_masthead_content"==a?astra_responsive_spacing("astra-settings[breadcrumb-spacing]",".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, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .ast-breadcrumbs","padding",["top","right","bottom","left"]):astra_responsive_spacing("astra-settings[breadcrumb-spacing]",".ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .rank-math-breadcrumb, .ast-breadcrumbs-wrapper .ast-breadcrumbs","padding",["top","right","bottom","left"])})}),wp.customize("astra-settings[breadcrumb-separator]",function(r){r.bind(function(r){var a="";a+=".trail-items li::after {",a+='content: "'+r+'";',a+="} ",astra_add_dynamic_css("breadcrumb-separator",a)})}); \ No newline at end of file
diff --git a/inc/addons/breadcrumbs/assets/js/unminified/customizer-preview.js b/inc/addons/breadcrumbs/assets/js/unminified/customizer-preview.js
new file mode 100644
index 0000000..7f11fb6
--- /dev/null
+++ b/inc/addons/breadcrumbs/assets/js/unminified/customizer-preview.js
@@ -0,0 +1,113 @@
+/**
+ * This file adds some LIVE to the Customizer live preview. To leverage
+ * this, set your custom settings to 'postMessage' and then add your handling
+ * here. Your javascript should grab settings from customizer controls, and
+ * then make any necessary changes to the page using jQuery.
+ *
+ * @package Astra
+ * @since 1.7.0
+ */
+
+( function( $ ) {
+
+ /* Breadcrumb Typography */
+ astra_responsive_font_size(
+ 'astra-settings[breadcrumb-font-size]',
+ '.ast-breadcrumbs-wrapper .trail-items span, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator'
+ );
+ astra_generate_outside_font_family_css(
+ 'astra-settings[breadcrumb-font-family]',
+ '.ast-breadcrumbs-wrapper .trail-items span, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator'
+ );
+ astra_generate_font_weight_css( 'astra-settings[breadcrumb-font-family]', 'astra-settings[breadcrumb-font-weight]', 'font-weight', '.ast-breadcrumbs-wrapper .trail-items span, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator' );
+ astra_css(
+ 'astra-settings[breadcrumb-text-transform]',
+ 'text-transform',
+ '.ast-breadcrumbs-wrapper .trail-items span, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator'
+ );
+
+ /* Breadcrumb default, Yoast SEO Breadcrumb, Breadcrumb NavXT, Ran Math Breadcrumb - Line Height */
+ astra_css(
+ 'astra-settings[breadcrumb-line-height]',
+ 'line-height',
+ '.ast-breadcrumbs-wrapper .ast-breadcrumbs-name, .ast-breadcrumbs-wrapper .ast-breadcrumbs-item, .ast-breadcrumbs-wrapper .ast-breadcrumbs .separator, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumb_last, .ast-breadcrumbs-wrapper span, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .current-item, .ast-breadcrumbs-wrapper a, .ast-breadcrumbs-wrapper .last, .ast-breadcrumbs-wrapper .separator'
+ );
+
+ /* Breadcrumb default, Yoast SEO Breadcrumb, Breadcrumb NavXT, Ran Math Breadcrumb - Text Color */
+ astra_color_responsive_css(
+ 'breadcrumb',
+ 'astra-settings[breadcrumb-active-color-responsive]',
+ 'color',
+ '.ast-breadcrumbs-wrapper .trail-items .trail-end, .ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast .breadcrumb_last, .ast-breadcrumbs-wrapper .current-item, .ast-breadcrumbs-wrapper .last'
+ );
+
+ /* Breadcrumb default, Yoast SEO Breadcrumb, Breadcrumb NavXT, Ran Math Breadcrumb - Link Color */
+ astra_color_responsive_css(
+ 'breadcrumb',
+ 'astra-settings[breadcrumb-text-color-responsive]',
+ 'color',
+ '.ast-breadcrumbs-wrapper .trail-items a, .ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast a, .ast-breadcrumbs-wrapper .breadcrumbs a, .ast-breadcrumbs-wrapper .rank-math-breadcrumb a'
+ );
+
+ /* Breadcrumb default, Yoast SEO Breadcrumb, Breadcrumb NavXT, Ran Math Breadcrumb - Hover Color */
+ astra_color_responsive_css(
+ 'breadcrumb',
+ 'astra-settings[breadcrumb-hover-color-responsive]',
+ 'color',
+ '.ast-breadcrumbs-wrapper .trail-items a:hover, .ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast a:hover, .ast-breadcrumbs-wrapper .breadcrumbs a:hover, .ast-breadcrumbs-wrapper .rank-math-breadcrumb a:hover'
+ );
+
+ /* Breadcrumb default, Yoast SEO Breadcrumb, Breadcrumb NavXT, Ran Math Breadcrumb - Separator Color */
+ astra_color_responsive_css(
+ 'breadcrumb',
+ 'astra-settings[breadcrumb-separator-color]',
+ 'color',
+ '.ast-breadcrumbs-wrapper .trail-items li::after, .ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .rank-math-breadcrumb .separator'
+ );
+
+ /* Breadcrumb default, Yoast SEO Breadcrumb, Breadcrumb NavXT, Ran Math Breadcrumb - Background Color */
+ astra_color_responsive_css(
+ 'breadcrumb',
+ 'astra-settings[breadcrumb-bg-color]',
+ 'background-color',
+ '.ast-breadcrumbs-wrapper, .main-header-bar.ast-header-breadcrumb, .ast-primary-sticky-header-active .main-header-bar.ast-header-breadcrumb'
+ );
+
+ /* Breadcrumb default, Yoast SEO Breadcrumb, Breadcrumb NavXT, Ran Math Breadcrumb - Alignment */
+ astra_css(
+ 'astra-settings[breadcrumb-alignment]',
+ 'text-align',
+ '.ast-breadcrumbs-wrapper'
+ );
+
+ /**
+ * Breadcrumb Spacing
+ */
+ wp.customize( 'astra-settings[breadcrumb-spacing]', function( value ) {
+ value.bind( function( padding ) {
+ var spacing_value = wp.customize( 'astra-settings[breadcrumb-position]' ).get();
+ if( 'astra_header_markup_after' == spacing_value || 'astra_header_after' == spacing_value ) {
+ astra_responsive_spacing( 'astra-settings[breadcrumb-spacing]','.main-header-bar.ast-header-breadcrumb', 'padding', ['top', 'right', 'bottom', 'left' ] );
+ } else if( 'astra_masthead_content' == spacing_value ) {
+ astra_responsive_spacing( 'astra-settings[breadcrumb-spacing]','.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, .ast-breadcrumbs-wrapper .ast-breadcrumbs-inner .ast-breadcrumbs', 'padding', ['top', 'right', 'bottom', 'left' ] );
+ } else {
+ astra_responsive_spacing( 'astra-settings[breadcrumb-spacing]','.ast-breadcrumbs-wrapper #ast-breadcrumbs-yoast, .ast-breadcrumbs-wrapper .breadcrumbs, .ast-breadcrumbs-wrapper .rank-math-breadcrumb, .ast-breadcrumbs-wrapper .ast-breadcrumbs', 'padding', ['top', 'right', 'bottom', 'left' ] );
+ }
+ } );
+ } );
+
+ /**
+ * Breadcrumb Separator.
+ */
+ wp.customize( 'astra-settings[breadcrumb-separator]', function( value ) {
+ value.bind( function( value ) {
+ var dynamicStyle = '';
+ dynamicStyle += '.trail-items li::after {';
+ dynamicStyle += 'content: "' + value + '";';
+ dynamicStyle += '} ';
+ astra_add_dynamic_css( 'breadcrumb-separator', dynamicStyle );
+ } );
+ } );
+
+} )( jQuery );
+ \ No newline at end of file
diff --git a/inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php b/inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php
new file mode 100644
index 0000000..38bab04
--- /dev/null
+++ b/inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php
@@ -0,0 +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, '%' ) );
+ }
+ }
+ }
+ }
+} \ 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
new file mode 100644
index 0000000..ddf3377
--- /dev/null
+++ b/inc/addons/breadcrumbs/class-astra-breadcrumbs-loader.php
@@ -0,0 +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();
diff --git a/inc/addons/breadcrumbs/class-astra-breadcrumbs-markup.php b/inc/addons/breadcrumbs/class-astra-breadcrumbs-markup.php
new file mode 100644
index 0000000..e5285a3
--- /dev/null
+++ b/inc/addons/breadcrumbs/class-astra-breadcrumbs-markup.php
@@ -0,0 +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();
diff --git a/inc/addons/breadcrumbs/class-astra-breadcrumbs.php b/inc/addons/breadcrumbs/class-astra-breadcrumbs.php
new file mode 100644
index 0000000..4a7b00f
--- /dev/null
+++ b/inc/addons/breadcrumbs/class-astra-breadcrumbs.php
@@ -0,0 +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();
+
+}
diff --git a/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-color-configs.php b/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-color-configs.php
new file mode 100644
index 0000000..a5a2ddd
--- /dev/null
+++ b/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-color-configs.php
@@ -0,0 +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();
diff --git a/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-configs.php b/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-configs.php
new file mode 100644
index 0000000..e4f60a8
--- /dev/null
+++ b/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-configs.php
@@ -0,0 +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' ) . ' &#187;',
+ '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
new file mode 100644
index 0000000..2afd280
--- /dev/null
+++ b/inc/addons/breadcrumbs/customizer/class-astra-breadcrumbs-typo-configs.php
@@ -0,0 +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();
diff --git a/inc/addons/breadcrumbs/dynamic-css/dynamic.css.php b/inc/addons/breadcrumbs/dynamic-css/dynamic.css.php
new file mode 100644
index 0000000..1aa68c9
--- /dev/null
+++ b/inc/addons/breadcrumbs/dynamic-css/dynamic.css.php
@@ -0,0 +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;
+}