File manager - Edit - /home/premiey/www/wp-includes/images/media/posts-structures.tar
Back
class-astra-post-structures.php 0000666 00000002260 15165765150 0012715 0 ustar 00 <?php /** * Post Strctures Extension * * @package Astra * @since 4.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } define( 'ASTRA_THEME_POST_STRUCTURE_DIR', ASTRA_THEME_DIR . 'inc/modules/posts-structures/' ); define( 'ASTRA_THEME_POST_STRUCTURE_URI', ASTRA_THEME_URI . 'inc/modules/posts-structures/' ); /** * Post Strctures Initial Setup * * @since 4.0.0 */ class Astra_Post_Structures { /** * Constructor function that loads require files. */ public function __construct() { // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_THEME_POST_STRUCTURE_DIR . 'class-astra-posts-structure-loader.php'; require_once ASTRA_THEME_POST_STRUCTURE_DIR . 'class-astra-posts-structure-markup.php'; // Include front end files. if ( ! is_admin() ) { require_once ASTRA_THEME_POST_STRUCTURE_DIR . 'css/single-dynamic.css.php'; require_once ASTRA_THEME_POST_STRUCTURE_DIR . 'css/archive-dynamic.css.php'; } // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } } /** * Kicking this off by creating new object. */ new Astra_Post_Structures(); customizer/class-astra-posts-structures-configs.php 0000666 00000010271 15165765150 0016733 0 ustar 00 <?php /** * Posts Structures Options for our theme. * * @package Astra * @author Brainstorm Force * @copyright Copyright (c) 2022, Brainstorm Force * @link https://www.brainstormforce.com * @since Astra 4.0.0 */ // Block direct access to the file. if ( ! defined( 'ABSPATH' ) ) { exit; } // Bail if Customizer config base class does not exist. if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { return; } /** * Register Posts Structures Customizer Configurations. * * @since 4.0.0 */ class Astra_Posts_Structures_Configs extends Astra_Customizer_Config_Base { /** * Excluding some post types with avoiding narrow-width container layout. * * @return array * @since 4.0.0 */ public static function get_narrow_width_exculde_cpts() { return apply_filters( 'astra_exculde_narrow_width_support_posttypes', array( 'product', 'download', 'course', 'lesson', 'tutor_quiz', 'tutor_assignments', 'sfwd-assignment', 'sfwd-essays', 'sfwd-transactions', 'sfwd-certificates', 'sfwd-quiz' ) ); } /** * Function to get formatted dynamic cpt section title. * * @since 4.0.2 * @param object|null $post_type_obj WP_Post_Type object. * @param string $label fallback label. * @return string formatted label. */ public static function astra_get_dynamic_section_title( $post_type_obj, $label ) { return is_object( $post_type_obj ) && isset( $post_type_obj->labels->name ) ? $post_type_obj->labels->name : ucfirst( $label ); } /** * Register Posts Structures Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 4.0.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); if ( ! empty( $post_types ) ) { $_configs = array( array( 'name' => 'section-posts-structure', 'type' => 'section', 'priority' => 69, 'title' => __( 'Custom Post Types', 'astra' ), ), ); $ignore_single_for_posttypes = array( 'post', 'product' ); $ignore_archive_for_posttypes = array( 'post', 'product' ); /** * Individual post types main section. */ foreach ( $post_types as $index => $label ) { $post_type_object = get_post_type_object( $label ); $parent_section = 'section-posts-structure'; if ( 'download' === $label ) { $parent_section = 'section-edd-group'; } if ( 'llms_membership' === $label ) { $parent_section = 'section-lifterlms'; } if ( 'groups' === $label || 'sfwd-topic' === $label || 'sfwd-lessons' === $label || 'sfwd-courses' === $label ) { $parent_section = 'section-learndash'; } $section_title = self::astra_get_dynamic_section_title( $post_type_object, $label ); if ( 'sc_product' === $label ) { $_configs[] = array( 'name' => 'section-posttype-' . $label, 'type' => 'section', 'title' => $section_title, 'priority' => 69, ); } else { $_configs[] = array( 'name' => 'section-posttype-' . $label, 'type' => 'section', 'section' => $parent_section, 'title' => $section_title, 'priority' => 69, ); } if ( ! in_array( $label, $ignore_archive_for_posttypes ) ) { $_configs[] = array( 'name' => 'archive-posttype-' . $label, 'type' => 'section', 'title' => __( 'Archive', 'astra' ) . ' ' . $section_title, 'section' => 'section-posttype-' . $label, 'priority' => 5, ); } if ( ! in_array( $label, $ignore_single_for_posttypes ) ) { $_configs[] = array( 'name' => 'single-posttype-' . $label, 'type' => 'section', 'title' => __( 'Single', 'astra' ) . ' ' . $section_title, 'section' => 'section-posttype-' . $label, 'priority' => 10, ); } } $configurations = array_merge( $configurations, $_configs ); } return $configurations; } } /** * Kicking this off by creating new object. */ new Astra_Posts_Structures_Configs(); customizer/class-astra-posts-single-structures-configs.php 0000666 00000132671 15165765150 0020223 0 ustar 00 <?php /** * Posts Strctures Options for our theme. * * @package Astra * @author Brainstorm Force * @copyright Copyright (c) 2022, Brainstorm Force * @link https://www.brainstormforce.com * @since Astra 4.0.0 */ // Block direct access to the file. if ( ! defined( 'ABSPATH' ) ) { exit; } // Bail if Customizer config base class does not exist. if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { return; } /** * Register Posts Strctures Customizer Configurations. * * @since 4.0.0 */ class Astra_Posts_Single_Structures_Configs extends Astra_Customizer_Config_Base { /** * Getting dynamic context for sidebar. * Compatibility case: Narrow width + dynamic customizer controls. * * @param string $post_type On basis of this will decide to hide sidebar control or not. * @since 4.0.0 */ public function get_sidebar_context( $post_type ) { if ( ! in_array( $post_type, Astra_Posts_Structures_Configs::get_narrow_width_exculde_cpts() ) ) { return array( 'relation' => 'AND', Astra_Builder_Helper::$general_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[single-' . $post_type . '-content-layout]', 'operator' => '!=', 'value' => 'narrow-container', ), array( 'relation' => 'OR', array( 'setting' => ASTRA_THEME_SETTINGS . '[single-' . $post_type . '-content-layout]', 'operator' => '!=', 'value' => 'default', ), array( 'setting' => ASTRA_THEME_SETTINGS . '[site-content-layout]', 'operator' => '!=', 'value' => 'narrow-container', ), ), ); } else { return Astra_Builder_Helper::$general_tab; } } /** * Getting content layout dynamically. * Compatibility case: Narrow width + dynamic customizer controls. * * @param string $post_type On basis of this will decide to show narrow-width layout or not. * @since 4.0.0 */ public function get_content_layout_choices( $post_type ) { if ( ! in_array( $post_type, Astra_Posts_Structures_Configs::get_narrow_width_exculde_cpts() ) ) { return array( 'default' => array( 'label' => __( 'Default', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'layout-default', false ) : '', ), 'boxed-container' => array( 'label' => __( 'Boxed', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-boxed', false ) : '', ), 'content-boxed-container' => array( 'label' => __( 'Content Boxed', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-content-boxed', false ) : '', ), 'plain-container' => array( 'label' => __( 'Full Width / Contained', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-full-width-contained', false ) : '', ), 'page-builder' => array( 'label' => __( 'Full Width / Stretched', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-full-width-stretched', false ) : '', ), 'narrow-container' => array( 'label' => __( 'Narrow Width', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'narrow-container', false ) : '', ), ); } else { return array( 'default' => array( 'label' => __( 'Default', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'layout-default', false ) : '', ), 'boxed-container' => array( 'label' => __( 'Boxed', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-boxed', false ) : '', ), 'content-boxed-container' => array( 'label' => __( 'Content Boxed', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-content-boxed', false ) : '', ), 'plain-container' => array( 'label' => __( 'Full Width / Contained', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-full-width-contained', false ) : '', ), 'page-builder' => array( 'label' => __( 'Full Width / Stretched', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-full-width-stretched', false ) : '', ), ); } } /** * Register Single Post's Structures Customizer Configurations. * * @param string $parent_section Section of dynamic customizer. * @param string $post_type Post Type. * @since 4.0.0 * * @return array Customizer Configurations. */ public function get_layout_configuration( $parent_section, $post_type ) { return array( array( 'name' => ASTRA_THEME_SETTINGS . '[single-' . $post_type . '-content-layout]', 'type' => 'control', 'control' => 'ast-radio-image', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), 'section' => $parent_section, 'default' => astra_get_option( 'single-' . $post_type . '-content-layout', 'default' ), 'priority' => 3, 'title' => __( 'Container Layout', 'astra' ), 'choices' => $this->get_content_layout_choices( $post_type ), 'divider' => array( 'ast_class' => 'ast-top-divider' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[single-' . $post_type . '-sidebar-layout]', 'type' => 'control', 'control' => 'ast-radio-image', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), 'section' => $parent_section, 'default' => astra_get_option( 'single-' . $post_type . '-sidebar-layout', 'default' ), 'priority' => 3, 'title' => __( 'Sidebar Layout', 'astra' ), 'context' => $this->get_sidebar_context( $post_type ), 'divider' => array( 'ast_class' => 'ast-top-divider' ), 'choices' => array( 'default' => array( 'label' => __( 'Default', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'layout-default', false ) : '', ), 'no-sidebar' => array( 'label' => __( 'No Sidebar', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'no-sidebar', false ) : '', ), 'left-sidebar' => array( 'label' => __( 'Left Sidebar', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'left-sidebar', false ) : '', ), 'right-sidebar' => array( 'label' => __( 'Right Sidebar', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'right-sidebar', false ) : '', ), ), ), ); } /** * Register Posts Strctures Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 4.0.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); foreach ( $post_types as $index => $post_type ) { $raw_taxonomies = array_diff( get_object_taxonomies( $post_type ), array( 'post_format' ) ); $raw_taxonomies[''] = __( 'Select', 'astra' ); // Filter out taxonomies in index-value format. $taxonomies = array(); foreach ( $raw_taxonomies as $index => $value ) { /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $tax_object = get_taxonomy( $value ); /** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort // @codingStandardsIgnoreStart $tax_val = ( is_object( $tax_object ) && ! empty( $tax_object->label ) ) ? $tax_object->label : $value; // @codingStandardsIgnoreEnd if ( '' === $index ) { $taxonomies[''] = $tax_val; } else { $taxonomies[ $value ] = $tax_val; } } /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $taxonomies = array_reverse( $taxonomies ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $section = 'single-posttype-' . $post_type; $title_section = 'ast-dynamic-single-' . $post_type; $post_type_object = get_post_type_object( $post_type ); if ( 'product' === $post_type ) { $parent_section = 'section-woo-shop-single'; } elseif ( 'post' === $post_type ) { $parent_section = 'section-blog-single'; } elseif ( 'page' === $post_type ) { $parent_section = 'section-page-dynamic-group'; } elseif ( 'download' === $post_type ) { $parent_section = 'section-edd-single'; } else { $parent_section = $section; } $meta_config_options = array(); $clone_limit = 0; /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( count( $taxonomies ) > 1 ) { /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $clone_limit = 3; $to_clone = true; if ( absint( astra_get_option( $title_section . '-taxonomy-clone-tracker', 1 ) ) === $clone_limit ) { $to_clone = false; } $meta_config_options[ $title_section . '-taxonomy' ] = array( 'clone' => $to_clone, 'is_parent' => true, 'main_index' => $title_section . '-taxonomy', 'clone_limit' => $clone_limit, 'clone_tracker' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-taxonomy-clone-tracker]', 'title' => __( 'Taxonomy', 'astra' ), ); $meta_config_options[ $title_section . '-taxonomy-1' ] = array( 'clone' => $to_clone, 'is_parent' => true, 'main_index' => $title_section . '-taxonomy', 'clone_limit' => $clone_limit, 'clone_tracker' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-taxonomy-clone-tracker]', 'title' => __( 'Taxonomy', 'astra' ), ); $meta_config_options[ $title_section . '-taxonomy-2' ] = array( 'clone' => $to_clone, 'is_parent' => true, 'main_index' => $title_section . '-taxonomy', 'clone_limit' => $clone_limit, 'clone_tracker' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-taxonomy-clone-tracker]', 'title' => __( 'Taxonomy', 'astra' ), ); } $meta_config_options['date'] = array( 'clone' => false, 'is_parent' => true, 'main_index' => 'date', 'clone_limit' => 1, 'title' => __( 'Date', 'astra' ), ); // Display Read Time option in Meta options only when Astra Addon is activated. /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'blog-pro' ) ) { $meta_config_options['read-time'] = __( 'Read Time', 'astra' ); } $structure_sub_controls = array(); // Add featured as background sub-control. $structure_sub_controls[ $title_section . '-image' ] = array( 'clone' => false, 'is_parent' => true, 'main_index' => $title_section . '-image', 'clone_limit' => 2, 'title' => __( 'Featured Image', 'astra' ), ); $configurations = array_merge( $configurations, $this->get_layout_configuration( $parent_section, $post_type ) ); $_configs = array( /** * Option: Builder Tabs */ array( 'name' => $title_section . '-ast-context-tabs', 'section' => $title_section, 'type' => 'control', 'control' => 'ast-builder-header-control', 'priority' => 0, 'description' => '', 'context' => array(), ), array( 'name' => $title_section, 'title' => isset( $post_type_object->labels->singular_name ) ? ucfirst( $post_type_object->labels->singular_name ) . __( ' Title', 'astra' ) : ucfirst( $post_type ) . __( ' Title', 'astra' ), 'type' => 'section', 'section' => $parent_section, 'panel' => ( 'product' === $post_type ) ? 'woocommerce' : '', 'priority' => 1, ), array( 'name' => ASTRA_THEME_SETTINGS . '[ast-single-' . $post_type . '-title]', 'type' => 'control', 'default' => astra_get_option( 'ast-single-' . $post_type . '-title', ( class_exists( 'WooCommerce' ) && 'product' === $post_type ) ? false : true ), 'control' => 'ast-section-toggle', 'section' => $parent_section, 'priority' => 2, 'linked' => $title_section, 'linkText' => isset( $post_type_object->labels->singular_name ) ? ucfirst( $post_type_object->labels->singular_name ) . __( ' Title', 'astra' ) : ucfirst( $post_type ) . __( ' Title', 'astra' ), 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-bottom-section-divider' ), ), /** * Layout option. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'type' => 'control', 'control' => 'ast-radio-image', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), 'section' => $title_section, 'default' => astra_get_option( $title_section . '-layout', 'layout-1' ), 'priority' => 5, 'context' => Astra_Builder_Helper::$general_tab, 'title' => __( 'Banner Layout', 'astra' ), 'divider' => array( 'ast_class' => 'ast-section-spacing ast-bottom-spacing' ), 'choices' => array( 'layout-1' => array( 'label' => __( 'Layout 1', 'astra' ), 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'post-layout' ), ), 'layout-2' => array( 'label' => __( 'Layout 2', 'astra' ), 'path' => '<span class="ahfb-svg-iconset ast-inline-flex"><svg width="100" height="70" viewBox="0 0 100 70" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M10 12C10 10.8954 10.8954 10 12 10H88C89.1046 10 90 10.8954 90 12V70H10V12Z" fill="white"></path> <mask id="' . esc_attr( $title_section ) . '-masking" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="10" y="10" width="80" height="60"> <path d="M10 12C10 10.8954 10.8954 10 12 10H88C89.1046 10 90 10.8954 90 12V70H10V12Z" fill="white"></path> </mask> <g mask="url(#' . esc_attr( $title_section ) . '-masking)"> <path d="M2 9H95V35H2V9Z" fill="#DADDE2"></path> </g> <path fill-rule="evenodd" clip-rule="evenodd" d="M83 58H16V56H83V58Z" fill="#E9EAEE"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M83 64H16V62H83V64Z" fill="#E9EAEE"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M61 21H41V19H61V21Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M53.4 25H33V23H53.4V25Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M67 25H54.76V23H67V25Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M42.4783 29H40V28H42.4783V29Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M50.7391 29H47.4348V28H50.7391V29Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M46.6087 29H43.3044V28H46.6087V29Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M54.8696 29H51.5652V28H54.8696V29Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M59 29H55.6956V28H59V29Z" fill="white"></path> <rect x="16" y="40" width="67" height="12" fill="#E9EAEE"></rect> </svg></span>', ), ), ), /** * Option: Banner Content Width. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-width-type]', 'type' => 'control', 'control' => 'ast-selector', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-banner-width-type', 'fullwidth' ), 'priority' => 10, 'title' => __( 'Container Width', 'astra' ), 'choices' => array( 'fullwidth' => __( 'Full Width', 'astra' ), 'custom' => __( 'Custom', 'astra' ), ), 'divider' => array( 'ast_class' => 'ast-top-divider ast-bottom-spacing' ), 'responsive' => false, 'renderAs' => 'text', 'context' => array( Astra_Builder_Helper::$general_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '===', 'value' => 'layout-2', ), ), ), /** * Option: Enter Width */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-custom-width]', 'type' => 'control', 'control' => 'ast-slider', 'section' => $title_section, 'transport' => 'postMessage', 'default' => astra_get_option( $title_section . '-banner-custom-width', 1200 ), 'context' => array( Astra_Builder_Helper::$general_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '===', 'value' => 'layout-2', ), array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-width-type]', 'operator' => '===', 'value' => 'custom', ), ), 'priority' => 15, 'title' => __( 'Custom Width', 'astra' ), 'suffix' => 'px', 'input_attrs' => array( 'min' => 768, 'step' => 1, 'max' => 1920, ), ), /** * Option: Display Post Structure */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'type' => 'control', 'control' => 'ast-sortable', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ), 'section' => $title_section, 'context' => Astra_Builder_Helper::$general_tab, 'default' => astra_get_option( $title_section . '-structure', 'page' === $post_type ? array( $title_section . '-image', $title_section . '-title' ) : array( $title_section . '-title', $title_section . '-meta' ) ), 'priority' => 20, 'title' => __( 'Structure', 'astra' ), 'divider' => array( 'ast_class' => 'ast-top-divider ast-bottom-spacing' ), 'choices' => array_merge( array( $title_section . '-title' => __( 'Title', 'astra' ), $title_section . '-meta' => __( 'Meta', 'astra' ), $title_section . '-breadcrumb' => __( 'Breadcrumb', 'astra' ), $title_section . '-excerpt' => __( 'Excerpt', 'astra' ), ), $structure_sub_controls ), ), /** * Single product payment sub control Visa. */ array( 'name' => $title_section . '-featured-as-background', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'default' => astra_get_option( $title_section . '-featured-as-background', false ), 'linked' => $title_section . '-image', 'type' => 'sub-control', 'control' => 'ast-toggle', 'section' => $title_section, 'priority' => 5, 'title' => __( 'Use as Background', 'astra' ), 'transport' => 'postMessage', 'context' => array( Astra_Builder_Helper::$general_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '===', 'value' => 'layout-2', ), ), ), /** * Option: Featured Image Overlay Color. */ array( 'name' => $title_section . '-banner-featured-overlay', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'default' => astra_get_option( $title_section . '-banner-featured-overlay', '' ), 'linked' => $title_section . '-image', 'type' => 'sub-control', 'control' => 'ast-color', 'section' => $title_section, 'priority' => 5, 'title' => __( 'Overlay Color', 'astra' ), 'context' => array( Astra_Builder_Helper::$general_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '===', 'value' => 'layout-2', ), ), ), array( 'name' => $title_section . '-featured-help-notice', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'linked' => $title_section . '-image', 'type' => 'sub-control', 'control' => 'ast-description', 'section' => $title_section, 'priority' => 10, 'label' => '', 'help' => __( 'Note: These featured settings will only work for Layout 2 banner design.', 'astra' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-taxonomy-clone-tracker]', 'section' => $title_section, 'type' => 'control', 'control' => 'ast-hidden', 'priority' => 22, 'transport' => 'postMessage', 'partial' => false, 'default' => astra_get_option( $title_section . '-taxonomy-clone-tracker', 1 ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-metadata]', 'type' => 'control', 'control' => 'ast-sortable', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ), 'default' => astra_get_option( $title_section . '-metadata', array( 'comments', 'author', 'date' ) ), 'context' => array( Astra_Builder_Helper::$general_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'operator' => 'contains', 'value' => $title_section . '-meta', ), ), 'section' => $title_section, 'priority' => 25, 'divider' => array( 'ast_class' => 'ast-bottom-spacing' ), 'title' => __( 'Meta', 'astra' ), 'choices' => array_merge( array( 'comments' => __( 'Comments', 'astra' ), 'author' => __( 'Author', 'astra' ), ), $meta_config_options ), ), /** * Option: Date Meta Type. */ array( 'name' => $title_section . '-meta-date-type', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-metadata]', 'type' => 'sub-control', 'control' => 'ast-selector', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-meta-date-type', 'published' ), 'priority' => 1, 'linked' => 'date', 'transport' => 'refresh', 'title' => __( 'Type', 'astra' ), 'choices' => array( 'published' => __( 'Published', 'astra' ), 'updated' => __( 'Last Updated', 'astra' ), ), 'divider' => array( 'ast_class' => 'ast-top-divider ast-bottom-spacing' ), 'responsive' => false, 'renderAs' => 'text', ), /** * Date format support for meta field. */ array( 'name' => $title_section . '-date-format', 'default' => astra_get_option( $title_section . '-date-format', '' ), 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-metadata]', 'linked' => 'date', 'type' => 'sub-control', 'control' => 'ast-select', 'section' => $title_section, 'priority' => 2, 'responsive' => false, 'renderAs' => 'text', 'title' => __( 'Format', 'astra' ), 'choices' => array( '' => __( 'Default', 'astra' ), 'F j, Y' => 'November 6, 2010', 'Y-m-d' => '2010-11-06', 'm/d/Y' => '11/06/2010', 'd/m/Y' => '06/11/2010', ), ), /** * Option: Horizontal Alignment. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-horizontal-alignment]', 'default' => astra_get_option( $title_section . '-horizontal-alignment' ), 'type' => 'control', 'control' => 'ast-selector', 'section' => $title_section, 'priority' => 27, 'title' => __( 'Horizontal Alignment', 'astra' ), 'context' => Astra_Builder_Helper::$general_tab, 'transport' => 'postMessage', 'choices' => array( 'left' => 'align-left', 'center' => 'align-center', 'right' => 'align-right', ), 'divider' => array( 'ast_class' => 'ast-top-divider' ), ), /** * Option: Vertical Alignment */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-vertical-alignment]', 'default' => astra_get_option( $title_section . '-vertical-alignment', 'center' ), 'type' => 'control', 'control' => 'ast-selector', 'section' => $title_section, 'priority' => 28, 'title' => __( 'Vertical Alignment', 'astra' ), 'choices' => array( 'flex-start' => __( 'Top', 'astra' ), 'center' => __( 'Middle', 'astra' ), 'flex-end' => __( 'Bottom', 'astra' ), ), 'divider' => array( 'ast_class' => 'ast-top-divider ast-section-spacing' ), 'context' => array( Astra_Builder_Helper::$general_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '===', 'value' => 'layout-2', ), ), 'transport' => 'postMessage', 'renderAs' => 'text', 'responsive' => false, ), /** * Option: Container min height. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-height]', 'type' => 'control', 'control' => 'ast-responsive-slider', 'section' => $title_section, 'transport' => 'postMessage', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'default' => astra_get_option( $title_section . '-banner-height', Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-slider' ) ), 'context' => array( Astra_Builder_Helper::$design_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '===', 'value' => 'layout-2', ), ), 'priority' => 1, 'title' => __( 'Banner Min Height', 'astra' ), 'suffix' => 'px', 'input_attrs' => array( 'min' => 0, 'step' => 1, 'max' => 1000, ), 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-section-spacing' ), ), /** * Option: Elements gap. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-elements-gap]', 'type' => 'control', 'control' => 'ast-slider', 'section' => $title_section, 'transport' => 'postMessage', 'default' => astra_get_option( $title_section . '-elements-gap', 10 ), 'context' => Astra_Builder_Helper::$design_tab, 'priority' => 5, 'title' => __( 'Inner Elements Spacing', 'astra' ), 'suffix' => 'px', 'input_attrs' => array( 'min' => 0, 'step' => 1, 'max' => 100, ), 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-bottom-spacing ast-section-spacing' ), ), /** * Option: Featured Image Custom Banner BG. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-background]', 'type' => 'control', 'default' => astra_get_option( $title_section . '-banner-background', Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-background' ) ), 'section' => $title_section, 'control' => 'ast-responsive-background', 'title' => __( 'Background', 'astra' ), 'transport' => 'postMessage', 'context' => array( Astra_Builder_Helper::$design_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-featured-as-background]', 'operator' => '!=', 'value' => true, ), array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '===', 'value' => 'layout-2', ), ), 'priority' => 5, ), /** * Option: Title Color */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-title-color]', 'type' => 'control', 'control' => 'ast-color', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-banner-title-color' ), 'transport' => 'postMessage', 'priority' => 5, 'title' => __( 'Title Color', 'astra' ), 'context' => Astra_Builder_Helper::$design_tab, ), /** * Option: Text Color */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-text-color]', 'type' => 'control', 'control' => 'ast-color', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-banner-text-color' ), 'priority' => 10, 'title' => __( 'Text Color', 'astra' ), 'transport' => 'postMessage', 'context' => Astra_Builder_Helper::$design_tab, ), /** * Option: Link Color */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-link-color]', 'type' => 'control', 'control' => 'ast-color', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-banner-link-color' ), 'transport' => 'postMessage', 'priority' => 15, 'title' => __( 'Link Color', 'astra' ), 'context' => Astra_Builder_Helper::$design_tab, ), /** * Option: Link Hover Color */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-link-hover-color]', 'type' => 'control', 'control' => 'ast-color', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-banner-link-hover-color' ), 'transport' => 'postMessage', 'priority' => 20, 'title' => __( 'Link Hover Color', 'astra' ), 'divider' => array( 'ast_class' => 'ast-bottom-spacing' ), 'context' => Astra_Builder_Helper::$design_tab, ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-title-typography-group]', 'type' => 'control', 'priority' => 25, 'control' => 'ast-settings-group', 'context' => array( Astra_Builder_Helper::$design_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'operator' => 'contains', 'value' => $title_section . '-title', ), ), 'divider' => array( 'ast_class' => 'ast-top-divider' ), 'title' => __( 'Title Font', 'astra' ), 'section' => $title_section, 'transport' => 'postMessage', ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-text-typography-group]', 'type' => 'control', 'priority' => 30, 'control' => 'ast-settings-group', 'context' => Astra_Builder_Helper::$design_tab, 'title' => __( 'Text Font', 'astra' ), 'section' => $title_section, 'transport' => 'postMessage', ), /** * Option: Text Font Family */ array( 'name' => $title_section . '-text-font-family', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-text-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font', 'font_type' => 'ast-font-family', 'default' => astra_get_option( $title_section . '-text-font-family', 'inherit' ), 'title' => __( 'Font Family', 'astra' ), 'connect' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-text-font-weight]', 'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ), ), /** * Option: Text Font Weight */ array( 'name' => $title_section . '-text-font-weight', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-text-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font', 'font_type' => 'ast-font-weight', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), 'default' => astra_get_option( $title_section . '-text-font-weight', 'inherit' ), 'title' => __( 'Font Weight', 'astra' ), 'connect' => $title_section . '-text-font-family', 'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ), ), /** * Option: Text Font Size */ array( 'name' => $title_section . '-text-font-size', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-text-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-responsive-slider', 'default' => astra_get_option( $title_section . '-text-font-size', Astra_Posts_Structure_Loader::get_customizer_default( 'font-size' ) ), 'transport' => 'postMessage', 'title' => __( 'Font Size', 'astra' ), 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'suffix' => array( 'px', 'em' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 1, 'max' => 20, ), ), ), /** * Option: Single Post Banner Text Font Extras */ array( 'name' => $title_section . '-text-font-extras', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-text-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font-extras', 'default' => astra_get_option( $title_section . '-text-font-extras', Astra_Posts_Structure_Loader::get_customizer_default( 'font-extras' ) ), 'title' => __( 'Font Extras', 'astra' ), ), /** * Option: Title Font Family */ array( 'name' => $title_section . '-title-font-family', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-title-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font', 'font_type' => 'ast-font-family', 'default' => astra_get_option( $title_section . '-title-font-family', 'inherit' ), 'title' => __( 'Font Family', 'astra' ), 'connect' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-title-font-weight]', 'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ), ), /** * Option: Title Font Weight */ array( 'name' => $title_section . '-title-font-weight', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-title-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font', 'font_type' => 'ast-font-weight', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), 'default' => astra_get_option( $title_section . '-title-font-weight', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-weight' ) ), 'title' => __( 'Font Weight', 'astra' ), 'connect' => $title_section . '-title-font-family', 'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ), ), /** * Option: Title Font Size */ array( 'name' => $title_section . '-title-font-size', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-title-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-responsive-slider', 'default' => astra_get_option( $title_section . '-title-font-size', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-size' ) ), 'transport' => 'postMessage', 'title' => __( 'Font Size', 'astra' ), 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'suffix' => array( 'px', 'em' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 1, 'max' => 20, ), ), ), /** * Option: Single Post Banner Title Font Extras */ array( 'name' => $title_section . '-title-font-extras', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-title-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font-extras', 'default' => astra_get_option( $title_section . '-title-font-extras', Astra_Posts_Structure_Loader::get_customizer_default( 'font-extras' ) ), 'title' => __( 'Font Extras', 'astra' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-meta-typography-group]', 'type' => 'control', 'priority' => 35, 'control' => 'ast-settings-group', 'context' => array( Astra_Builder_Helper::$design_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'operator' => 'contains', 'value' => $title_section . '-meta', ), ), 'title' => __( 'Meta Font', 'astra' ), 'divider' => array( 'ast_class' => 'ast-bottom-spacing' ), 'section' => $title_section, 'transport' => 'postMessage', ), /** * Option: Meta Font Family */ array( 'name' => $title_section . '-meta-font-family', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-meta-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font', 'font_type' => 'ast-font-family', 'default' => astra_get_option( $title_section . '-meta-font-family', 'inherit' ), 'title' => __( 'Font Family', 'astra' ), 'connect' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-meta-font-weight]', 'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ), ), /** * Option: Meta Font Weight */ array( 'name' => $title_section . '-meta-font-weight', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-meta-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font', 'font_type' => 'ast-font-weight', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), 'default' => astra_get_option( $title_section . '-meta-font-weight', 'inherit' ), 'title' => __( 'Font Weight', 'astra' ), 'connect' => $title_section . '-meta-font-family', 'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ), ), /** * Option: Meta Font Size */ array( 'name' => $title_section . '-meta-font-size', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-meta-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-responsive-slider', 'default' => astra_get_option( $title_section . '-meta-font-size', Astra_Posts_Structure_Loader::get_customizer_default( 'font-size' ) ), 'transport' => 'postMessage', 'title' => __( 'Font Size', 'astra' ), 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'suffix' => array( 'px', 'em' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 1, 'max' => 20, ), ), ), /** * Option: Single Post Banner Title Font Extras */ array( 'name' => $title_section . '-meta-font-extras', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-meta-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font-extras', 'default' => astra_get_option( $title_section . '-meta-font-extras', Astra_Posts_Structure_Loader::get_customizer_default( 'font-extras' ) ), 'title' => __( 'Font Extras', 'astra' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-margin]', 'default' => astra_get_option( $title_section . '-banner-margin', Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-spacing' ) ), 'type' => 'control', 'control' => 'ast-responsive-spacing', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), 'section' => $title_section, 'title' => __( 'Margin', 'astra' ), 'linked_choices' => true, 'transport' => 'postMessage', 'divider' => array( 'ast_class' => 'ast-top-divider' ), 'unit_choices' => array( 'px', 'em', '%' ), 'choices' => array( 'top' => __( 'Top', 'astra' ), 'right' => __( 'Right', 'astra' ), 'bottom' => __( 'Bottom', 'astra' ), 'left' => __( 'Left', 'astra' ), ), 'context' => array( Astra_Builder_Helper::$design_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '===', 'value' => 'layout-2', ), ), 'priority' => 100, 'connected' => false, ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-padding]', 'default' => astra_get_option( $title_section . '-banner-padding', Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-padding' ) ), 'type' => 'control', 'control' => 'ast-responsive-spacing', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), 'section' => $title_section, 'title' => __( 'Padding', 'astra' ), 'linked_choices' => true, 'transport' => 'postMessage', 'unit_choices' => array( 'px', 'em', '%' ), 'choices' => array( 'top' => __( 'Top', 'astra' ), 'right' => __( 'Right', 'astra' ), 'bottom' => __( 'Bottom', 'astra' ), 'left' => __( 'Left', 'astra' ), ), 'context' => array( Astra_Builder_Helper::$design_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '===', 'value' => 'layout-2', ), ), 'priority' => 120, 'connected' => false, ), ); /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( count( $taxonomies ) > 1 ) { /** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort for ( $index = 1; $index <= $clone_limit; $index++ ) { $control_suffix = ( 1 === $index ) ? '' : '-' . ( $index - 1 ); /** * Option: Taxonomy Selection. */ $_configs[] = array( 'name' => $title_section . '-taxonomy' . $control_suffix, 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-metadata]', 'default' => astra_get_option( $title_section . '-taxonomy' . $control_suffix ), 'linked' => $title_section . '-taxonomy' . $control_suffix, 'type' => 'sub-control', 'control' => 'ast-select', 'transport' => 'refresh', 'section' => $title_section, 'priority' => 5, 'title' => __( 'Select Taxonomy', 'astra' ), 'choices' => $taxonomies, ); } } $configurations = array_merge( $configurations, $_configs ); } return $configurations; } } /** * Kicking this off by creating new object. */ new Astra_Posts_Single_Structures_Configs(); customizer/class-astra-posts-archive-structures-configs.php 0000666 00000114257 15165765150 0020363 0 ustar 00 <?php /** * Posts Structures Options for our theme. * * @package Astra * @author Brainstorm Force * @copyright Copyright (c) 2022, Brainstorm Force * @link https://www.brainstormforce.com * @since Astra 4.0.0 */ // Block direct access to the file. if ( ! defined( 'ABSPATH' ) ) { exit; } // Bail if Customizer config base class does not exist. if ( ! class_exists( 'Astra_Customizer_Config_Base' ) ) { return; } /** * Register Posts Structures Customizer Configurations. * * @since 4.0.0 */ class Astra_Posts_Archive_Structures_Configs extends Astra_Customizer_Config_Base { /** * Getting dynamic context for sidebar. * Compatibility case: Narrow width + dynamic customizer controls. * * @param string $post_type On basis of this will decide to hide sidebar control or not. * @return mixed * @since 4.0.0 */ public function get_sidebar_context( $post_type ) { if ( ! in_array( $post_type, Astra_Posts_Structures_Configs::get_narrow_width_exculde_cpts() ) ) { return array( 'relation' => 'AND', Astra_Builder_Helper::$general_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[archive-' . $post_type . '-content-layout]', 'operator' => '!=', 'value' => 'narrow-container', ), array( 'relation' => 'OR', array( 'setting' => ASTRA_THEME_SETTINGS . '[archive-' . $post_type . '-content-layout]', 'operator' => '!=', 'value' => 'default', ), array( 'setting' => ASTRA_THEME_SETTINGS . '[site-content-layout]', 'operator' => '!=', 'value' => 'narrow-container', ), ), ); } else { return Astra_Builder_Helper::$general_tab; } } /** * Getting content layout dynamically. * Compatibility case: Narrow width + dynamic customizer controls. * * @param string $post_type On basis of this will decide to show narrow-width layout or not. * @since 4.0.0 */ public function get_content_layout_choices( $post_type ) { if ( ! in_array( $post_type, Astra_Posts_Structures_Configs::get_narrow_width_exculde_cpts() ) ) { return array( 'default' => array( 'label' => __( 'Default', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'layout-default', false ) : '', ), 'boxed-container' => array( 'label' => __( 'Boxed', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-boxed', false ) : '', ), 'content-boxed-container' => array( 'label' => __( 'Content Boxed', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-content-boxed', false ) : '', ), 'plain-container' => array( 'label' => __( 'Full Width / Contained', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-full-width-contained', false ) : '', ), 'page-builder' => array( 'label' => __( 'Full Width / Stretched', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-full-width-stretched', false ) : '', ), 'narrow-container' => array( 'label' => __( 'Narrow Width', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'narrow-container', false ) : '', ), ); } else { return array( 'default' => array( 'label' => __( 'Default', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'layout-default', false ) : '', ), 'boxed-container' => array( 'label' => __( 'Boxed', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-boxed', false ) : '', ), 'content-boxed-container' => array( 'label' => __( 'Content Boxed', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-content-boxed', false ) : '', ), 'plain-container' => array( 'label' => __( 'Full Width / Contained', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-full-width-contained', false ) : '', ), 'page-builder' => array( 'label' => __( 'Full Width / Stretched', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'container-full-width-stretched', false ) : '', ), ); } } /** * Register Single Post's Structures Customizer Configurations. * * @param string $parent_section Section of dynamic customizer. * @param string $post_type Post Type. * @since 4.0.0 * * @return array Customizer Configurations. */ public function get_layout_configuration( $parent_section, $post_type ) { if ( 'page' === $post_type ) { return array(); // Page archive not require. } return array( array( 'name' => ASTRA_THEME_SETTINGS . '[archive-' . $post_type . '-content-layout]', 'type' => 'control', 'control' => 'ast-radio-image', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), 'section' => $parent_section, 'default' => astra_get_option( 'archive-' . $post_type . '-content-layout', 'default' ), 'priority' => 5, 'title' => __( 'Container Layout', 'astra' ), 'choices' => $this->get_content_layout_choices( $post_type ), 'divider' => array( 'ast_class' => 'ast-top-divider' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[archive-' . $post_type . '-sidebar-layout]', 'type' => 'control', 'control' => 'ast-radio-image', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), 'section' => $parent_section, 'default' => astra_get_option( 'archive-' . $post_type . '-sidebar-layout', 'default' ), 'priority' => 5, 'title' => __( 'Sidebar Layout', 'astra' ), 'context' => $this->get_sidebar_context( $post_type ), 'divider' => array( 'ast_class' => 'ast-top-divider' ), 'choices' => array( 'default' => array( 'label' => __( 'Default', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'layout-default', false ) : '', ), 'no-sidebar' => array( 'label' => __( 'No Sidebar', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'no-sidebar', false ) : '', ), 'left-sidebar' => array( 'label' => __( 'Left Sidebar', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'left-sidebar', false ) : '', ), 'right-sidebar' => array( 'label' => __( 'Right Sidebar', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'right-sidebar', false ) : '', ), ), ), ); } /** * Register Posts Structures Customizer Configurations. * * @param Array $configurations Astra Customizer Configurations. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @since 4.0.0 * @return Array Astra Customizer Configurations with updated configurations. */ public function register_configuration( $configurations, $wp_customize ) { $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); foreach ( $post_types as $index => $post_type ) { if ( 'page' === $post_type ) { continue; } $section = 'archive-posttype-' . $post_type; $title_section = 'ast-dynamic-archive-' . $post_type; $post_type_object = get_post_type_object( $post_type ); $background_choices = array( 'none' => __( 'None', 'astra' ), 'custom' => __( 'Custom', 'astra' ), ); if ( 'product' === $post_type ) { $parent_section = 'woocommerce_product_catalog'; $background_choices = array( 'none' => __( 'None', 'astra' ), 'custom' => __( 'Custom', 'astra' ), 'featured' => __( 'Featured', 'astra' ), ); } elseif ( 'download' === $post_type ) { $parent_section = 'section-edd-archive'; } elseif ( 'post' === $post_type ) { $parent_section = 'section-blog'; } else { $parent_section = $section; } $configurations = array_merge( $configurations, $this->get_layout_configuration( $parent_section, $post_type ) ); $archive_structure_choices = array(); /** * Archive sortable title control. */ $archive_structure_choices[ $title_section . '-title' ] = array( 'clone' => false, 'is_parent' => true, 'main_index' => $title_section . '-title', 'clone_limit' => 2, 'title' => __( 'Title', 'astra' ), ); /** * Archive sortable title control. */ $archive_structure_choices[ $title_section . '-description' ] = array( 'clone' => false, 'is_parent' => true, 'main_index' => $title_section . '-description', 'clone_limit' => 2, 'title' => __( 'Description', 'astra' ), ); $_configs = array( /** * Option: Builder Tabs */ array( 'name' => $title_section . '-ast-context-tabs', 'section' => $title_section, 'type' => 'control', 'control' => 'ast-builder-header-control', 'priority' => 0, 'description' => '', 'context' => array(), ), array( 'name' => $title_section, 'title' => isset( $post_type_object->labels->name ) ? ucfirst( $post_type_object->labels->name ) . __( ' Title', 'astra' ) : ucfirst( $post_type ) . __( ' Title', 'astra' ), 'type' => 'section', 'section' => $parent_section, 'panel' => ( 'product' === $post_type ) ? 'woocommerce' : '', 'priority' => 1, ), array( 'name' => ASTRA_THEME_SETTINGS . '[ast-archive-' . $post_type . '-title]', 'type' => 'control', 'default' => astra_get_option( 'ast-archive-' . $post_type . '-title', ( class_exists( 'WooCommerce' ) && 'product' === $post_type ) ? false : true ), 'control' => 'ast-section-toggle', 'section' => $parent_section, 'priority' => 2, 'linked' => $title_section, 'linkText' => ( 'post' === $post_type ) ? __( 'Blog Title', 'astra' ) : Astra_Posts_Structures_Configs::astra_get_dynamic_section_title( get_post_type_object( $post_type ), $post_type ) . __( ' Title', 'astra' ), ), /** * Layout option. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'type' => 'control', 'control' => 'ast-radio-image', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), 'section' => $title_section, 'default' => astra_get_option( $title_section . '-layout', 'layout-1' ), 'priority' => 5, 'context' => Astra_Builder_Helper::$general_tab, 'title' => __( 'Banner Layout', 'astra' ), 'divider' => array( 'ast_class' => 'ast-section-spacing ast-bottom-spacing' ), 'choices' => array( 'layout-1' => array( 'label' => __( 'Layout 1', 'astra' ), 'path' => Astra_Builder_UI_Controller::fetch_svg_icon( 'post-layout' ), ), 'layout-2' => array( 'label' => __( 'Layout 2', 'astra' ), 'path' => '<span class="ahfb-svg-iconset ast-inline-flex"><svg width="100" height="70" viewBox="0 0 100 70" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M10 12C10 10.8954 10.8954 10 12 10H88C89.1046 10 90 10.8954 90 12V70H10V12Z" fill="white"></path> <mask id="' . esc_attr( $title_section ) . '-masking" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="10" y="10" width="80" height="60"> <path d="M10 12C10 10.8954 10.8954 10 12 10H88C89.1046 10 90 10.8954 90 12V70H10V12Z" fill="white"></path> </mask> <g mask="url(#' . esc_attr( $title_section ) . '-masking)"> <path d="M2 9H95V35H2V9Z" fill="#DADDE2"></path> </g> <path fill-rule="evenodd" clip-rule="evenodd" d="M83 58H16V56H83V58Z" fill="#E9EAEE"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M83 64H16V62H83V64Z" fill="#E9EAEE"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M61 21H41V19H61V21Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M53.4 25H33V23H53.4V25Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M67 25H54.76V23H67V25Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M42.4783 29H40V28H42.4783V29Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M50.7391 29H47.4348V28H50.7391V29Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M46.6087 29H43.3044V28H46.6087V29Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M54.8696 29H51.5652V28H54.8696V29Z" fill="white"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M59 29H55.6956V28H59V29Z" fill="white"></path> <rect x="16" y="40" width="67" height="12" fill="#E9EAEE"></rect> </svg></span>', ), ), ), /** * Option: Banner Content Width. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-width-type]', 'type' => 'control', 'control' => 'ast-selector', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-banner-width-type', 'fullwidth' ), 'priority' => 10, 'title' => __( 'Container Width', 'astra' ), 'choices' => array( 'fullwidth' => __( 'Full Width', 'astra' ), 'custom' => __( 'Custom', 'astra' ), ), 'divider' => array( 'ast_class' => 'ast-top-divider ast-bottom-spacing' ), 'responsive' => false, 'renderAs' => 'text', 'context' => array( Astra_Builder_Helper::$general_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '===', 'value' => 'layout-2', ), ), ), /** * Option: Enter Width */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-custom-width]', 'type' => 'control', 'control' => 'ast-slider', 'section' => $title_section, 'transport' => 'postMessage', 'default' => astra_get_option( $title_section . '-banner-custom-width', 1200 ), 'context' => array( Astra_Builder_Helper::$general_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '===', 'value' => 'layout-2', ), array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-width-type]', 'operator' => '===', 'value' => 'custom', ), ), 'priority' => 15, 'title' => __( 'Custom Width', 'astra' ), 'suffix' => 'px', 'input_attrs' => array( 'min' => 768, 'step' => 1, 'max' => 1920, ), ), /** * Option: Display Post Structure */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'type' => 'control', 'control' => 'ast-sortable', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ), 'section' => $title_section, 'context' => Astra_Builder_Helper::$general_tab, 'default' => astra_get_option( $title_section . '-structure', array( $title_section . '-title', $title_section . '-description' ) ), 'priority' => 20, 'title' => __( 'Structure', 'astra' ), 'divider' => ( 'post' !== $post_type ) ? array( 'ast_class' => 'ast-top-divider ast-bottom-spacing' ) : array( 'ast_class' => 'ast-bottom-spacing' ), 'choices' => array_merge( array( $title_section . '-breadcrumb' => __( 'Breadcrumb', 'astra' ), ), $archive_structure_choices ), ), /** * Title support for archive. */ array( 'name' => $title_section . '-custom-title', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'default' => astra_get_option( $title_section . '-custom-title', '' ), 'linked' => $title_section . '-title', 'type' => 'sub-control', 'control' => 'ast-text-input', 'settings' => array(), 'section' => $title_section, 'priority' => 1, 'title' => ( 'post' === $post_type ) ? __( 'Blog Title', 'astra' ) : __( 'Archive Title', 'astra' ), ), /** * Help description for title support. */ array( 'name' => $title_section . '-custom-title-support', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'linked' => $title_section . '-title', 'type' => 'sub-control', 'control' => 'ast-description', 'section' => $title_section, 'priority' => 2, 'label' => '', 'help' => esc_html( sprintf( /* translators: 1: post type */ __( 'Note: This title appear on %1$s archive for banner Layout 2.', 'astra' ), $post_type ) ), ), /** * Description support for archive. */ array( 'name' => $title_section . '-custom-description', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'default' => astra_get_option( $title_section . '-custom-description', '' ), 'linked' => $title_section . '-description', 'type' => 'sub-control', 'control' => 'ast-text-input', 'input_attrs' => array( 'textarea' => true, ), 'section' => $title_section, 'priority' => 1, 'title' => ( 'post' === $post_type ) ? __( 'Blog Description', 'astra' ) : __( 'Archive Description', 'astra' ), ), /** * Help description for description support. */ array( 'name' => $title_section . '-custom-description-support', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'linked' => $title_section . '-description', 'type' => 'sub-control', 'control' => 'ast-description', 'section' => $title_section, 'priority' => 2, 'label' => '', 'help' => esc_html( sprintf( /* translators: 1: post type */ __( 'Note: This description appear on %1$s archive for banner Layout 2.', 'astra' ), $post_type ) ), ), /** * Option: Horizontal Alignment. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-horizontal-alignment]', 'default' => astra_get_option( $title_section . '-horizontal-alignment' ), 'type' => 'control', 'control' => 'ast-selector', 'section' => $title_section, 'priority' => 21, 'title' => __( 'Horizontal Alignment', 'astra' ), 'context' => Astra_Builder_Helper::$general_tab, 'transport' => 'postMessage', 'choices' => array( 'left' => 'align-left', 'center' => 'align-center', 'right' => 'align-right', ), 'divider' => array( 'ast_class' => 'ast-top-divider' ), ), /** * Option: Vertical Alignment */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-vertical-alignment]', 'default' => astra_get_option( $title_section . '-vertical-alignment', 'center' ), 'type' => 'control', 'control' => 'ast-selector', 'section' => $title_section, 'priority' => 22, 'title' => __( 'Vertical Alignment', 'astra' ), 'choices' => array( 'flex-start' => __( 'Top', 'astra' ), 'center' => __( 'Middle', 'astra' ), 'flex-end' => __( 'Bottom', 'astra' ), ), 'divider' => array( 'ast_class' => 'ast-top-divider ast-section-spacing' ), 'context' => array( Astra_Builder_Helper::$general_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '===', 'value' => 'layout-2', ), ), 'transport' => 'postMessage', 'renderAs' => 'text', 'responsive' => false, ), /** * Option: Container min height. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-height]', 'type' => 'control', 'control' => 'ast-responsive-slider', 'section' => $title_section, 'transport' => 'postMessage', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'default' => astra_get_option( $title_section . '-banner-height', Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-slider' ) ), 'context' => array( Astra_Builder_Helper::$design_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '===', 'value' => 'layout-2', ), ), 'priority' => 1, 'title' => __( 'Banner Min Height', 'astra' ), 'suffix' => 'px', 'input_attrs' => array( 'min' => 0, 'step' => 1, 'max' => 1000, ), 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-section-spacing' ), ), /** * Option: Elements gap. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-elements-gap]', 'type' => 'control', 'control' => 'ast-slider', 'section' => $title_section, 'transport' => 'postMessage', 'default' => astra_get_option( $title_section . '-elements-gap', 10 ), 'context' => Astra_Builder_Helper::$design_tab, 'priority' => 5, 'title' => __( 'Inner Elements Spacing', 'astra' ), 'suffix' => 'px', 'input_attrs' => array( 'min' => 0, 'step' => 1, 'max' => 100, ), 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-section-spacing' ), ), /** * Option: Banner Content Width. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-image-type]', 'type' => 'control', 'control' => 'ast-selector', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-banner-image-type', 'none' ), 'priority' => 5, 'context' => Astra_Builder_Helper::$design_tab, 'title' => __( 'Container Background', 'astra' ), 'choices' => $background_choices, 'divider' => array( 'ast_class' => 'ast-section-spacing ast-bottom-spacing' ), 'responsive' => false, 'renderAs' => 'text', ), /** * Option: Featured Image Custom Banner BG. */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-custom-bg]', 'default' => astra_get_option( $title_section . '-banner-custom-bg', Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-background' ) ), 'type' => 'control', 'control' => 'ast-responsive-background', 'section' => $title_section, 'title' => __( 'Background', 'astra' ), 'transport' => 'postMessage', 'priority' => 5, 'context' => array( Astra_Builder_Helper::$design_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-image-type]', 'operator' => '===', 'value' => 'custom', ), ), ), /** * Option: Title Color */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-title-color]', 'type' => 'control', 'control' => 'ast-color', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-banner-title-color' ), 'transport' => 'postMessage', 'priority' => 9, 'title' => __( 'Title Color', 'astra' ), 'divider' => array( 'ast_class' => 'ast-top-divider ast-top-spacing' ), 'context' => Astra_Builder_Helper::$design_tab, ), /** * Option: Text Color */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-text-color]', 'type' => 'control', 'control' => 'ast-color', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-banner-text-color' ), 'priority' => 10, 'title' => __( 'Text Color', 'astra' ), 'transport' => 'postMessage', 'context' => Astra_Builder_Helper::$design_tab, ), /** * Option: Link Color */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-link-color]', 'type' => 'control', 'control' => 'ast-color', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-banner-link-color' ), 'transport' => 'postMessage', 'priority' => 15, 'title' => __( 'Link Color', 'astra' ), 'context' => Astra_Builder_Helper::$design_tab, ), /** * Option: Link Hover Color */ array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-link-hover-color]', 'type' => 'control', 'control' => 'ast-color', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-banner-link-hover-color' ), 'transport' => 'postMessage', 'priority' => 20, 'title' => __( 'Link Hover Color', 'astra' ), 'context' => Astra_Builder_Helper::$design_tab, 'divider' => array( 'ast_class' => 'ast-bottom-spacing' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-title-typography-group]', 'type' => 'control', 'priority' => 22, 'control' => 'ast-settings-group', 'context' => array( Astra_Builder_Helper::$design_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'operator' => 'contains', 'value' => $title_section . '-title', ), ), 'divider' => array( 'ast_class' => 'ast-top-divider' ), 'title' => __( 'Title Font', 'astra' ), 'section' => $title_section, 'transport' => 'postMessage', ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-text-typography-group]', 'type' => 'control', 'priority' => 25, 'control' => 'ast-settings-group', 'context' => Astra_Builder_Helper::$design_tab, 'title' => __( 'Text Font', 'astra' ), 'divider' => array( 'ast_class' => 'ast-bottom-spacing' ), 'section' => $title_section, 'transport' => 'postMessage', ), /** * Option: Text Font Family */ array( 'name' => $title_section . '-text-font-family', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-text-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font', 'font_type' => 'ast-font-family', 'default' => astra_get_option( $title_section . '-text-font-family', 'inherit' ), 'title' => __( 'Font Family', 'astra' ), 'connect' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-text-font-weight]', 'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ), ), /** * Option: Text Font Weight */ array( 'name' => $title_section . '-text-font-weight', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-text-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font', 'font_type' => 'ast-font-weight', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), 'default' => astra_get_option( $title_section . '-text-font-weight', 'inherit' ), 'title' => __( 'Font Weight', 'astra' ), 'connect' => $title_section . '-text-font-family', 'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ), ), /** * Option: Text Font Size */ array( 'name' => $title_section . '-text-font-size', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-text-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-responsive-slider', 'default' => astra_get_option( $title_section . '-text-font-size', Astra_Posts_Structure_Loader::get_customizer_default( 'font-size' ) ), 'transport' => 'postMessage', 'title' => __( 'Font Size', 'astra' ), 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'suffix' => array( 'px', 'em' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 1, 'max' => 20, ), ), ), array( 'name' => $title_section . '-text-font-size', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-text-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-responsive-slider', 'default' => astra_get_option( $title_section . '-text-font-size', Astra_Posts_Structure_Loader::get_customizer_default( 'font-size' ) ), 'transport' => 'postMessage', 'title' => __( 'Font Size', 'astra' ), 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'suffix' => array( 'px', 'em' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 1, 'max' => 20, ), ), ), /** * Option: Archive Post Banner Text Font Extras */ array( 'name' => $title_section . '-text-font-extras', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-text-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font-extras', 'default' => astra_get_option( $title_section . '-text-font-extras', Astra_Posts_Structure_Loader::get_customizer_default( 'font-extras' ) ), 'title' => __( 'Font Extras', 'astra' ), ), /** * Option: Title Font Family */ array( 'name' => $title_section . '-title-font-family', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-title-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font', 'font_type' => 'ast-font-family', 'default' => astra_get_option( $title_section . '-title-font-family', 'inherit' ), 'title' => __( 'Font Family', 'astra' ), 'connect' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-title-font-weight]', 'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ), ), /** * Option: Title Font Weight */ array( 'name' => $title_section . '-title-font-weight', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-title-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font', 'font_type' => 'ast-font-weight', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ), 'default' => astra_get_option( $title_section . '-title-font-weight', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-weight' ) ), 'title' => __( 'Font Weight', 'astra' ), 'connect' => $title_section . '-title-font-family', 'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ), ), /** * Option: Title Font Size */ array( 'name' => $title_section . '-title-font-size', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-title-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-responsive-slider', 'default' => astra_get_option( $title_section . '-title-font-size', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-size' ) ), 'transport' => 'postMessage', 'title' => __( 'Font Size', 'astra' ), 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'suffix' => array( 'px', 'em' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 1, 'max' => 20, ), ), ), /** * Option: Archive Post Banner Title Font Extras */ array( 'name' => $title_section . '-title-font-extras', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-title-typography-group]', 'section' => $title_section, 'type' => 'sub-control', 'control' => 'ast-font-extras', 'default' => astra_get_option( $title_section . '-title-font-extras', Astra_Posts_Structure_Loader::get_customizer_default( 'font-extras' ) ), 'title' => __( 'Font Extras', 'astra' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-margin]', 'default' => astra_get_option( $title_section . '-banner-margin', Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-spacing' ) ), 'type' => 'control', 'control' => 'ast-responsive-spacing', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), 'section' => $title_section, 'divider' => array( 'ast_class' => 'ast-top-divider' ), 'title' => __( 'Margin', 'astra' ), 'linked_choices' => true, 'transport' => 'postMessage', 'unit_choices' => array( 'px', 'em', '%' ), 'choices' => array( 'top' => __( 'Top', 'astra' ), 'right' => __( 'Right', 'astra' ), 'bottom' => __( 'Bottom', 'astra' ), 'left' => __( 'Left', 'astra' ), ), 'context' => Astra_Builder_Helper::$design_tab, 'priority' => 100, 'connected' => false, ), array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-padding]', 'default' => astra_get_option( $title_section . '-banner-padding', ( class_exists( 'WooCommerce' ) && 'product' === $post_type ) ? Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-spacing' ) : Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-padding' ) ), 'type' => 'control', 'control' => 'ast-responsive-spacing', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ), 'section' => $title_section, 'title' => __( 'Padding', 'astra' ), 'linked_choices' => true, 'transport' => 'postMessage', 'unit_choices' => array( 'px', 'em', '%' ), 'choices' => array( 'top' => __( 'Top', 'astra' ), 'right' => __( 'Right', 'astra' ), 'bottom' => __( 'Bottom', 'astra' ), 'left' => __( 'Left', 'astra' ), ), 'context' => Astra_Builder_Helper::$design_tab, 'priority' => 120, 'connected' => false, ), ); if ( 'post' === $post_type ) { /** * Option: Disable Transparent Header on Your latest posts index Page */ $_configs[] = array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-on-blog]', 'default' => astra_get_option( $title_section . '-banner-on-blog', false ), 'type' => 'control', 'section' => $title_section, 'context' => array( Astra_Builder_Helper::$general_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-layout]', 'operator' => '!=', 'value' => 'layout-1', ), ), 'title' => __( 'Enable on Blog / Posts Page?', 'astra' ), 'priority' => 7, 'control' => 'ast-toggle-control', 'divider' => array( 'ast_class' => 'ast-top-divider ast-bottom-spacing' ), ); } if ( 'product' === $post_type ) { /** * Option: Featured Image Overlay Color. */ $_configs[] = array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-featured-overlay]', 'type' => 'control', 'control' => 'ast-color', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-banner-featured-overlay', '' ), 'priority' => 6, 'title' => __( 'Overlay Color', 'astra' ), 'context' => array( Astra_Builder_Helper::$design_tab_config, 'relation' => 'AND', array( 'setting' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-banner-image-type]', 'operator' => '===', 'value' => 'featured', ), ), ); } $configurations = array_merge( $configurations, $_configs ); } return $configurations; } } /** * Kicking this off by creating new object. */ new Astra_Posts_Archive_Structures_Configs(); css/archive-dynamic.css.php 0000666 00000051532 15165765150 0011724 0 ustar 00 <?php /** * Post Structures - Archive Dynamic CSS * * @package Astra * @since 4.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Post Structures */ add_filter( 'astra_dynamic_theme_css', 'astra_post_archive_structure_dynamic_css' ); /** * Archive Dynamic CSS * * @param string $dynamic_css Astra Dynamic CSS. * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. * @return String Generated dynamic CSS for Post Structures. * * @since 4.0.0 */ function astra_post_archive_structure_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { $current_post_type = strval( get_post_type() ); $supported_post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); if ( ! in_array( $current_post_type, $supported_post_types ) ) { return $dynamic_css; } if ( false === astra_get_option( 'ast-archive-' . $current_post_type . '-title', ( class_exists( 'WooCommerce' ) && 'product' === $current_post_type ) ? false : true ) ) { return $dynamic_css; } $layout_type = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-layout', 'layout-1' ); $layout_2_active = ( 'layout-2' === $layout_type ) ? true : false; if ( $layout_2_active ) { $selector = '.ast-archive-entry-banner[data-post-type="' . $current_post_type . '"]'; } else { $selector = 'body.archive .ast-archive-description'; } $horz_alignment = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-horizontal-alignment' ); $desk_h_alignment = ( isset( $horz_alignment['desktop'] ) ) ? $horz_alignment['desktop'] : ''; $tab_h_alignment = ( isset( $horz_alignment['tablet'] ) ) ? $horz_alignment['tablet'] : ''; $mob_h_alignment = ( isset( $horz_alignment['mobile'] ) ) ? $horz_alignment['mobile'] : ''; if ( 'layout-1' === $layout_type ) { $desk_h_alignment = ( '' !== $desk_h_alignment ) ? $desk_h_alignment : 'left'; $tab_h_alignment = ( '' !== $tab_h_alignment ) ? $tab_h_alignment : 'left'; $mob_h_alignment = ( '' !== $mob_h_alignment ) ? $mob_h_alignment : 'left'; } $elements_gap = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-elements-gap', 10 ); $banner_padding = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-padding', ( class_exists( 'WooCommerce' ) && 'product' === $current_post_type ) ? Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-spacing' ) : Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-padding' ) ); $banner_margin = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-margin' ); $banner_height = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-height' ); $desk_banner_height = ( $layout_2_active && isset( $banner_height['desktop'] ) ) ? astra_get_css_value( $banner_height['desktop'], 'px' ) : ''; $tab_banner_height = ( $layout_2_active && isset( $banner_height['tablet'] ) ) ? astra_get_css_value( $banner_height['tablet'], 'px' ) : ''; $mob_banner_height = ( $layout_2_active && isset( $banner_height['mobile'] ) ) ? astra_get_css_value( $banner_height['mobile'], 'px' ) : ''; $text_color = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-text-color' ); $title_color = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-title-color' ); $link_color = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-link-color' ); $link_hover_color = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-link-hover-color' ); $vert_alignment = ( $layout_2_active ) ? astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-vertical-alignment', 'center' ) : 'center'; $width_type = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-width-type', 'fullwidth' ); $custom_width = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-custom-width', 1200 ); $background_type = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-image-type', 'none' ); // Banner Text typography dynamic stylings. $banner_text_font_size = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-text-font-size' ); // Banner Title typography dynamic stylings. $banner_title_font_size = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-title-font-size', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-size' ) ); $css_output_min_tablet = array(); $narrow_container_width = astra_get_option( 'narrow-container-max-width', apply_filters( 'astra_narrow_container_width', 750 ) ); // Few settings from banner section are also applicable to 'layout-1' so adding this condition & compatibility. if ( 'layout-1' === $layout_type ) { $site_content_width = astra_get_option( 'site-content-width', 1200 ); /** * Desktop CSS. */ $css_output_desktop = array( $selector => array( 'max-width' => $site_content_width . 'px', 'width' => '100%', 'text-align' => $desk_h_alignment, 'padding-top' => astra_responsive_spacing( $banner_padding, 'top', 'desktop' ), 'padding-right' => astra_responsive_spacing( $banner_padding, 'right', 'desktop' ), 'padding-bottom' => astra_responsive_spacing( $banner_padding, 'bottom', 'desktop' ), 'padding-left' => astra_responsive_spacing( $banner_padding, 'left', 'desktop' ), 'margin-top' => astra_responsive_spacing( $banner_margin, 'top', 'desktop' ), 'margin-bottom' => astra_responsive_spacing( $banner_margin, 'bottom', 'desktop' ), 'margin-left' => astra_responsive_spacing( $banner_margin, 'left', 'desktop' ), 'margin-right' => astra_responsive_spacing( $banner_margin, 'right', 'desktop' ), ), $selector . ' *' => astra_get_font_array_css( astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-text-font-family' ), astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-text-font-weight' ), $banner_text_font_size, 'ast-dynamic-archive-' . $current_post_type . '-text-font-extras', $text_color ), $selector . ' .ast-archive-title, ' . $selector . ' .ast-archive-title *' => astra_get_font_array_css( astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-title-font-family' ), astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-title-font-weight', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-weight' ) ), $banner_title_font_size, 'ast-dynamic-archive-' . $current_post_type . '-title-font-extras', $title_color ), $selector . ' a, ' . $selector . ' a *' => array( 'color' => esc_attr( $link_color ), ), $selector . ' a:hover, ' . $selector . ' a:hover *' => array( 'color' => esc_attr( $link_hover_color ), ), $selector . ' > *:not(:last-child)' => array( 'margin-bottom' => $elements_gap . 'px', ), ); /** * Tablet CSS. */ $css_output_tablet = array( $selector => array( 'text-align' => $tab_h_alignment, 'padding-top' => astra_responsive_spacing( $banner_padding, 'top', 'tablet' ), 'padding-right' => astra_responsive_spacing( $banner_padding, 'right', 'tablet' ), 'padding-bottom' => astra_responsive_spacing( $banner_padding, 'bottom', 'tablet' ), 'padding-left' => astra_responsive_spacing( $banner_padding, 'left', 'tablet' ), 'margin-top' => astra_responsive_spacing( $banner_margin, 'top', 'tablet' ), 'margin-right' => astra_responsive_spacing( $banner_margin, 'right', 'tablet' ), 'margin-bottom' => astra_responsive_spacing( $banner_margin, 'bottom', 'tablet' ), 'margin-left' => astra_responsive_spacing( $banner_margin, 'left', 'tablet' ), ), $selector . ' .ast-archive-title' => array( 'font-size' => astra_responsive_font( $banner_title_font_size, 'tablet' ), ), $selector . ' *' => array( 'font-size' => astra_responsive_font( $banner_text_font_size, 'tablet' ), ), ); /** * Mobile CSS. */ $css_output_mobile = array( $selector => array( 'text-align' => $mob_h_alignment, 'padding-top' => astra_responsive_spacing( $banner_padding, 'top', 'mobile' ), 'padding-right' => astra_responsive_spacing( $banner_padding, 'right', 'mobile' ), 'padding-bottom' => astra_responsive_spacing( $banner_padding, 'bottom', 'mobile' ), 'padding-left' => astra_responsive_spacing( $banner_padding, 'left', 'mobile' ), 'margin-top' => astra_responsive_spacing( $banner_margin, 'top', 'mobile' ), 'margin-right' => astra_responsive_spacing( $banner_margin, 'right', 'mobile' ), 'margin-bottom' => astra_responsive_spacing( $banner_margin, 'bottom', 'mobile' ), 'margin-left' => astra_responsive_spacing( $banner_margin, 'left', 'mobile' ), ), $selector . ' .ast-archive-title' => array( 'font-size' => astra_responsive_font( $banner_title_font_size, 'mobile' ), ), $selector . ' *' => array( 'font-size' => astra_responsive_font( $banner_text_font_size, 'mobile' ), ), ); if ( 'none' !== $background_type ) { if ( class_exists( 'WooCommerce' ) && 'product' === $current_post_type ) { if ( 'custom' === $background_type ) { $custom_background = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-custom-bg' ); $css_output_desktop['.archive .ast-archive-description'] = astra_get_responsive_background_obj( $custom_background, 'desktop' ); $css_output_tablet['.archive .ast-archive-description'] = astra_get_responsive_background_obj( $custom_background, 'tablet' ); $css_output_mobile['.archive .ast-archive-description'] = astra_get_responsive_background_obj( $custom_background, 'mobile' ); } else { // @codingStandardsIgnoreStart /** * @psalm-suppress RedundantCondition * @psalm-suppress InvalidGlobal */ global $wp_query; /** * @psalm-suppress RedundantCondition * @psalm-suppress InvalidGlobal */ // @codingStandardsIgnoreEnd $overlay_color = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-featured-overlay', '' ); $taxonomy = $wp_query->get_queried_object(); if ( is_callable( 'is_shop' ) && is_shop() && '' !== $overlay_color ) { $css_output_desktop['.archive .ast-archive-description']['background'] = $overlay_color; } if ( ! empty( $taxonomy->term_id ) ) { $thumbnail_id = get_term_meta( $taxonomy->term_id, 'thumbnail_id', true ); $feat_image_src = wp_get_attachment_url( $thumbnail_id ); if ( $feat_image_src ) { $css_output_desktop['.archive .ast-archive-description'] = array( 'background' => 'url( ' . esc_url( $feat_image_src ) . ' )', 'background-repeat' => 'no-repeat', 'background-attachment' => 'scroll', 'background-position' => 'center center', 'background-size' => 'cover', ); if ( '' !== $overlay_color ) { $css_output_desktop['.archive .ast-archive-description']['background'] = 'url( ' . esc_url( $feat_image_src ) . ' ) ' . $overlay_color; $css_output_desktop['.archive .ast-archive-description']['background-blend-mode'] = 'multiply'; } } } } } else { $custom_background = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-custom-bg' ); $css_output_desktop['.archive .ast-archive-description'] = astra_get_responsive_background_obj( $custom_background, 'desktop' ); $css_output_tablet['.archive .ast-archive-description'] = astra_get_responsive_background_obj( $custom_background, 'tablet' ); $css_output_mobile['.archive .ast-archive-description'] = astra_get_responsive_background_obj( $custom_background, 'mobile' ); } } } else { /** * Desktop CSS. */ $css_output_desktop = array( $selector => array( 'text-align' => $desk_h_alignment, 'justify-content' => $vert_alignment, 'min-height' => $desk_banner_height, 'margin-top' => astra_responsive_spacing( $banner_margin, 'top', 'desktop' ), 'margin-bottom' => astra_responsive_spacing( $banner_margin, 'bottom', 'desktop' ), 'margin-left' => astra_responsive_spacing( $banner_margin, 'left', 'desktop' ), 'margin-right' => astra_responsive_spacing( $banner_margin, 'right', 'desktop' ), ), $selector . ' .ast-container' => array( 'width' => '100%', 'padding-top' => astra_responsive_spacing( $banner_padding, 'top', 'desktop' ), 'padding-right' => astra_responsive_spacing( $banner_padding, 'right', 'desktop' ), 'padding-bottom' => astra_responsive_spacing( $banner_padding, 'bottom', 'desktop' ), 'padding-left' => astra_responsive_spacing( $banner_padding, 'left', 'desktop' ), ), $selector . ' .ast-container *' => astra_get_font_array_css( astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-text-font-family' ), astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-text-font-weight' ), $banner_text_font_size, 'ast-dynamic-archive-' . $current_post_type . '-text-font-extras', $text_color ), $selector . ' .ast-container h1' => astra_get_font_array_css( astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-title-font-family' ), astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-title-font-weight', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-weight' ) ), $banner_title_font_size, 'ast-dynamic-archive-' . $current_post_type . '-title-font-extras', $title_color ), '.ast-page-builder-template ' . $selector . ' .ast-container' => array( 'max-width' => '100%', ), '.ast-narrow-container ' . $selector . ' .ast-container' => array( 'max-width' => $narrow_container_width . 'px', ), $selector . ' .ast-container a, ' . $selector . ' .ast-container a *' => array( 'color' => esc_attr( $link_color ), ), $selector . ' .ast-container a:hover, ' . $selector . ' .ast-container a:hover *' => array( 'color' => esc_attr( $link_hover_color ), ), $selector . ' .ast-container > *:not(:last-child)' => array( 'margin-bottom' => $elements_gap . 'px', ), ); /** * Min tablet width CSS. */ $css_output_min_tablet = array( '.ast-narrow-container ' . $selector . ' .ast-container' => array( 'max-width' => $narrow_container_width . 'px', 'padding-left' => '0', 'padding-right' => '0', ), ); /** * Tablet CSS. */ $css_output_tablet = array( $selector => array( 'text-align' => $tab_h_alignment, 'min-height' => $tab_banner_height, 'padding-top' => astra_responsive_spacing( $banner_padding, 'top', 'tablet' ), 'padding-right' => astra_responsive_spacing( $banner_padding, 'right', 'tablet' ), 'padding-bottom' => astra_responsive_spacing( $banner_padding, 'bottom', 'tablet' ), 'padding-left' => astra_responsive_spacing( $banner_padding, 'left', 'tablet' ), 'margin-top' => astra_responsive_spacing( $banner_margin, 'top', 'tablet' ), 'margin-right' => astra_responsive_spacing( $banner_margin, 'right', 'tablet' ), 'margin-bottom' => astra_responsive_spacing( $banner_margin, 'bottom', 'tablet' ), 'margin-left' => astra_responsive_spacing( $banner_margin, 'left', 'tablet' ), ), $selector . ' .ast-container' => array( 'padding-left' => '0', 'padding-right' => '0', ), $selector . ' h1' => array( 'font-size' => astra_responsive_font( $banner_title_font_size, 'tablet' ), ), $selector . ' *' => array( 'font-size' => astra_responsive_font( $banner_text_font_size, 'tablet' ), ), ); /** * Mobile CSS. */ $css_output_mobile = array( $selector => array( 'text-align' => $mob_h_alignment, 'min-height' => $mob_banner_height, 'padding-top' => astra_responsive_spacing( $banner_padding, 'top', 'mobile' ), 'padding-right' => astra_responsive_spacing( $banner_padding, 'right', 'mobile' ), 'padding-bottom' => astra_responsive_spacing( $banner_padding, 'bottom', 'mobile' ), 'padding-left' => astra_responsive_spacing( $banner_padding, 'left', 'mobile' ), 'margin-top' => astra_responsive_spacing( $banner_margin, 'top', 'mobile' ), 'margin-right' => astra_responsive_spacing( $banner_margin, 'right', 'mobile' ), 'margin-bottom' => astra_responsive_spacing( $banner_margin, 'bottom', 'mobile' ), 'margin-left' => astra_responsive_spacing( $banner_margin, 'left', 'mobile' ), ), $selector . ' h1' => array( 'font-size' => astra_responsive_font( $banner_title_font_size, 'mobile' ), ), $selector . ' *' => array( 'font-size' => astra_responsive_font( $banner_text_font_size, 'mobile' ), ), ); if ( ( 'custom' === $width_type ) ) { $css_output_desktop[ $selector . '[data-banner-width-type="custom"]' ]['max-width'] = $custom_width . 'px'; } if ( 'none' !== $background_type ) { if ( 'product' !== $current_post_type ) { $custom_background = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-custom-bg' ); $css_output_desktop[ $selector . '[data-banner-background-type="custom"]' ] = astra_get_responsive_background_obj( $custom_background, 'desktop' ); $css_output_tablet[ $selector . '[data-banner-background-type="custom"]' ] = astra_get_responsive_background_obj( $custom_background, 'tablet' ); $css_output_mobile[ $selector . '[data-banner-background-type="custom"]' ] = astra_get_responsive_background_obj( $custom_background, 'mobile' ); } else { if ( 'custom' === $background_type ) { $custom_background = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-custom-bg' ); $css_output_desktop[ $selector . '[data-banner-background-type="custom"]' ] = astra_get_responsive_background_obj( $custom_background, 'desktop' ); $css_output_tablet[ $selector . '[data-banner-background-type="custom"]' ] = astra_get_responsive_background_obj( $custom_background, 'tablet' ); $css_output_mobile[ $selector . '[data-banner-background-type="custom"]' ] = astra_get_responsive_background_obj( $custom_background, 'mobile' ); } else { // @codingStandardsIgnoreStart /** * @psalm-suppress RedundantCondition * @psalm-suppress InvalidGlobal */ global $wp_query; /** * @psalm-suppress RedundantCondition * @psalm-suppress InvalidGlobal */ // @codingStandardsIgnoreEnd $overlay_color = astra_get_option( 'ast-dynamic-archive-' . $current_post_type . '-banner-featured-overlay', '' ); $taxonomy = $wp_query->get_queried_object(); if ( is_callable( 'is_shop' ) && is_shop() && '' !== $overlay_color ) { $css_output_desktop[ $selector . '[data-banner-background-type="featured"]' ]['background'] = $overlay_color; } if ( ! empty( $taxonomy->term_id ) ) { $thumbnail_id = get_term_meta( $taxonomy->term_id, 'thumbnail_id', true ); $feat_image_src = wp_get_attachment_url( $thumbnail_id ); if ( $feat_image_src ) { $css_output_desktop[ $selector . '[data-banner-background-type="featured"]' ] = array( 'background' => 'url( ' . esc_url( $feat_image_src ) . ' )', 'background-repeat' => 'no-repeat', 'background-attachment' => 'scroll', 'background-position' => 'center center', 'background-size' => 'cover', ); if ( '' !== $overlay_color ) { $css_output_desktop[ $selector . '[data-banner-background-type="featured"]' ]['background'] = 'url( ' . esc_url( $feat_image_src ) . ' ) ' . $overlay_color; $css_output_desktop[ $selector . '[data-banner-background-type="featured"]' ]['background-blend-mode'] = 'multiply'; } } } } } } } $dynamic_css .= ' .ast-archive-entry-banner { -js-display: flex; display: flex; flex-direction: column; justify-content: center; text-align: center; position: relative; background: #eeeeee; } .ast-archive-entry-banner[data-banner-width-type="custom"] { margin: 0 auto; width: 100%; } .ast-archive-entry-banner[data-banner-layout="layout-1"] { background: inherit; padding: 20px 0; text-align: left; } '; if ( is_customize_preview() ) { $dynamic_css .= ' .site-header-focus-item .ast-container div.customize-partial-edit-shortcut, .site-header-focus-item .ast-container button.item-customizer-focus { font-size: inherit; } '; } /* Parse CSS from array() */ $dynamic_css .= astra_parse_css( $css_output_desktop ); $dynamic_css .= astra_parse_css( $css_output_min_tablet, astra_get_tablet_breakpoint( '', 1 ) ); $dynamic_css .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() ); $dynamic_css .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() ); return $dynamic_css; } css/single-dynamic.css.php 0000666 00000041514 15165765150 0011563 0 ustar 00 <?php /** * Post Structures - Dynamic CSS * * @package Astra * @since 4.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Post Structures */ add_filter( 'astra_dynamic_theme_css', 'astra_post_single_structure_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 Post Structures. * * @since 4.0.0 */ function astra_post_single_structure_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { $current_post_type = strval( get_post_type() ); $supported_post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); if ( ! is_singular( $current_post_type ) ) { return $dynamic_css; } if ( ! in_array( $current_post_type, $supported_post_types ) ) { return $dynamic_css; } if ( false === astra_get_option( 'ast-single-' . $current_post_type . '-title', ( class_exists( 'WooCommerce' ) && 'product' === $current_post_type ) ? false : true ) ) { return $dynamic_css; } $layout_type = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-layout', 'layout-1' ); $layout_2_active = ( 'layout-2' === $layout_type ) ? true : false; $exclude_attr = astra_get_option( 'enable-related-posts', false ) ? ':not(.related-entry-header)' : ''; if ( $layout_2_active ) { $selector = '.ast-single-entry-banner[data-post-type="' . $current_post_type . '"]'; } else { $selector = 'header.entry-header' . $exclude_attr; } $horz_alignment = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-horizontal-alignment' ); $desk_h_alignment = ( isset( $horz_alignment['desktop'] ) ) ? $horz_alignment['desktop'] : ''; $tab_h_alignment = ( isset( $horz_alignment['tablet'] ) ) ? $horz_alignment['tablet'] : ''; $mob_h_alignment = ( isset( $horz_alignment['mobile'] ) ) ? $horz_alignment['mobile'] : ''; $banner_padding = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-banner-padding', Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-padding' ) ); $banner_margin = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-banner-margin' ); $text_color = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-banner-text-color' ); $title_color = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-banner-title-color' ); $link_color = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-banner-link-color' ); $link_hover_color = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-banner-link-hover-color' ); $elements_gap = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-elements-gap', 10 ); $banner_height = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-banner-height' ); $desk_banner_height = ( $layout_2_active && isset( $banner_height['desktop'] ) ) ? astra_get_css_value( $banner_height['desktop'], 'px' ) : ''; $tab_banner_height = ( $layout_2_active && isset( $banner_height['tablet'] ) ) ? astra_get_css_value( $banner_height['tablet'], 'px' ) : ''; $mob_banner_height = ( $layout_2_active && isset( $banner_height['mobile'] ) ) ? astra_get_css_value( $banner_height['mobile'], 'px' ) : ''; $vert_alignment = ( $layout_2_active ) ? astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-vertical-alignment', 'center' ) : 'center'; $width_type = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-banner-width-type', 'fullwidth' ); $custom_width = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-banner-custom-width', 1200 ); $single_structure = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-structure', 'page' === $current_post_type ? array( 'ast-dynamic-single-' . $current_post_type . '-image', 'ast-dynamic-single-' . $current_post_type . '-title' ) : array( 'ast-dynamic-single-' . $current_post_type . '-title', 'ast-dynamic-single-' . $current_post_type . '-meta' ) ); $use_featured_background = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-featured-as-background', false ); $custom_background = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-banner-background', Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-background' ) ); // Banner Text typography dynamic stylings. $banner_text_font_size = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-text-font-size' ); // Banner Title typography dynamic stylings. $banner_title_font_size = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-title-font-size', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-size' ) ); // Banner Meta typography dynamic stylings. $banner_meta_font_size = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-meta-font-size' ); $css_output_min_tablet = array(); $narrow_container_width = astra_get_option( 'narrow-container-max-width', apply_filters( 'astra_narrow_container_width', 750 ) ); // Few settings from banner section are also applicable to 'layout-1' so adding this condition & compatibility. if ( 'layout-1' === $layout_type ) { /** * Desktop CSS. */ $css_output_desktop = array( $selector => array( 'text-align' => $desk_h_alignment, ), $selector . ' *' => astra_get_font_array_css( astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-text-font-family' ), astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-text-font-weight' ), $banner_text_font_size, 'ast-dynamic-single-' . $current_post_type . '-text-font-extras', $text_color ), $selector . ' .entry-title' => astra_get_font_array_css( astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-title-font-family' ), astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-title-font-weight', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-weight' ) ), $banner_title_font_size, 'ast-dynamic-single-' . $current_post_type . '-title-font-extras', $title_color ), $selector . ' .entry-meta, ' . $selector . ' .entry-meta *' => astra_get_font_array_css( astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-meta-font-family' ), astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-meta-font-weight' ), $banner_meta_font_size, 'ast-dynamic-single-' . $current_post_type . '-meta-font-extras' ), $selector . ' a, ' . $selector . ' a *' => array( 'color' => esc_attr( $link_color ), ), $selector . ' a:hover, ' . $selector . ' a:hover *' => array( 'color' => esc_attr( $link_hover_color ), ), $selector . ' > *:not(:last-child)' => array( 'margin-bottom' => $elements_gap . 'px', ), ); /** * Tablet CSS. */ $css_output_tablet = array( $selector => array( 'text-align' => $tab_h_alignment, ), $selector . ' .entry-title' => array( 'font-size' => astra_responsive_font( $banner_title_font_size, 'tablet' ), ), $selector . ' *' => array( 'font-size' => astra_responsive_font( $banner_text_font_size, 'tablet' ), ), $selector . ' .entry-meta, ' . $selector . ' .entry-meta *' => array( 'font-size' => astra_responsive_font( $banner_meta_font_size, 'tablet' ), ), ); /** * Mobile CSS. */ $css_output_mobile = array( $selector => array( 'text-align' => $mob_h_alignment, ), $selector . ' .entry-title' => array( 'font-size' => astra_responsive_font( $banner_title_font_size, 'mobile' ), ), $selector . ' *' => array( 'font-size' => astra_responsive_font( $banner_text_font_size, 'mobile' ), ), $selector . ' .entry-meta, ' . $selector . ' .entry-meta *' => array( 'font-size' => astra_responsive_font( $banner_meta_font_size, 'mobile' ), ), ); } else { $entry_title_selector = is_customize_preview() ? $selector . ' .ast-container .entry-title' : $selector . ' .entry-title'; /** * Desktop CSS. */ $css_output_desktop = array( $selector => array( 'text-align' => $desk_h_alignment, 'justify-content' => $vert_alignment, 'min-height' => $desk_banner_height, 'margin-top' => astra_responsive_spacing( $banner_margin, 'top', 'desktop' ), 'margin-right' => astra_responsive_spacing( $banner_margin, 'right', 'desktop' ), 'margin-bottom' => astra_responsive_spacing( $banner_margin, 'bottom', 'desktop' ), 'margin-left' => astra_responsive_spacing( $banner_margin, 'left', 'desktop' ), ), $selector . ' .ast-container' => array( 'width' => '100%', 'padding-top' => astra_responsive_spacing( $banner_padding, 'top', 'desktop' ), 'padding-right' => astra_responsive_spacing( $banner_padding, 'right', 'desktop' ), 'padding-bottom' => astra_responsive_spacing( $banner_padding, 'bottom', 'desktop' ), 'padding-left' => astra_responsive_spacing( $banner_padding, 'left', 'desktop' ), ), $selector . '[data-banner-layout="layout-2"]' => astra_get_responsive_background_obj( $custom_background, 'desktop' ), $selector . ' .ast-container *' => astra_get_font_array_css( astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-text-font-family' ), astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-text-font-weight' ), $banner_text_font_size, 'ast-dynamic-single-' . $current_post_type . '-text-font-extras', $text_color ), $selector . ' .ast-container > *:not(:last-child)' => array( 'margin-bottom' => $elements_gap . 'px', ), '.ast-page-builder-template ' . $selector . ' .ast-container' => array( 'max-width' => '100%', ), $entry_title_selector => astra_get_font_array_css( astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-title-font-family' ), astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-title-font-weight', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-weight' ) ), $banner_title_font_size, 'ast-dynamic-single-' . $current_post_type . '-title-font-extras', $title_color ), $selector . ' > .entry-title' => array( 'margin-bottom' => '0', ), $selector . ' .entry-meta, ' . $selector . ' .entry-meta *' => astra_get_font_array_css( astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-meta-font-family' ), astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-meta-font-weight' ), $banner_meta_font_size, 'ast-dynamic-single-' . $current_post_type . '-meta-font-extras' ), $selector . ' .ast-container a, ' . $selector . ' .ast-container a *' => array( 'color' => esc_attr( $link_color ), ), $selector . ' .ast-container a:hover, ' . $selector . ' .ast-container a:hover *' => array( 'color' => esc_attr( $link_hover_color ), ), ); /** * Min tablet width CSS. */ $css_output_min_tablet = array( '.ast-narrow-container ' . $selector . ' .ast-container' => array( 'max-width' => $narrow_container_width . 'px', 'padding-left' => '0', 'padding-right' => '0', ), ); /** * Tablet CSS. */ $css_output_tablet = array( $selector => array( 'text-align' => $tab_h_alignment, 'min-height' => $tab_banner_height, 'padding-top' => astra_responsive_spacing( $banner_padding, 'top', 'tablet' ), 'padding-right' => astra_responsive_spacing( $banner_padding, 'right', 'tablet' ), 'padding-bottom' => astra_responsive_spacing( $banner_padding, 'bottom', 'tablet' ), 'padding-left' => astra_responsive_spacing( $banner_padding, 'left', 'tablet' ), 'margin-top' => astra_responsive_spacing( $banner_margin, 'top', 'tablet' ), 'margin-right' => astra_responsive_spacing( $banner_margin, 'right', 'tablet' ), 'margin-bottom' => astra_responsive_spacing( $banner_margin, 'bottom', 'tablet' ), 'margin-left' => astra_responsive_spacing( $banner_margin, 'left', 'tablet' ), ), $selector . '[data-banner-layout="layout-2"]' => astra_get_responsive_background_obj( $custom_background, 'tablet' ), $selector . ' .entry-title' => array( 'font-size' => astra_responsive_font( $banner_title_font_size, 'tablet' ), ), $selector . ' .ast-container' => array( 'padding-left' => '0', 'padding-right' => '0', ), $selector . ' *' => array( 'font-size' => astra_responsive_font( $banner_text_font_size, 'tablet' ), ), $selector . ' .entry-meta, ' . $selector . ' .entry-meta *' => array( 'font-size' => astra_responsive_font( $banner_meta_font_size, 'tablet' ), ), ); /** * Mobile CSS. */ $css_output_mobile = array( $selector => array( 'text-align' => $mob_h_alignment, 'min-height' => $mob_banner_height, 'padding-top' => astra_responsive_spacing( $banner_padding, 'top', 'mobile' ), 'padding-right' => astra_responsive_spacing( $banner_padding, 'right', 'mobile' ), 'padding-bottom' => astra_responsive_spacing( $banner_padding, 'bottom', 'mobile' ), 'padding-left' => astra_responsive_spacing( $banner_padding, 'left', 'mobile' ), 'margin-top' => astra_responsive_spacing( $banner_margin, 'top', 'mobile' ), 'margin-right' => astra_responsive_spacing( $banner_margin, 'right', 'mobile' ), 'margin-bottom' => astra_responsive_spacing( $banner_margin, 'bottom', 'mobile' ), 'margin-left' => astra_responsive_spacing( $banner_margin, 'left', 'mobile' ), ), $selector . '[data-banner-layout="layout-2"]' => astra_get_responsive_background_obj( $custom_background, 'mobile' ), $selector . ' .entry-title' => array( 'font-size' => astra_responsive_font( $banner_title_font_size, 'mobile' ), ), $selector . ' *' => array( 'font-size' => astra_responsive_font( $banner_text_font_size, 'mobile' ), ), $selector . ' .entry-meta, ' . $selector . ' .entry-meta *' => array( 'font-size' => astra_responsive_font( $banner_meta_font_size, 'mobile' ), ), ); if ( ( $layout_2_active && 'custom' === $width_type ) || is_customize_preview() ) { $css_output_desktop[ $selector . '[data-banner-width-type="custom"]' ]['max-width'] = $custom_width . 'px'; } if ( in_array( 'ast-dynamic-single-' . $current_post_type . '-image', $single_structure ) && $use_featured_background ) { /** @psalm-suppress PossiblyFalseArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $feat_image_src = wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) ); /** @psalm-suppress PossiblyFalseArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( $feat_image_src ) { $css_output_desktop[ $selector . '[data-banner-background-type="featured"]' ] = array( 'background' => 'url( ' . esc_url( $feat_image_src ) . ' )', 'background-repeat' => 'no-repeat', 'background-attachment' => 'scroll', 'background-position' => 'center center', 'background-size' => 'cover', ); $overlay_color = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-banner-featured-overlay', '' ); if ( '' !== $overlay_color && 'unset' !== $overlay_color ) { $css_output_desktop[ $selector . '[data-banner-background-type="featured"]' ]['background'] = 'url( ' . esc_url( $feat_image_src ) . ' ) ' . $overlay_color; $css_output_desktop[ $selector . '[data-banner-background-type="featured"]' ]['background-blend-mode'] = 'multiply'; } } } } $site_content_width = astra_get_option( 'site-content-width', 1200 ); $dynamic_css .= ' .ast-single-entry-banner { -js-display: flex; display: flex; flex-direction: column; justify-content: center; text-align: center; position: relative; background: #eeeeee; } .ast-single-entry-banner[data-banner-layout="layout-1"] { max-width: ' . astra_get_css_value( $site_content_width, 'px' ) . '; background: inherit; padding: 20px 0; } .ast-single-entry-banner[data-banner-width-type="custom"] { margin: 0 auto; width: 100%; } .ast-single-entry-banner + .site-content .entry-header { margin-bottom: 0; } '; if ( is_customize_preview() ) { $dynamic_css .= ' .site-header-focus-item .ast-container div.customize-partial-edit-shortcut, .site-header-focus-item .ast-container button.item-customizer-focus { font-size: inherit; } '; } /* Parse CSS from array() */ $dynamic_css .= astra_parse_css( $css_output_desktop ); $dynamic_css .= astra_parse_css( $css_output_min_tablet, astra_get_tablet_breakpoint( '', 1 ) ); $dynamic_css .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() ); $dynamic_css .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() ); return $dynamic_css; } class-astra-posts-structure-loader.php 0000666 00000023756 15165765150 0014176 0 ustar 00 <?php /** * Post Structures loader for Astra theme. * * @package Astra * @author Brainstorm Force * @copyright Copyright (c) 2022, Brainstorm Force * @link https://www.brainstormforce.com * @since Astra 4.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Customizer Initialization * * @since 4.0.0 */ class Astra_Posts_Structure_Loader { /** * Instance * * @var array $customizer_defaults */ private static $customizer_defaults = array(); /** * Supported post types to process dynamic customizer. * * @var array $supported_post_types */ private static $supported_post_types = array(); /** * Constructor * * @since 4.0.0 */ public function __construct() { /** * Update Astra default color and typography values. To not update directly on existing users site, added backwards. * * @since 4.0.0 */ $apply_new_default_color_typo_values = Astra_Dynamic_CSS::astra_check_default_color_typo(); self::$customizer_defaults['responsive-background'] = array( 'desktop' => array( 'background-color' => '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', 'overlay-type' => '', 'overlay-color' => '', 'overlay-gradient' => '', 'background-type' => '', 'background-media' => '', ), 'tablet' => array( 'background-color' => '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', 'overlay-type' => '', 'overlay-color' => '', 'overlay-gradient' => '', 'background-type' => '', 'background-media' => '', ), 'mobile' => array( 'background-color' => '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', 'overlay-type' => '', 'overlay-color' => '', 'overlay-gradient' => '', 'background-type' => '', 'background-media' => '', ), ); self::$customizer_defaults['responsive-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', ); self::$customizer_defaults['responsive-padding'] = array( 'desktop' => array( 'top' => 3, 'right' => 3, 'bottom' => 3, 'left' => 3, ), 'tablet' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), 'mobile' => array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ), 'desktop-unit' => 'em', 'tablet-unit' => 'em', 'mobile-unit' => 'em', ); self::$customizer_defaults['font-size'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ); self::$customizer_defaults['title-font-size'] = array( 'desktop' => $apply_new_default_color_typo_values ? '32' : '', 'tablet' => '', 'mobile' => '', 'desktop-unit' => 'px', 'tablet-unit' => 'px', 'mobile-unit' => 'px', ); self::$customizer_defaults['title-font-weight'] = $apply_new_default_color_typo_values ? '600' : 'inherit'; self::$customizer_defaults['responsive-slider'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); self::$customizer_defaults['responsive-color'] = array( 'desktop' => '', 'tablet' => '', 'mobile' => '', ); self::$customizer_defaults['font-extras'] = array( 'line-height' => '', 'line-height-unit' => 'em', 'letter-spacing' => '', 'letter-spacing-unit' => 'px', 'text-transform' => '', 'text-decoration' => '', ); add_action( 'customize_register', array( $this, 'posts_structures_customize_register' ), 2 ); add_action( 'astra_get_fonts', array( $this, 'add_fonts' ), 1 ); add_action( 'customize_preview_init', array( $this, 'preview_scripts' ) ); } /** * Enqueue google fonts. * * @return void * @since 4.0.0 */ public function add_fonts() { $post_types = self::get_supported_post_types(); foreach ( $post_types as $index => $post_type ) { // Single Banner - Font Support. $title_section = 'ast-dynamic-single-' . $post_type; $single_title_font_family = astra_get_option( $title_section . '-title-font-family' ); $single_title_font_weight = astra_get_option( $title_section . '-title-font-weight' ); Astra_Fonts::add_font( $single_title_font_family, $single_title_font_weight ); $single_text_font_family = astra_get_option( $title_section . '-text-font-family' ); $single_text_font_weight = astra_get_option( $title_section . '-text-font-weight' ); Astra_Fonts::add_font( $single_text_font_family, $single_text_font_weight ); $single_meta_font_family = astra_get_option( $title_section . '-meta-font-family' ); $single_meta_font_weight = astra_get_option( $title_section . '-meta-font-weight' ); Astra_Fonts::add_font( $single_meta_font_family, $single_meta_font_weight ); // Archive Banner - Font Support. $title_section = 'ast-dynamic-archive-' . $post_type; $archive_text_font_family = astra_get_option( $title_section . '-text-font-family' ); $archive_text_font_weight = astra_get_option( $title_section . '-text-font-weight' ); Astra_Fonts::add_font( $archive_text_font_family, $archive_text_font_weight ); $archive_title_font_family = astra_get_option( $title_section . '-title-font-family' ); $archive_title_font_weight = astra_get_option( $title_section . '-title-font-weight' ); Astra_Fonts::add_font( $archive_title_font_family, $archive_title_font_weight ); } } /** * Add postMessage support for site title and description for the Theme Customizer. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. * * @since 4.0.0 */ public function posts_structures_customize_register( $wp_customize ) { /** * Register Config control in Related Posts. */ // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once ASTRA_THEME_POST_STRUCTURE_DIR . 'customizer/class-astra-posts-structures-configs.php'; require_once ASTRA_THEME_POST_STRUCTURE_DIR . 'customizer/class-astra-posts-single-structures-configs.php'; require_once ASTRA_THEME_POST_STRUCTURE_DIR . 'customizer/class-astra-posts-archive-structures-configs.php'; // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Get all supported pots types & filter the public ones for further query. * * @since 4.0.0 * @return array $post_types */ public static function get_supported_post_types() { if ( empty( self::$supported_post_types ) || is_customize_preview() ) { $queried_post_types = array_keys( get_post_types( apply_filters( 'astra_dynamic_get_post_types_query_args', array( 'public' => true, '_builtin' => false, ) ) ) ); $queried_post_types = array_diff( $queried_post_types, array( 'astra-advanced-hook', 'astra_adv_header', 'elementor_library', 'brizy_template', 'course', 'lesson', 'llms_membership', 'tutor_quiz', 'tutor_assignments', 'testimonial', 'frm_display', 'mec_esb', 'mec-events', 'sfwd-assignment', 'sfwd-essays', 'sfwd-transactions', 'sfwd-certificates', 'sfwd-quiz', 'e-landing-page', ) ); $queried_post_types[] = 'post'; $queried_post_types[] = 'page'; self::$supported_post_types = $queried_post_types; } return apply_filters( 'astra_dynamic_post_structure_posttypes', self::$supported_post_types ); } /** * Customizer preview support. * * @since 4.0.0 */ public function preview_scripts() { /** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; /** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; /** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort wp_enqueue_script( 'astra-post-strctures-customizer-preview', ASTRA_THEME_POST_STRUCTURE_URI . 'assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); // Localize variables for further JS. wp_localize_script( 'astra-post-strctures-customizer-preview', 'AstraPostStrcturesData', array( 'post_types' => self::get_supported_post_types(), 'tablet_break_point' => astra_get_tablet_breakpoint(), 'mobile_break_point' => astra_get_mobile_breakpoint(), 'enabled_related_post' => astra_get_option( 'enable-related-posts', false ), ) ); } /** * Get customizer dynamic default. * * @param string $key Retrieve default for this parameter. * * @since 4.0.0 */ public static function get_customizer_default( $key ) { return isset( self::$customizer_defaults[ $key ] ) ? self::$customizer_defaults[ $key ] : array(); } } /** * Initialize class object with 'new' instance. */ new Astra_Posts_Structure_Loader(); assets/js/minified/customizer-preview.min.js 0000666 00000040114 15165765150 0015270 0 ustar 00 function astra_dynamic_build_css(n,r,i,o,t=!1){var y=AstraPostStrcturesData.tablet_break_point||768,c=AstraPostStrcturesData.mobile_break_point||544,d=t||"";wp.customize(r,function(t){t.bind(function(t){var a,e,s;t.desktop||t.mobile||t.tablet?(r=(r=r.replace("[","-")).replace("]",""),jQuery("style#"+r+"-dynamic-preview-css").remove(),(s=e=a="")!=t.desktop&&(a=i+": "+t.desktop),""!=t.tablet&&(e=i+": "+t.tablet),""!=t.mobile&&(s=i+": "+t.mobile),jQuery("head").append('<style id="'+r+'-dynamic-preview-css">'+o+" { "+a+d+" }@media (max-width: "+y+"px) {"+o+" { "+e+d+" } }@media (max-width: "+c+"px) {"+o+" { "+s+d+" } }</style>")):jQuery("style#"+r+"-"+n).remove()})})}function astra_refresh_customizer(t){wp.customize(t,function(t){t.bind(function(t){wp.customize.preview.send("refresh")})})}!function(){for(var t=AstraPostStrcturesData.post_types.length||!1,a=AstraPostStrcturesData.post_types||[],e=AstraPostStrcturesData.tablet_break_point||768,s=AstraPostStrcturesData.mobile_break_point||544,n=0;n<t;n++){var r=a[n],i=void 0!==wp.customize("astra-settings[ast-dynamic-single-"+r+"-layout]")?wp.customize("astra-settings[ast-dynamic-single-"+r+"-layout]").get():"both",o=AstraPostStrcturesData.enabled_related_post?":not(.related-entry-header)":"";let t="";t="layout-2"===i?'body .ast-single-entry-banner[data-post-type="'+r+'"]':"layout-1"===i?"header.entry-header"+o:'body .ast-single-entry-banner[data-post-type="'+r+'"], header.entry-header',astra_refresh_customizer("astra-settings[ast-dynamic-single-"+r+"-meta-date-type]"),astra_refresh_customizer("astra-settings[ast-dynamic-single-"+r+"-date-format]"),astra_refresh_customizer("astra-settings[ast-dynamic-single-"+r+"-taxonomy]"),astra_refresh_customizer("astra-settings[ast-dynamic-single-"+r+"-taxonomy-1]"),astra_refresh_customizer("astra-settings[ast-dynamic-single-"+r+"-taxonomy-2]"),astra_dynamic_build_css("ast-dynamic-single-"+r+"-horizontal-alignment","astra-settings[ast-dynamic-single-"+r+"-horizontal-alignment]","text-align",t),astra_dynamic_build_css("ast-dynamic-single-"+r+"-banner-height","astra-settings[ast-dynamic-single-"+r+"-banner-height]","min-height",t,"px"),astra_refresh_customizer("astra-settings[ast-dynamic-single-"+r+"-featured-as-background]"),astra_refresh_customizer("astra-settings[ast-dynamic-single-"+r+"-banner-featured-overlay]"),astra_apply_responsive_background_css("astra-settings[ast-dynamic-single-"+r+"-banner-background]",' body .ast-single-entry-banner[data-post-type="'+r+'"]',"desktop"),astra_apply_responsive_background_css("astra-settings[ast-dynamic-single-"+r+"-banner-background]",' body .ast-single-entry-banner[data-post-type="'+r+'"]',"tablet"),astra_apply_responsive_background_css("astra-settings[ast-dynamic-single-"+r+"-banner-background]",' body .ast-single-entry-banner[data-post-type="'+r+'"]',"mobile"),astra_css("astra-settings[ast-dynamic-single-"+r+"-vertical-alignment]","justify-content",'body .ast-single-entry-banner[data-post-type="'+r+'"]'),astra_css("astra-settings[ast-dynamic-single-"+r+"-banner-custom-width]","max-width",'body .ast-single-entry-banner[data-post-type="'+r+'"][data-banner-width-type="custom"]',"px"),astra_css("astra-settings[ast-dynamic-single-"+r+"-elements-gap]","margin-bottom",' header.entry-header > *:not(:last-child), body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container > *:not(:last-child)',"px"),astra_css("astra-settings[ast-dynamic-single-"+r+"-banner-text-color]","color",' header.entry-header *, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container *'),astra_css("astra-settings[ast-dynamic-single-"+r+"-banner-title-color]","color",' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-title'),astra_css("astra-settings[ast-dynamic-single-"+r+"-banner-link-color]","color",'body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container a, header.entry-header a, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container a *, header.entry-header a *'),astra_css("astra-settings[ast-dynamic-single-"+r+"-banner-link-hover-color]","color",'body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container a:hover, header.entry-header a:hover, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container a:hover *, header.entry-header a:hover *'),astra_responsive_spacing("astra-settings[ast-dynamic-single-"+r+"-banner-padding]",'body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container',"padding",["top","right","bottom","left"]),astra_responsive_spacing("astra-settings[ast-dynamic-single-"+r+"-banner-margin]",'body .ast-single-entry-banner[data-post-type="'+r+'"]',"margin",["top","right","bottom","left"]),astra_generate_outside_font_family_css("astra-settings[ast-dynamic-single-"+r+"-title-font-family]",' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-title'),astra_generate_font_weight_css("astra-settings[ast-dynamic-single-"+r+"-title-font-family]","astra-settings[ast-dynamic-single-"+r+"-title-font-weight]","font-weight",' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-title'),astra_css("astra-settings[ast-dynamic-single-"+r+"-title-font-weight]","font-weight",' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-title'),astra_responsive_font_size("astra-settings[ast-dynamic-single-"+r+"-title-font-size]",' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-title'),astra_font_extras_css("ast-dynamic-single-"+r+"-title-font-extras",' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-title'),astra_generate_outside_font_family_css("astra-settings[ast-dynamic-single-"+r+"-text-font-family]",' header.entry-header *, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container *'),astra_generate_font_weight_css("astra-settings[ast-dynamic-single-"+r+"-text-font-family]","astra-settings[ast-dynamic-single-"+r+"-text-font-weight]","font-weight",' header.entry-header *, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container *'),astra_css("astra-settings[ast-dynamic-single-"+r+"-text-font-weight]","font-weight",' header.entry-header *, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container *'),astra_responsive_font_size("astra-settings[ast-dynamic-single-"+r+"-text-font-size]",' header.entry-header *, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container *'),astra_font_extras_css("ast-dynamic-single-"+r+"-text-font-extras",' header.entry-header *, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container *'),astra_generate_outside_font_family_css("astra-settings[ast-dynamic-single-"+r+"-meta-font-family]",' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-meta *'),astra_generate_font_weight_css("astra-settings[ast-dynamic-single-"+r+"-meta-font-family]","astra-settings[ast-dynamic-single-"+r+"-meta-font-weight]","font-weight",' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-meta *'),astra_css("astra-settings[ast-dynamic-single-"+r+"-meta-font-weight]","font-weight",' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-meta *'),astra_responsive_font_size("astra-settings[ast-dynamic-single-"+r+"-meta-font-size]",' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-meta *'),astra_font_extras_css("ast-dynamic-single-"+r+"-meta-font-extras",' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="'+r+'"] .ast-container .entry-meta *')}for(n=0;n<t;n++){var y,r=a[n];y="layout-2"===(i=void 0!==wp.customize("astra-settings[ast-dynamic-archive-"+r+"-layout]")?wp.customize("astra-settings[ast-dynamic-archive-"+r+"-layout]").get():"both")?'body .ast-archive-entry-banner[data-post-type="'+r+'"]':"layout-1"===i?"body.archive .ast-archive-description":'body .ast-archive-entry-banner[data-post-type="'+r+'"], body.archive .ast-archive-description',astra_refresh_customizer("astra-settings[ast-dynamic-archive-"+r+"-custom-title]"),astra_refresh_customizer("astra-settings[ast-dynamic-archive-"+r+"-custom-description]"),astra_dynamic_build_css("ast-dynamic-archive-"+r+"-horizontal-alignment","astra-settings[ast-dynamic-archive-"+r+"-horizontal-alignment]","text-align",y),astra_dynamic_build_css("ast-dynamic-archive-"+r+"-banner-height","astra-settings[ast-dynamic-archive-"+r+"-banner-height]","min-height",y,"px"),wp.customize("astra-settings[ast-dynamic-archive-"+r+"banner-width-type]",function(t){t.bind(function(t){var a;"custom"===t?(jQuery('body .ast-archive-entry-banner[data-post-type="'+r+'"]').attr("data-banner-width-type","custom"),t=wp.customize("astra-settings[ast-dynamic-archive-"+r+"banner-custom-width]").get(),a="",a=(a+='body .ast-archive-entry-banner[data-post-type="'+r+'"][data-banner-width-type="custom"] {')+"max-width: "+t+"px;} ",astra_add_dynamic_css("ast-dynamic-archive-"+r+"-banner-width-type",a)):jQuery('body .ast-archive-entry-banner[data-post-type="'+r+'"]').attr("data-banner-width-type","full")})}),wp.customize("astra-settings[ast-dynamic-archive-"+r+"-banner-height]",function(t){t.bind(function(t){var a;""==t.desktop&&""==t.tablet&&""==t.mobile||(a="",a=(a=(a=(a=(a=(a+='body .ast-archive-entry-banner[data-post-type="'+r+'"] {')+"min-height: "+t.desktop+"px;} ")+"@media (max-width: "+e+'px) {body .ast-archive-entry-banner[data-post-type="'+r+'"] {')+"min-height: "+t.tablet+"px;} ")+"} @media (max-width: "+s+"px) {")+'body .ast-archive-entry-banner[data-post-type="'+r+'"] {min-height: '+t.mobile+"px;} } ",astra_add_dynamic_css("ast-dynamic-archive-"+r+"-banner-height",a))})}),astra_css("astra-settings[ast-dynamic-archive-"+r+"-vertical-alignment]","justify-content",y),astra_css("astra-settings[ast-dynamic-archive-"+r+"-banner-custom-width]","max-width",'body .ast-archive-entry-banner[data-post-type="'+r+'"][data-banner-width-type="custom"]',"px"),astra_css("astra-settings[ast-dynamic-archive-"+r+"-elements-gap]","margin-bottom",'body.archive .ast-archive-description > *:not(:last-child), body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container > *:not(:last-child)',"px"),astra_css("astra-settings[ast-dynamic-archive-"+r+"-banner-text-color]","color",'body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container *, body.archive .ast-archive-description *'),astra_css("astra-settings[ast-dynamic-archive-"+r+"-banner-title-color]","color",'body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container h1, body.archive .ast-archive-description .ast-archive-title, body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container h1 *, body.archive .ast-archive-description .ast-archive-title *'),astra_css("astra-settings[ast-dynamic-archive-"+r+"-banner-link-color]","color",'body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container a, body.archive .ast-archive-description a, body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container a *, body.archive .ast-archive-description a *'),astra_css("astra-settings[ast-dynamic-archive-"+r+"-banner-link-hover-color]","color",'body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container a:hover, body.archive .ast-archive-description a:hover, body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container a:hover *, body.archive .ast-archive-description a:hover *'),astra_apply_responsive_background_css("astra-settings[ast-dynamic-archive-"+r+"-banner-custom-bg]",'body .ast-archive-entry-banner[data-post-type="'+r+'"], body.archive .ast-archive-description',"desktop"),astra_apply_responsive_background_css("astra-settings[ast-dynamic-archive-"+r+"-banner-custom-bg]",'body .ast-archive-entry-banner[data-post-type="'+r+'"], body.archive .ast-archive-description',"tablet"),astra_apply_responsive_background_css("astra-settings[ast-dynamic-archive-"+r+"-banner-custom-bg]",'body .ast-archive-entry-banner[data-post-type="'+r+'"], body.archive .ast-archive-description',"mobile"),astra_responsive_spacing("astra-settings[ast-dynamic-archive-"+r+"-banner-padding]",'body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container, body.archive .ast-archive-description',"padding",["top","right","bottom","left"]),astra_responsive_spacing("astra-settings[ast-dynamic-archive-"+r+"-banner-margin]",'body .ast-archive-entry-banner[data-post-type="'+r+'"], body.archive .ast-archive-description',"margin",["top","right","bottom","left"]),astra_generate_outside_font_family_css("astra-settings[ast-dynamic-archive-"+r+"-title-font-family]",'body .ast-archive-entry-banner[data-post-type="'+r+'"] h1, body.archive .ast-archive-description h1, body .ast-archive-entry-banner[data-post-type="'+r+'"] h1 *, body.archive .ast-archive-description h1 *'),astra_generate_font_weight_css("astra-settings[ast-dynamic-archive-"+r+"-title-font-family]","astra-settings[ast-dynamic-archive-"+r+"-title-font-weight]","font-weight",'body .ast-archive-entry-banner[data-post-type="'+r+'"] h1, body.archive .ast-archive-description h1, body .ast-archive-entry-banner[data-post-type="'+r+'"] h1 *, body.archive .ast-archive-description h1 *'),astra_css("astra-settings[ast-dynamic-archive-"+r+"-title-font-weight]","font-weight",'body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container h1, body.archive .ast-archive-description h1, body .ast-archive-entry-banner[data-post-type="'+r+'"] h1 *, body.archive .ast-archive-description h1 *'),astra_responsive_font_size("astra-settings[ast-dynamic-archive-"+r+"-title-font-size]",'body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container h1, body.archive .ast-archive-description .ast-archive-title, body .ast-archive-entry-banner[data-post-type="'+r+'"] h1 *, body.archive .ast-archive-description .ast-archive-title *'),astra_font_extras_css("ast-dynamic-archive-"+r+"-title-font-extras",'body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container h1, body.archive .ast-archive-description .ast-archive-title, body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container h1 *, body.archive .ast-archive-description h1 *'),astra_generate_outside_font_family_css("astra-settings[ast-dynamic-archive-"+r+"-text-font-family]",'body .ast-archive-entry-banner[data-post-type="'+r+'"], body .ast-archive-entry-banner[data-post-type="'+r+'"] *, body.archive .ast-archive-description, body.archive .ast-archive-description *'),astra_generate_font_weight_css("astra-settings[ast-dynamic-archive-"+r+"-text-font-family]","astra-settings[ast-dynamic-archive-"+r+"-text-font-weight]","font-weight",'body .ast-archive-entry-banner[data-post-type="'+r+'"], body .ast-archive-entry-banner[data-post-type="'+r+'"] *, body.archive .ast-archive-description, body.archive .ast-archive-description *'),astra_css("astra-settings[ast-dynamic-archive-"+r+"-text-font-weight]","font-weight",'body .ast-archive-entry-banner[data-post-type="'+r+'"], body .ast-archive-entry-banner[data-post-type="'+r+'"] *, body.archive .ast-archive-description, body.archive .ast-archive-description *'),astra_responsive_font_size("astra-settings[ast-dynamic-archive-"+r+"-text-font-size]",'body .ast-archive-entry-banner[data-post-type="'+r+'"], body .ast-archive-entry-banner[data-post-type="'+r+'"] *, body.archive .ast-archive-description, body.archive .ast-archive-description *'),astra_font_extras_css("ast-dynamic-archive-"+r+"-text-font-extras",'body .ast-archive-entry-banner[data-post-type="'+r+'"] .ast-container *, body.archive .ast-archive-description *')}}(jQuery); assets/js/unminified/customizer-preview.js 0000666 00000052737 15165765150 0015067 0 ustar 00 /** * This file adds some LIVE to the Customizer live preview. To leverage * this, set your custom settings to 'postMessage' and then add your handling * here. Your javascript should grab settings from customizer controls, and * then make any necessary changes to the page using jQuery. * * @package Astra * @since x.x.x */ function astra_dynamic_build_css( addon, control, css_property, selector, unitSupport = false ) { var tablet_break_point = AstraPostStrcturesData.tablet_break_point || 768, mobile_break_point = AstraPostStrcturesData.mobile_break_point || 544, unitSuffix = unitSupport || ''; wp.customize( control, function( value ) { value.bind( function( value ) { if ( value.desktop || value.mobile || value.tablet ) { // Remove <style> first! control = control.replace( '[', '-' ); control = control.replace( ']', '' ); jQuery( 'style#' + control + '-dynamic-preview-css' ).remove(); var DeskVal = '', TabletFontVal = '', MobileVal = ''; if ( '' != value.desktop ) { DeskVal = css_property + ': ' + value.desktop; } if ( '' != value.tablet ) { TabletFontVal = css_property + ': ' + value.tablet; } if ( '' != value.mobile ) { MobileVal = css_property + ': ' + value.mobile; } // Concat and append new <style>. jQuery( 'head' ).append( '<style id="' + control + '-dynamic-preview-css">' + selector + ' { ' + DeskVal + unitSuffix + ' }' + '@media (max-width: ' + tablet_break_point + 'px) {' + selector + ' { ' + TabletFontVal + unitSuffix + ' } }' + '@media (max-width: ' + mobile_break_point + 'px) {' + selector + ' { ' + MobileVal + unitSuffix + ' } }' + '</style>' ); } else { jQuery( 'style#' + control + '-' + addon ).remove(); } } ); } ); } function astra_refresh_customizer( control ) { wp.customize( control, function( value ) { value.bind( function( value ) { wp.customize.preview.send( 'refresh' ); } ); } ); } ( function( $ ) { var postTypesCount = AstraPostStrcturesData.post_types.length || false, postTypes = AstraPostStrcturesData.post_types || [], tablet_break_point = AstraPostStrcturesData.tablet_break_point || 768, mobile_break_point = AstraPostStrcturesData.mobile_break_point || 544; /** * For single layouts. */ for ( var index = 0; index < postTypesCount; index++ ) { var postType = postTypes[ index ], layoutType = ( undefined !== wp.customize( 'astra-settings[ast-dynamic-single-' + postType + '-layout]' ) ) ? wp.customize( 'astra-settings[ast-dynamic-single-' + postType + '-layout]' ).get() : 'both'; let exclude_attribute = AstraPostStrcturesData.enabled_related_post ? ':not(.related-entry-header)' : ''; let selector = ''; if( 'layout-2' === layoutType ) { selector = 'body .ast-single-entry-banner[data-post-type="' + postType + '"]'; } else if( 'layout-1' === layoutType ) { selector = 'header.entry-header' + exclude_attribute; } else { selector = 'body .ast-single-entry-banner[data-post-type="' + postType + '"], header.entry-header'; } astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-meta-date-type]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-date-format]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-taxonomy]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-taxonomy-1]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-taxonomy-2]' ); astra_dynamic_build_css( 'ast-dynamic-single-' + postType + '-horizontal-alignment', 'astra-settings[ast-dynamic-single-' + postType + '-horizontal-alignment]', 'text-align', selector ); astra_dynamic_build_css( 'ast-dynamic-single-' + postType + '-banner-height', 'astra-settings[ast-dynamic-single-' + postType + '-banner-height]', 'min-height', selector, 'px' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-featured-as-background]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-banner-featured-overlay]' ); astra_apply_responsive_background_css( 'astra-settings[ast-dynamic-single-' + postType + '-banner-background]', ' body .ast-single-entry-banner[data-post-type="' + postType + '"]', 'desktop' ); astra_apply_responsive_background_css( 'astra-settings[ast-dynamic-single-' + postType + '-banner-background]', ' body .ast-single-entry-banner[data-post-type="' + postType + '"]', 'tablet' ); astra_apply_responsive_background_css( 'astra-settings[ast-dynamic-single-' + postType + '-banner-background]', ' body .ast-single-entry-banner[data-post-type="' + postType + '"]', 'mobile' ); astra_css( 'astra-settings[ast-dynamic-single-' + postType + '-vertical-alignment]', 'justify-content', 'body .ast-single-entry-banner[data-post-type="' + postType + '"]' ); astra_css( 'astra-settings[ast-dynamic-single-' + postType + '-banner-custom-width]', 'max-width', 'body .ast-single-entry-banner[data-post-type="' + postType + '"][data-banner-width-type="custom"]', 'px' ); astra_css( 'astra-settings[ast-dynamic-single-' + postType + '-elements-gap]', 'margin-bottom', ' header.entry-header > *:not(:last-child), body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container > *:not(:last-child)', 'px' ); astra_css( 'astra-settings[ast-dynamic-single-' + postType + '-banner-text-color]', 'color', ' header.entry-header *, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container *', ); astra_css( 'astra-settings[ast-dynamic-single-' + postType + '-banner-title-color]', 'color', ' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-title', ); astra_css( 'astra-settings[ast-dynamic-single-' + postType + '-banner-link-color]', 'color', 'body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container a, header.entry-header a, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container a *, header.entry-header a *' ); astra_css( 'astra-settings[ast-dynamic-single-' + postType + '-banner-link-hover-color]', 'color', 'body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container a:hover, header.entry-header a:hover, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container a:hover *, header.entry-header a:hover *' ); astra_responsive_spacing( 'astra-settings[ast-dynamic-single-' + postType + '-banner-padding]','body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container', 'padding', ['top', 'right', 'bottom', 'left' ] ); astra_responsive_spacing( 'astra-settings[ast-dynamic-single-' + postType + '-banner-margin]','body .ast-single-entry-banner[data-post-type="' + postType + '"]', 'margin', ['top', 'right', 'bottom', 'left' ] ); // Banner - Title. astra_generate_outside_font_family_css( 'astra-settings[ast-dynamic-single-' + postType + '-title-font-family]', ' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-title' ); astra_generate_font_weight_css( 'astra-settings[ast-dynamic-single-' + postType + '-title-font-family]', 'astra-settings[ast-dynamic-single-' + postType + '-title-font-weight]', 'font-weight', ' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-title' ); astra_css( 'astra-settings[ast-dynamic-single-' + postType + '-title-font-weight]', 'font-weight', ' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-title' ); astra_responsive_font_size( 'astra-settings[ast-dynamic-single-' + postType + '-title-font-size]', ' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-title' ); astra_font_extras_css( 'ast-dynamic-single-' + postType + '-title-font-extras', ' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-title' ); // Banner - Text. astra_generate_outside_font_family_css( 'astra-settings[ast-dynamic-single-' + postType + '-text-font-family]', ' header.entry-header *, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container *' ); astra_generate_font_weight_css( 'astra-settings[ast-dynamic-single-' + postType + '-text-font-family]', 'astra-settings[ast-dynamic-single-' + postType + '-text-font-weight]', 'font-weight', ' header.entry-header *, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container *' ); astra_css( 'astra-settings[ast-dynamic-single-' + postType + '-text-font-weight]', 'font-weight', ' header.entry-header *, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container *' ); astra_responsive_font_size( 'astra-settings[ast-dynamic-single-' + postType + '-text-font-size]', ' header.entry-header *, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container *' ); astra_font_extras_css( 'ast-dynamic-single-' + postType + '-text-font-extras', ' header.entry-header *, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container *' ); // Banner - Meta. astra_generate_outside_font_family_css( 'astra-settings[ast-dynamic-single-' + postType + '-meta-font-family]', ' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-meta *' ); astra_generate_font_weight_css( 'astra-settings[ast-dynamic-single-' + postType + '-meta-font-family]', 'astra-settings[ast-dynamic-single-' + postType + '-meta-font-weight]', 'font-weight', ' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-meta *' ); astra_css( 'astra-settings[ast-dynamic-single-' + postType + '-meta-font-weight]', 'font-weight', ' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-meta *' ); astra_responsive_font_size( 'astra-settings[ast-dynamic-single-' + postType + '-meta-font-size]', ' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-meta *' ); astra_font_extras_css( 'ast-dynamic-single-' + postType + '-meta-font-extras', ' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .entry-meta *' ); } /** * For archive layouts. */ for ( var index = 0; index < postTypesCount; index++ ) { var postType = postTypes[ index ], layoutType = ( undefined !== wp.customize( 'astra-settings[ast-dynamic-archive-' + postType + '-layout]' ) ) ? wp.customize( 'astra-settings[ast-dynamic-archive-' + postType + '-layout]' ).get() : 'both'; if( 'layout-2' === layoutType ) { var selector = 'body .ast-archive-entry-banner[data-post-type="' + postType + '"]'; } else if( 'layout-1' === layoutType ) { var selector = 'body.archive .ast-archive-description'; } else { var selector = 'body .ast-archive-entry-banner[data-post-type="' + postType + '"], body.archive .ast-archive-description'; } astra_refresh_customizer( 'astra-settings[ast-dynamic-archive-' + postType + '-custom-title]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-archive-' + postType + '-custom-description]' ); astra_dynamic_build_css( 'ast-dynamic-archive-' + postType + '-horizontal-alignment', 'astra-settings[ast-dynamic-archive-' + postType + '-horizontal-alignment]', 'text-align', selector ); astra_dynamic_build_css( 'ast-dynamic-archive-' + postType + '-banner-height', 'astra-settings[ast-dynamic-archive-' + postType + '-banner-height]', 'min-height', selector, 'px' ); wp.customize( 'astra-settings[ast-dynamic-archive-' + postType + 'banner-width-type]', function( value ) { value.bind( function( type ) { if ( 'custom' === type ) { jQuery('body .ast-archive-entry-banner[data-post-type="' + postType + '"]').attr( 'data-banner-width-type', 'custom' ); var customWidthSize = wp.customize( 'astra-settings[ast-dynamic-archive-' + postType + 'banner-custom-width]' ).get(), dynamicStyle = ''; dynamicStyle += 'body .ast-archive-entry-banner[data-post-type="' + postType + '"][data-banner-width-type="custom"] {'; dynamicStyle += 'max-width: ' + customWidthSize + 'px;'; dynamicStyle += '} '; astra_add_dynamic_css( 'ast-dynamic-archive-' + postType + '-banner-width-type', dynamicStyle ); } else { jQuery('body .ast-archive-entry-banner[data-post-type="' + postType + '"]').attr( 'data-banner-width-type', 'full' ); } } ); } ); wp.customize( 'astra-settings[ast-dynamic-archive-' + postType + '-banner-height]', function( value ) { value.bind( function( size ) { if( size.desktop != '' || size.tablet != '' || size.mobile != '' ) { var dynamicStyle = ''; dynamicStyle += 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] {'; dynamicStyle += 'min-height: ' + size.desktop + 'px;'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] {'; dynamicStyle += 'min-height: ' + size.tablet + 'px;'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] {'; dynamicStyle += 'min-height: ' + size.mobile + 'px;'; dynamicStyle += '} '; dynamicStyle += '} '; astra_add_dynamic_css( 'ast-dynamic-archive-' + postType + '-banner-height', dynamicStyle ); } } ); } ); astra_css( 'astra-settings[ast-dynamic-archive-' + postType + '-vertical-alignment]', 'justify-content', selector ); astra_css( 'astra-settings[ast-dynamic-archive-' + postType + '-banner-custom-width]', 'max-width', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"][data-banner-width-type="custom"]', 'px' ); astra_css( 'astra-settings[ast-dynamic-archive-' + postType + '-elements-gap]', 'margin-bottom', 'body.archive .ast-archive-description > *:not(:last-child), body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container > *:not(:last-child)', 'px' ); astra_css( 'astra-settings[ast-dynamic-archive-' + postType + '-banner-text-color]', 'color', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container *, body.archive .ast-archive-description *' ); astra_css( 'astra-settings[ast-dynamic-archive-' + postType + '-banner-title-color]', 'color', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container h1, body.archive .ast-archive-description .ast-archive-title, body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container h1 *, body.archive .ast-archive-description .ast-archive-title *' ); astra_css( 'astra-settings[ast-dynamic-archive-' + postType + '-banner-link-color]', 'color', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container a, body.archive .ast-archive-description a, body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container a *, body.archive .ast-archive-description a *' ); astra_css( 'astra-settings[ast-dynamic-archive-' + postType + '-banner-link-hover-color]', 'color', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container a:hover, body.archive .ast-archive-description a:hover, body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container a:hover *, body.archive .ast-archive-description a:hover *' ); astra_apply_responsive_background_css( 'astra-settings[ast-dynamic-archive-' + postType + '-banner-custom-bg]', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"], body.archive .ast-archive-description', 'desktop' ); astra_apply_responsive_background_css( 'astra-settings[ast-dynamic-archive-' + postType + '-banner-custom-bg]', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"], body.archive .ast-archive-description', 'tablet' ); astra_apply_responsive_background_css( 'astra-settings[ast-dynamic-archive-' + postType + '-banner-custom-bg]', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"], body.archive .ast-archive-description', 'mobile' ); astra_responsive_spacing( 'astra-settings[ast-dynamic-archive-' + postType + '-banner-padding]', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container, body.archive .ast-archive-description', 'padding', ['top', 'right', 'bottom', 'left' ] ); astra_responsive_spacing( 'astra-settings[ast-dynamic-archive-' + postType + '-banner-margin]', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"], body.archive .ast-archive-description', 'margin', ['top', 'right', 'bottom', 'left' ] ); // Banner - Title. astra_generate_outside_font_family_css( 'astra-settings[ast-dynamic-archive-' + postType + '-title-font-family]', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] h1, body.archive .ast-archive-description h1, body .ast-archive-entry-banner[data-post-type="' + postType + '"] h1 *, body.archive .ast-archive-description h1 *' ); astra_generate_font_weight_css( 'astra-settings[ast-dynamic-archive-' + postType + '-title-font-family]', 'astra-settings[ast-dynamic-archive-' + postType + '-title-font-weight]', 'font-weight', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] h1, body.archive .ast-archive-description h1, body .ast-archive-entry-banner[data-post-type="' + postType + '"] h1 *, body.archive .ast-archive-description h1 *' ); astra_css( 'astra-settings[ast-dynamic-archive-' + postType + '-title-font-weight]', 'font-weight', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container h1, body.archive .ast-archive-description h1, body .ast-archive-entry-banner[data-post-type="' + postType + '"] h1 *, body.archive .ast-archive-description h1 *' ); astra_responsive_font_size( 'astra-settings[ast-dynamic-archive-' + postType + '-title-font-size]', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container h1, body.archive .ast-archive-description .ast-archive-title, body .ast-archive-entry-banner[data-post-type="' + postType + '"] h1 *, body.archive .ast-archive-description .ast-archive-title *' ); astra_font_extras_css( 'ast-dynamic-archive-' + postType + '-title-font-extras', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container h1, body.archive .ast-archive-description .ast-archive-title, body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container h1 *, body.archive .ast-archive-description h1 *' ); // Banner - Text. astra_generate_outside_font_family_css( 'astra-settings[ast-dynamic-archive-' + postType + '-text-font-family]', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"], body .ast-archive-entry-banner[data-post-type="' + postType + '"] *, body.archive .ast-archive-description, body.archive .ast-archive-description *' ); astra_generate_font_weight_css( 'astra-settings[ast-dynamic-archive-' + postType + '-text-font-family]', 'astra-settings[ast-dynamic-archive-' + postType + '-text-font-weight]', 'font-weight', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"], body .ast-archive-entry-banner[data-post-type="' + postType + '"] *, body.archive .ast-archive-description, body.archive .ast-archive-description *' ); astra_css( 'astra-settings[ast-dynamic-archive-' + postType + '-text-font-weight]', 'font-weight', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"], body .ast-archive-entry-banner[data-post-type="' + postType + '"] *, body.archive .ast-archive-description, body.archive .ast-archive-description *' ); astra_responsive_font_size( 'astra-settings[ast-dynamic-archive-' + postType + '-text-font-size]', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"], body .ast-archive-entry-banner[data-post-type="' + postType + '"] *, body.archive .ast-archive-description, body.archive .ast-archive-description *' ); astra_font_extras_css( 'ast-dynamic-archive-' + postType + '-text-font-extras', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container *, body.archive .ast-archive-description *' ); } } )( jQuery ); class-astra-posts-structure-markup.php 0000666 00000016772 15165765150 0014227 0 ustar 00 <?php /** * Hero section layout for Astra theme. * * @package Astra * @author Brainstorm Force * @copyright Copyright (c) 2022, Brainstorm Force * @link https://www.brainstormforce.com * @since Astra 4.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Breadcrumbs Markup Initial Setup * * @since 4.0.0 */ class Astra_Posts_Structure_Markup { /** * Constructor */ public function __construct() { $astra_banner_hook = apply_filters( 'astra_banner_hook', 'astra_content_before' ); add_action( esc_attr( $astra_banner_hook ), array( $this, 'astra_add_hero_section_markup' ), 99 ); } /** * Check eligibility to override default entry header. * * @since 4.0.0 * @return void */ public function astra_add_hero_section_markup() { if ( apply_filters( 'astra_apply_hero_header_banner', true ) ) { $this->override_entry_header(); } } /** * Support custom title & description support for archive. * * @param string $title Default archive title. * @since 4.0.0 * @return string */ public function astra_archive_custom_title( $title ) { $post_type = strval( get_post_type() ); $custom_title = astra_get_option( 'ast-dynamic-archive-' . $post_type . '-custom-title', '' ); $title = ! empty( $custom_title ) ? $custom_title : $title; return $title; } /** * Override default entry header. * * @since 4.0.0 * @return void */ public function override_entry_header() { global $post; if ( is_null( $post ) ) { return; } $post_type = $post->post_type; $type = is_singular( $post_type ) ? 'single' : 'archive'; $supported_post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); if ( ! in_array( $post_type, $supported_post_types ) ) { return; } $layout_type = ( 'single' === $type ) ? astra_get_option( 'ast-dynamic-single-' . $post_type . '-layout', 'layout-1' ) : astra_get_option( 'ast-dynamic-archive-' . $post_type . '-layout', 'layout-1' ); // If banner title section is disabled then halt further processing. if ( 'single' === $type ) { if ( false === astra_get_option( 'ast-single-' . $post_type . '-title', ( class_exists( 'WooCommerce' ) && 'product' === $post_type ) ? false : true ) ) { add_filter( 'astra_single_layout_one_banner_visibility', '__return_false' ); return; } $visibility = get_post_meta( absint( astra_get_post_id() ), 'ast-banner-title-visibility', true ); $visibility = apply_filters( 'astra_banner_title_area_visibility', $visibility ); if ( 'disabled' === $visibility ) { add_filter( 'astra_single_layout_one_banner_visibility', '__return_false' ); return; } } else { // If layout-1 is set then no need to process further. if ( false === astra_get_option( 'ast-archive-' . $post_type . '-title', ( class_exists( 'WooCommerce' ) && 'product' === $post_type ) ? false : true ) ) { add_filter( 'astra_the_title_enabled', '__return_false' ); return; } if ( 'layout-1' === $layout_type ) { // WooCommerce specific compatibility - As layout-1 support needs to add externally. if ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_taxonomy() ) ) { $this->astra_woocommerce_banner_layout_1_compatibility(); add_action( 'astra_primary_content_top', array( $this, 'astra_force_render_banner_layout_1' ) ); } return; } add_filter( 'astra_the_title_enabled', '__return_false' ); } if ( 'single' === $type && 'layout-2' === $layout_type ) { do_action( 'astra_before_single_' . $post_type . '_banner_content' ); get_template_part( 'template-parts/single-banner' ); do_action( 'astra_after_single_' . $post_type . '_banner_content' ); add_filter( 'astra_remove_entry_header_content', '__return_true' ); add_filter( 'astra_single_layout_one_banner_visibility', '__return_false' ); } elseif ( ( is_front_page() && is_home() ) || ( is_home() ) ) { if ( true === astra_get_option( 'ast-dynamic-archive-post-banner-on-blog', false ) ) { // For latest posts page. add_filter( 'astra_the_default_home_page_title', array( $this, 'astra_archive_custom_title' ) ); // For blog page. add_filter( 'astra_the_blog_home_page_title', array( $this, 'astra_archive_custom_title' ) ); do_action( 'astra_before_archive_' . $post_type . '_banner_content' ); get_template_part( 'template-parts/archive-banner' ); do_action( 'astra_after_archive_' . $post_type . '_banner_content' ); remove_filter( 'astra_the_default_home_page_title', array( $this, 'astra_archive_custom_title' ) ); remove_filter( 'astra_the_blog_home_page_title', array( $this, 'astra_archive_custom_title' ) ); } } elseif ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_taxonomy() ) ) { $this->astra_woocommerce_banner_layout_1_compatibility(); do_action( 'astra_before_archive_' . $post_type . '_banner_content' ); get_template_part( 'template-parts/archive-banner' ); do_action( 'astra_after_archive_' . $post_type . '_banner_content' ); if ( is_shop() ) { remove_filter( 'woocommerce_page_title', array( $this, 'astra_archive_custom_title' ) ); } } elseif ( class_exists( 'WooCommerce' ) && 'single' === $type && 'product' === $post_type && 'layout-1' === $layout_type ) { // Adding layout 1 support to Product post type for single layout. add_action( 'astra_primary_content_top', array( $this, 'astra_force_render_banner_layout_1' ) ); } elseif ( 'archive' === $type ) { $is_post_type_archive = is_post_type_archive( $post_type ) ? true : false; if ( $is_post_type_archive ) { add_filter( 'get_the_archive_title', array( $this, 'astra_archive_custom_title' ) ); } do_action( 'astra_before_archive_' . $post_type . '_banner_content' ); get_template_part( 'template-parts/archive-banner' ); do_action( 'astra_after_archive_' . $post_type . '_banner_content' ); if ( $is_post_type_archive ) { remove_filter( 'get_the_archive_title', array( $this, 'astra_archive_custom_title' ) ); } } } /** * Layout 1 will also needed for WooCommerce product. * Case: WooCommerce by default adds "Shop" title, breadcrumb on shop/product-archive frontend, but this should also get linked to banner layout 1. * * @since 4.0.0 * @return void */ public function astra_woocommerce_banner_layout_1_compatibility() { // For custom title page. if ( is_shop() ) { add_filter( 'woocommerce_page_title', array( $this, 'astra_archive_custom_title' ) ); } add_filter( 'woocommerce_show_page_title', '__return_false' ); remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 ); remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description' ); remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description' ); } /** * Enable layout 1 for some cases. Ex. WC Product. * * @since 4.0.0 * @return void */ public function astra_force_render_banner_layout_1() { $is_singular = is_singular() ? true : false; if ( $is_singular ) { ?> <header class="entry-header <?php astra_entry_header_class(); ?>"> <?php astra_single_header_top(); } else { ?> <section class="ast-archive-description"> <?php do_action( 'astra_before_archive_title' ); } astra_banner_elements_order(); if ( $is_singular ) { ?> </header> <!-- .entry-header --> <?php astra_single_header_bottom(); } else { ?> </section> <?php do_action( 'astra_after_archive_title' ); } } } new Astra_Posts_Structure_Markup();
| ver. 1.4 |
Github
|
.
| PHP 5.4.45 | Generation time: 0 |
proxy
|
phpinfo
|
Settings