#js&&****&……posts-structures/class-astra-post-structures.php000064400000002400150322706750016272 0ustar00 $special_type ) { $title_section = 'section-' . $special_type . '-page-title'; $layout_type = astra_get_option( $title_section . '-layout', 'layout-1' ); $layout_2_active = ( 'layout-2' === $layout_type ) ? true : false; if ( $layout_2_active ) { $selector = '.search .ast-archive-entry-banner'; } else { $selector = '.search .ast-archive-description'; } $horizontal_alignment = astra_get_option( $title_section . '-horizontal-alignment' ); $desk_h_alignment = ( isset( $horizontal_alignment['desktop'] ) ) ? $horizontal_alignment['desktop'] : ''; $tab_h_alignment = ( isset( $horizontal_alignment['tablet'] ) ) ? $horizontal_alignment['tablet'] : ''; $mob_h_alignment = ( isset( $horizontal_alignment['mobile'] ) ) ? $horizontal_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( $title_section . '-elements-gap', 10 ); $banner_padding = astra_get_option( $title_section . '-banner-padding', Astra_Posts_Structure_Loader::get_customizer_default( 'responsive-padding' ) ); $banner_margin = astra_get_option( $title_section . '-banner-margin' ); $banner_height = astra_get_option( $title_section . '-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( $title_section . '-banner-text-color' ); $title_color = astra_get_option( $title_section . '-banner-title-color' ); $link_color = astra_get_option( $title_section . '-banner-link-color' ); $link_hover_color = astra_get_option( $title_section . '-banner-link-hover-color' ); $vert_alignment = ( $layout_2_active ) ? astra_get_option( $title_section . '-vertical-alignment', 'center' ) : 'center'; $width_type = astra_get_option( $title_section . '-banner-width-type', 'fullwidth' ); $custom_width = astra_get_option( $title_section . '-banner-custom-width', 1200 ); $background_type = astra_get_option( $title_section . '-banner-image-type', 'none' ); // Banner Text typography dynamic stylings. $banner_text_font_size = astra_get_option( $title_section . '-text-font-size' ); // Banner Title typography dynamic stylings. $banner_title_font_size = astra_get_option( $title_section . '-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( $title_section . '-text-font-family' ), astra_get_option( $title_section . '-text-font-weight' ), $banner_text_font_size, $title_section . '-text-font-extras', $text_color ), $selector . ' h1, ' . $selector . ' h1 *' => astra_get_font_array_css( astra_get_option( $title_section . '-title-font-family' ), astra_get_option( $title_section . '-title-font-weight', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-weight' ) ), $banner_title_font_size, $title_section . '-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 . ' 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, '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 ( 'none' !== $background_type ) { $custom_background = astra_get_option( $title_section . '-banner-custom-bg' ); $css_output_desktop['.search section.ast-archive-description'] = astra_get_responsive_background_obj( $custom_background, 'desktop' ); $css_output_tablet['.search section.ast-archive-description'] = astra_get_responsive_background_obj( $custom_background, 'tablet' ); $css_output_mobile['.search section.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' ), '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' => array( 'width' => '100%', ), $selector . ' .ast-container *' => astra_get_font_array_css( astra_get_option( $title_section . '-text-font-family' ), astra_get_option( $title_section . '-text-font-weight' ), $banner_text_font_size, $title_section . '-text-font-extras', $text_color ), $selector . ' .ast-container h1, ' . $selector . ' .ast-container h1 *' => astra_get_font_array_css( astra_get_option( $title_section . '-title-font-family' ), astra_get_option( $title_section . '-title-font-weight', Astra_Posts_Structure_Loader::get_customizer_default( 'title-font-weight' ) ), $banner_title_font_size, $title_section . '-title-font-extras', $title_color ), $selector . ' .ast-container h1' => array( 'margin-bottom' => '0', ), '.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 . ' .ast-container 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 . ' .ast-container 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 ( 'custom' === $background_type ) { $custom_background = astra_get_option( $title_section . '-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' ); } } /* 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() ); } $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; } '; } return $dynamic_css; } posts-structures/css/archive-dynamic.css.php000064400000053703150322707000015274 0ustar00 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 section.ast-archive-description'] = astra_get_responsive_background_obj( $custom_background, 'desktop' ); $css_output_tablet['.archive section.ast-archive-description'] = astra_get_responsive_background_obj( $custom_background, 'tablet' ); $css_output_mobile['.archive section.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 section.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 section.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 section.ast-archive-description']['background'] = 'url( ' . esc_url( $feat_image_src ) . ' ) ' . $overlay_color; $css_output_desktop['.archive section.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 section.ast-archive-description'] = astra_get_responsive_background_obj( $custom_background, 'desktop' ); $css_output_tablet['.archive section.ast-archive-description'] = astra_get_responsive_background_obj( $custom_background, 'tablet' ); $css_output_mobile['.archive section.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' ), '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' => array( 'width' => '100%', ), $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', ), $selector . ' .ast-container > *:last-child' => array( 'margin-bottom' => '0', ), ); /** * 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 . ' .ast-container 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 . ' .ast-container 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(); $feat_image_src = ''; // Checking if the is_shop function and wc_get_page_id are callable. if ( is_callable( 'is_shop' ) && is_shop() && is_callable( 'wc_get_page_id' ) ) { $shop_page_id = wc_get_page_id( 'shop' ); // Retrieving the featured image URL of the shop page. $feat_image_src = get_the_post_thumbnail_url( $shop_page_id ); } // Checking if we are in a taxonomy (category/archive) page. 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 ); } // Apply the background if a featured image is set. 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', ); // Apply overlay if set. 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'; } } elseif ( '' !== $overlay_color ) { // If no featured image is set, apply only the overlay color. $css_output_desktop[ $selector . '[data-banner-background-type="featured"]' ]['background'] = $overlay_color; } } } } } $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; } posts-structures/css/single-dynamic.css.php000064400000071436150322707010015140 0ustar00 array( // Margin CSS. 'margin-top' => astra_responsive_spacing( $margin, 'top', 'desktop' ), 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'desktop' ), 'margin-left' => astra_responsive_spacing( $margin, 'left', 'desktop' ), 'margin-right' => astra_responsive_spacing( $margin, 'right', 'desktop' ), ), $padding_selector => array( // Padding CSS. 'padding-top' => astra_responsive_spacing( $padding, 'top', 'desktop' ), 'padding-bottom' => astra_responsive_spacing( $padding, 'bottom', 'desktop' ), 'padding-left' => astra_responsive_spacing( $padding, 'left', 'desktop' ), 'padding-right' => astra_responsive_spacing( $padding, 'right', 'desktop' ), ), ); // Tablet CSS. $css_output_tablet = array( $margin_selector => array( // Margin CSS. 'margin-top' => astra_responsive_spacing( $margin, 'top', 'tablet' ), 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'tablet' ), 'margin-left' => astra_responsive_spacing( $margin, 'left', 'tablet' ), 'margin-right' => astra_responsive_spacing( $margin, 'right', 'tablet' ), ), $padding_selector => array( // Padding CSS. 'padding-top' => astra_responsive_spacing( $padding, 'top', 'tablet' ), 'padding-bottom' => astra_responsive_spacing( $padding, 'bottom', 'tablet' ), 'padding-left' => astra_responsive_spacing( $padding, 'left', 'tablet' ), 'padding-right' => astra_responsive_spacing( $padding, 'right', 'tablet' ), ), ); // Mobile CSS. $css_output_mobile = array( $margin_selector => array( // Margin CSS. 'margin-top' => astra_responsive_spacing( $margin, 'top', 'mobile' ), 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'mobile' ), 'margin-left' => astra_responsive_spacing( $margin, 'left', 'mobile' ), 'margin-right' => astra_responsive_spacing( $margin, 'right', 'mobile' ), ), $padding_selector => array( // Padding CSS. 'padding-top' => astra_responsive_spacing( $padding, 'top', 'mobile' ), 'padding-bottom' => astra_responsive_spacing( $padding, 'bottom', 'mobile' ), 'padding-left' => astra_responsive_spacing( $padding, 'left', 'mobile' ), 'padding-right' => astra_responsive_spacing( $padding, 'right', 'mobile' ), ), ); $css_output = astra_parse_css( $css_output_desktop ); $css_output .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() ); $css_output .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() ); $dynamic_css .= $css_output; 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; } $site_content_width = astra_get_option( 'site-content-width', 1200 ); $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' ) ); // 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 ) ); $author_avatar_size = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-author-avatar-size' ); // Aspect ratio. $aspect_ratio_type = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-article-featured-image-ratio-type', 'predefined' ); $predefined_scale = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-article-featured-image-ratio-pre-scale', '16/9' ); $custom_scale_width = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-article-featured-image-custom-scale-width', 16 ); $custom_scale_height = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-article-featured-image-custom-scale-height', 9 ); $aspect_ratio = astra_get_dynamic_image_aspect_ratio( $aspect_ratio_type, $predefined_scale, $custom_scale_width, $custom_scale_height ); $object_fit_style = 'custom' === $aspect_ratio_type ? 'cover' : ''; // Remove featured image padding. $remove_featured_image_padding = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-remove-featured-padding', false ) && 'layout-1' === $layout_type && 'none' === astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-article-featured-image-position-layout-1' ) ? true : false; // Few settings from banner section are also applicable to 'layout-1' so adding this condition & compatibility. if ( 'layout-1' === $layout_type ) { $image_wrap_alignment = Astra_Dynamic_CSS::astra_4_4_0_compatibility() ? 'center' : ''; /** * 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', ), $selector . ' .post-thumb-img-content' => array( 'text-align' => $image_wrap_alignment, ), $selector . ' .post-thumb img, .ast-single-post-featured-section.post-thumb img' => array( 'aspect-ratio' => $aspect_ratio, 'width' => Astra_Dynamic_CSS::astra_4_6_0_compatibility() && 'default' !== $aspect_ratio_type ? '100%' : '', 'height' => Astra_Dynamic_CSS::astra_4_6_0_compatibility() && 'default' !== $aspect_ratio_type ? '100%' : '', 'object-fit' => $object_fit_style, ), ); /** * 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' ), ), ); if ( $remove_featured_image_padding ) { $single_post_container_spacing = astra_get_option( 'single-post-inside-spacing' ); $container_padding_defaults = Astra_Dynamic_CSS::astra_4_6_0_compatibility() && is_single() ? '2.5em' : '3em'; $container_lg_horz_spacing = ( true === astra_check_is_structural_setup() ) ? $container_padding_defaults : '6.67'; $container_lg_vert_spacing = ( true === astra_check_is_structural_setup() ) ? $container_padding_defaults : '5.34'; $astra_desktop_container_left_spacing = defined( 'ASTRA_EXT_VER' ) && astra_responsive_spacing( $single_post_container_spacing, 'left', 'desktop' ) ? astra_responsive_spacing( $single_post_container_spacing, 'left', 'desktop', $container_lg_horz_spacing ) : 'var(--ast-container-default-xlg-padding)'; $astra_desktop_container_right_spacing = defined( 'ASTRA_EXT_VER' ) && astra_responsive_spacing( $single_post_container_spacing, 'right', 'desktop' ) ? astra_responsive_spacing( $single_post_container_spacing, 'right', 'desktop', $container_lg_horz_spacing ) : 'var(--ast-container-default-xlg-padding)'; $astra_desktop_container_top_spacing = defined( 'ASTRA_EXT_VER' ) && astra_responsive_spacing( $single_post_container_spacing, 'right', 'desktop' ) ? astra_responsive_spacing( $single_post_container_spacing, 'right', 'desktop', $container_lg_vert_spacing ) : 'var(--ast-container-default-xlg-padding)'; $astra_tablet_container_left_spacing = defined( 'ASTRA_EXT_VER' ) && astra_responsive_spacing( $single_post_container_spacing, 'left', 'tablet' ) ? astra_responsive_spacing( $single_post_container_spacing, 'left', 'tablet', $container_lg_horz_spacing ) : 'var(--ast-container-default-xlg-padding)'; $astra_tablet_container_right_spacing = defined( 'ASTRA_EXT_VER' ) && astra_responsive_spacing( $single_post_container_spacing, 'right', 'tablet' ) ? astra_responsive_spacing( $single_post_container_spacing, 'right', 'tablet', $container_lg_horz_spacing ) : 'var(--ast-container-default-xlg-padding)'; $astra_tablet_container_top_spacing = defined( 'ASTRA_EXT_VER' ) && astra_responsive_spacing( $single_post_container_spacing, 'right', 'tablet' ) ? astra_responsive_spacing( $single_post_container_spacing, 'right', 'tablet', $container_lg_vert_spacing ) : 'var(--ast-container-default-xlg-padding)'; $astra_mobile_container_left_spacing = defined( 'ASTRA_EXT_VER' ) && astra_responsive_spacing( $single_post_container_spacing, 'left', 'mobile' ) ? astra_responsive_spacing( $single_post_container_spacing, 'left', 'mobile', $container_lg_horz_spacing ) : '1em'; $astra_mobile_container_right_spacing = defined( 'ASTRA_EXT_VER' ) && astra_responsive_spacing( $single_post_container_spacing, 'right', 'mobile' ) ? astra_responsive_spacing( $single_post_container_spacing, 'right', 'mobile', $container_lg_horz_spacing ) : '1em'; $astra_mobile_container_top_spacing = defined( 'ASTRA_EXT_VER' ) && astra_responsive_spacing( $single_post_container_spacing, 'right', 'mobile' ) ? astra_responsive_spacing( $single_post_container_spacing, 'right', 'mobile', $container_lg_vert_spacing ) : '1.5em'; $css_output_desktop[ '.ast-separate-container ' . $selector . ' .post-thumb' ]['margin-left'] = $astra_desktop_container_left_spacing ? 'calc( -1 * ' . $astra_desktop_container_left_spacing . ' )' : ''; $css_output_desktop[ '.ast-separate-container ' . $selector . ' > *:first-child.post-thumb' ]['margin-top'] = $astra_desktop_container_top_spacing ? 'calc( -1 * ' . $astra_desktop_container_top_spacing . ' )' : ''; $css_output_desktop[ '.ast-separate-container ' . $selector . ' .post-thumb' ]['margin-right'] = $astra_desktop_container_right_spacing ? 'calc( -1 * ' . $astra_desktop_container_right_spacing . ' )' : ''; $css_output_tablet[ '.ast-separate-container ' . $selector . ' .post-thumb' ]['margin-left'] = $astra_tablet_container_left_spacing ? 'calc( -1 * ' . $astra_tablet_container_left_spacing . ' )' : ''; $css_output_tablet[ '.ast-separate-container ' . $selector . ' > *:first-child.post-thumb' ]['margin-top'] = $astra_tablet_container_top_spacing ? 'calc( -1 * ' . $astra_tablet_container_top_spacing . ' )' : ''; $css_output_tablet[ '.ast-separate-container ' . $selector . ' .post-thumb' ]['margin-right'] = $astra_tablet_container_right_spacing ? 'calc( -1 * ' . $astra_tablet_container_right_spacing . ' )' : ''; $css_output_mobile[ '.ast-separate-container ' . $selector . ' .post-thumb' ]['margin-left'] = $astra_mobile_container_left_spacing ? 'calc( -1 * ' . $astra_mobile_container_left_spacing . ' )' : ''; $css_output_mobile[ '.ast-separate-container ' . $selector . ' > *:first-child.post-thumb' ]['margin-top'] = $astra_mobile_container_top_spacing ? 'calc( -1 * ' . $astra_mobile_container_top_spacing . ' )' : ''; $css_output_mobile[ '.ast-separate-container ' . $selector . ' .post-thumb' ]['margin-right'] = $astra_mobile_container_right_spacing ? 'calc( -1 * ' . $astra_mobile_container_right_spacing . ' )' : ''; } } else { $entry_title_selector = is_customize_preview() ? $selector . ' .ast-container .entry-title' : $selector . ' .entry-title'; $image_position = astra_get_option( 'ast-dynamic-single-' . $current_post_type . '-image-position', 'inside' ); $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' ) ); /** * 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' ), '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), ' . $selector . ' .read-more' => array( 'margin-bottom' => $elements_gap . 'px', ), $selector . ' .ast-container' => array( '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 ), ), '.ast-single-entry-banner .read-more .ast-button' => array( 'margin-top' => '0.5em', 'display' => 'inline-block', ), $selector . ' .post-thumb img, .ast-single-post-featured-section img' => array( 'aspect-ratio' => $aspect_ratio, 'width' => Astra_Dynamic_CSS::astra_4_6_0_compatibility() && 'default' !== $aspect_ratio_type ? '100%' : '', 'height' => Astra_Dynamic_CSS::astra_4_6_0_compatibility() && 'default' !== $aspect_ratio_type ? '100%' : '', 'object-fit' => $object_fit_style, ), $selector . ' .ast-container > *:last-child' => array( 'margin-bottom' => '0', ), ); /** * 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 ( 'outside' !== $image_position && 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'; } } } if ( 'outside' === $image_position ) { $css_output_desktop['.single article .post-thumb'] = array( 'margin-bottom' => '2em', ); } } $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; } .site .ast-author-avatar { --ast-author-avatar-size: ' . astra_get_css_value( $author_avatar_size, 'px' ) . '; } a.ast-underline-text { text-decoration: underline; } .ast-container > .ast-terms-link { position: relative; display: block; } a.ast-button.ast-badge-tax { padding: 4px 8px; border-radius: 3px; font-size: inherit; } '; 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; } '; } $margin_top = astra_responsive_spacing( $margin, 'top', 'desktop' ); // To add top spacing for SureCart shop page default title. if ( class_exists( 'SureCart' ) && $margin_top && 0 === intval( $margin_top ) && get_the_ID() === intval( get_option( 'surecart_shop_page_id' ) ) ) { $dynamic_css .= ' .page .entry-header { margin-top: 3em; } '; } /* 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; } posts-structures/class-astra-posts-structure-loader.php000064400000025011150322707010017527 0ustar00 array( 'background-color' => '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', 'overlay-type' => '', 'overlay-color' => '', 'overlay-opacity' => '', '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-opacity' => '', '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-opacity' => '', '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 ); } foreach ( self::get_special_page_types() as $index => $special_type ) { $title_section = 'section-' . $special_type . '-page-title'; $instance_text_font_family = astra_get_option( $title_section . '-text-font-family' ); $instance_text_font_weight = astra_get_option( $title_section . '-text-font-weight' ); Astra_Fonts::add_font( $instance_text_font_family, $instance_text_font_weight ); $instance_title_font_family = astra_get_option( $title_section . '-title-font-family' ); $instance_title_font_weight = astra_get_option( $title_section . '-title-font-weight' ); Astra_Fonts::add_font( $instance_title_font_family, $instance_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'; require_once ASTRA_THEME_POST_STRUCTURE_DIR . 'customizer/class-astra-posts-special-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() ) { self::$supported_post_types = astra_get_queried_post_types(); // If Elementor is active, reindex the array. if ( defined( 'ELEMENTOR_VERSION' ) ) { self::$supported_post_types = array_values( self::$supported_post_types ); } } return apply_filters( 'astra_dynamic_post_structure_posttypes', self::$supported_post_types ); } /** * Get special pages query. * * @since 4.6.0 * @return array $special_pages */ public static function get_special_page_types() { $special_pages = array( 'search', ); return apply_filters( 'astra_dynamic_special_pages', $special_pages ); } /** * 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(), 'special_pages' => self::get_special_page_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(); posts-structures/assets/js/unminified/customizer-preview.js000064400000101321150322707010020416 0ustar00/** * 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 ' ); } 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 || [], specialsTypesCount = AstraPostStrcturesData.special_pages.length || false, specialsTypes = AstraPostStrcturesData.special_pages || [], 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'; } let singleSectionID = '', bodyPostTypeClass = 'single-' + postType; if ( 'post' !== postType ) { if ( 'product' === postType ) { singleSectionID = 'section-woo-shop-single'; } else if ( 'page' === postType ) { bodyPostTypeClass = 'page'; singleSectionID = 'section-single-page'; } else if ( 'download' === postType ) { singleSectionID = 'section-edd-single'; } else { singleSectionID = 'single-posttype-' . postType; } astra_responsive_spacing( 'astra-settings[' + singleSectionID + '-padding]', 'body.' + bodyPostTypeClass + ' .site .site-content #primary .ast-article-single', 'padding', ['top', 'right', 'bottom', 'left' ] ); astra_responsive_spacing( 'astra-settings[' + singleSectionID + '-margin]', 'body.' + bodyPostTypeClass + ' .site .site-content #primary', 'margin', ['top', 'right', 'bottom', 'left' ] ); } 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_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-taxonomy-style]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-taxonomy-1-style]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-taxonomy-2-style]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-author-avatar]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-structural-taxonomy]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-structural-taxonomy-style]' ); wp.customize( 'astra-settings[ast-dynamic-single-' + postType + '-author-avatar-size]', function( value ) { value.bind( function( size ) { var dynamicStyle = ''; dynamicStyle += '.site .ast-author-avatar img {'; dynamicStyle += 'width: ' + size + 'px;'; dynamicStyle += 'height: ' + size + 'px;'; dynamicStyle += '} '; astra_add_dynamic_css( 'ast-dynamic-single-' + postType + '-author-avatar-size', dynamicStyle ); } ); } ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-article-featured-image-position-layout-1]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-article-featured-image-position-layout-2]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-article-featured-image-width-type]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-article-featured-image-ratio-type]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-article-featured-image-ratio-pre-scale]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-article-featured-image-custom-scale-width]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-article-featured-image-custom-scale-height]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-article-featured-image-size]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-remove-featured-padding]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-metadata-separator]' ); astra_refresh_customizer( 'astra-settings[ast-dynamic-single-' + postType + '-author-prefix-label]' ); 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_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_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), header.entry-header .read-more, body .ast-single-entry-banner[data-post-type="' + postType + '"] .ast-container .read-more', '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', layout1BodySelector = 'sc_product' === postType ? 'body.page' : 'body.archive'; if( 'layout-2' === layoutType ) { var selector = 'body .ast-archive-entry-banner[data-post-type="' + postType + '"]'; } else if( 'layout-1' === layoutType ) { var selector = '' + layout1BodySelector + ' .ast-archive-description'; } else { var selector = 'body .ast-archive-entry-banner[data-post-type="' + postType + '"], ' + layout1BodySelector + ' .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', '' + layout1BodySelector + ' .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 *, ' + layout1BodySelector + ' .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, ' + layout1BodySelector + ' .ast-archive-description .ast-archive-title, body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container h1 *, ' + layout1BodySelector + ' .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, ' + layout1BodySelector + ' .ast-archive-description a, body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container a *, ' + layout1BodySelector + ' .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, ' + layout1BodySelector + ' .ast-archive-description a:hover, body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container a:hover *, ' + layout1BodySelector + ' .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 + '"][data-banner-background-type="custom"], ' + layout1BodySelector + ' .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 + '"][data-banner-background-type="custom"], ' + layout1BodySelector + ' .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 + '"][data-banner-background-type="custom"], ' + layout1BodySelector + ' .ast-archive-description', 'mobile' ); astra_responsive_spacing( 'astra-settings[ast-dynamic-archive-' + postType + '-banner-padding]', 'body .ast-archive-entry-banner[data-post-type="' + postType + '"], ' + layout1BodySelector + ' .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 + '"], ' + layout1BodySelector + ' .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, ' + layout1BodySelector + ' .ast-archive-description h1, body .ast-archive-entry-banner[data-post-type="' + postType + '"] h1 *, ' + layout1BodySelector + ' .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, ' + layout1BodySelector + ' .ast-archive-description h1, body .ast-archive-entry-banner[data-post-type="' + postType + '"] h1 *, ' + layout1BodySelector + ' .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, ' + layout1BodySelector + ' .ast-archive-description h1, body .ast-archive-entry-banner[data-post-type="' + postType + '"] h1 *, ' + layout1BodySelector + ' .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, ' + layout1BodySelector + ' .ast-archive-description .ast-archive-title, body .ast-archive-entry-banner[data-post-type="' + postType + '"] h1 *, ' + layout1BodySelector + ' .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, ' + layout1BodySelector + ' .ast-archive-description .ast-archive-title, body .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container h1 *, ' + layout1BodySelector + ' .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 + '"] *, ' + layout1BodySelector + ' .ast-archive-description, ' + layout1BodySelector + ' .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 + '"] *, ' + layout1BodySelector + ' .ast-archive-description, ' + layout1BodySelector + ' .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 + '"] *, ' + layout1BodySelector + ' .ast-archive-description, ' + layout1BodySelector + ' .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 + '"] *, ' + layout1BodySelector + ' .ast-archive-description, ' + layout1BodySelector + ' .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 *, ' + layout1BodySelector + ' .ast-archive-description *' ); } /** * For special pages. */ for ( var index = 0; index < specialsTypesCount; index++ ) { var postType = specialsTypes[ index ], sectionKey = 'section-' + postType + '-page-title', sectionAstraSettingKey = 'astra-settings[' + sectionKey, layoutType = ( undefined !== wp.customize( sectionAstraSettingKey + '-layout]' ) ) ? wp.customize( sectionAstraSettingKey + '-layout]' ).get() : 'both', selector = '.search .ast-archive-entry-banner, .search .ast-archive-description'; astra_refresh_customizer( sectionAstraSettingKey + '-custom-title]' ); astra_refresh_customizer( sectionAstraSettingKey + '-custom-description]' ); astra_dynamic_build_css( sectionKey + '-horizontal-alignment', sectionAstraSettingKey + '-horizontal-alignment]', 'text-align', selector ); astra_dynamic_build_css( sectionKey + '-banner-height', sectionAstraSettingKey + '-banner-height]', 'min-height', selector, 'px' ); wp.customize( sectionAstraSettingKey + 'banner-width-type]', function( value ) { value.bind( function( type ) { if ( 'custom' === type ) { jQuery(selector).attr( 'data-banner-width-type', 'custom' ); var customWidthSize = wp.customize( sectionAstraSettingKey + 'banner-custom-width]' ).get(), dynamicStyle = ''; dynamicStyle += selector + '[data-banner-width-type="custom"] {'; dynamicStyle += 'max-width: ' + customWidthSize + 'px;'; dynamicStyle += '} '; astra_add_dynamic_css( sectionKey + '-banner-width-type', dynamicStyle ); } else { jQuery(selector).attr( 'data-banner-width-type', 'full' ); } } ); } ); wp.customize( sectionAstraSettingKey + '-banner-height]', function( value ) { value.bind( function( size ) { if( size.desktop != '' || size.tablet != '' || size.mobile != '' ) { var dynamicStyle = ''; dynamicStyle += selector + ' {'; dynamicStyle += 'min-height: ' + size.desktop + 'px;'; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {'; dynamicStyle += selector + ' {'; dynamicStyle += 'min-height: ' + size.tablet + 'px;'; dynamicStyle += '} '; dynamicStyle += '} '; dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {'; dynamicStyle += selector + ' {'; dynamicStyle += 'min-height: ' + size.mobile + 'px;'; dynamicStyle += '} '; dynamicStyle += '} '; astra_add_dynamic_css( sectionKey + '-banner-height', dynamicStyle ); } } ); } ); astra_css( sectionAstraSettingKey + '-vertical-alignment]', 'justify-content', selector ); astra_css( sectionAstraSettingKey + '-banner-custom-width]', 'max-width', selector + '[data-banner-width-type="custom"]', 'px' ); astra_css( sectionAstraSettingKey + '-elements-gap]', 'margin-bottom', '.search .ast-archive-description > *:not(:last-child), .search .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container > *:not(:last-child)', 'px' ); astra_css( sectionAstraSettingKey + '-banner-text-color]', 'color', '.search .ast-archive-entry-banner .ast-container *, .search .ast-archive-description *' ); astra_css( sectionAstraSettingKey + '-banner-title-color]', 'color', '.search .ast-archive-entry-banner .ast-container h1, .search .ast-archive-description h1, .search .ast-archive-entry-banner .ast-container h1 *, .search .ast-archive-description h1 *' ); astra_css( sectionAstraSettingKey + '-banner-link-color]', 'color', selector + ' .ast-container a, ' + '.search .ast-archive-description a, .search .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container a *, ' + '.search .ast-archive-description a *' ); astra_css( sectionAstraSettingKey + '-banner-link-hover-color]', 'color', selector + ' .ast-container a:hover, ' + '.search .ast-archive-description a:hover, .search .ast-archive-entry-banner[data-post-type="' + postType + '"] .ast-container a:hover *, ' + '.search .ast-archive-description a:hover *' ); astra_apply_responsive_background_css( sectionAstraSettingKey + '-banner-custom-bg]', '.search .ast-archive-entry-banner[data-banner-background-type="custom"], .search .ast-archive-description', 'desktop' ); astra_apply_responsive_background_css( sectionAstraSettingKey + '-banner-custom-bg]', '.search .ast-archive-entry-banner[data-banner-background-type="custom"], .search .ast-archive-description', 'tablet' ); astra_apply_responsive_background_css( sectionAstraSettingKey + '-banner-custom-bg]', '.search .ast-archive-entry-banner[data-banner-background-type="custom"], .search .ast-archive-description', 'mobile' ); astra_responsive_spacing( sectionAstraSettingKey + '-banner-padding]', selector + ', ' + '.search .ast-archive-description', 'padding', ['top', 'right', 'bottom', 'left' ] ); astra_responsive_spacing( sectionAstraSettingKey + '-banner-margin]', selector + ', ' + '.search .ast-archive-description', 'margin', ['top', 'right', 'bottom', 'left' ] ); // Banner - Title. astra_generate_outside_font_family_css( sectionAstraSettingKey + '-title-font-family]', '.search .ast-archive-entry-banner .ast-container h1, .search .ast-archive-description h1, .search .ast-archive-description .ast-archive-title, .search .ast-archive-entry-banner .ast-container h1 *, .search .ast-archive-description h1 *' ); astra_generate_font_weight_css( sectionAstraSettingKey + '-title-font-family]', sectionAstraSettingKey + '-title-font-weight]', 'font-weight', '.search .ast-archive-entry-banner .ast-container h1, .search .ast-archive-description h1, .search .ast-archive-description .ast-archive-title, .search .ast-archive-entry-banner .ast-container h1 *, .search .ast-archive-description h1 *' ); astra_css( sectionAstraSettingKey + '-title-font-weight]', 'font-weight', '.search .ast-archive-entry-banner .ast-container h1, .search .ast-archive-description h1, .search .ast-archive-description .ast-archive-title, .search .ast-archive-entry-banner .ast-container h1 *, .search .ast-archive-description h1 *' ); astra_responsive_font_size( sectionAstraSettingKey + '-title-font-size]', '.search .ast-archive-entry-banner .ast-container h1, .search .ast-archive-description h1, .search .ast-archive-description .ast-archive-title, .search .ast-archive-entry-banner .ast-container h1 *, .search .ast-archive-description h1 *' ); astra_font_extras_css( sectionKey + '-title-font-extras', '.search .ast-archive-entry-banner .ast-container h1, .search .ast-archive-description h1, .search .ast-archive-description .ast-archive-title, .search .ast-archive-entry-banner .ast-container h1 *, .search .ast-archive-description h1 *' ); // Banner - Text. astra_generate_outside_font_family_css( sectionAstraSettingKey + '-text-font-family]', '.search .ast-archive-description *, .search .ast-archive-entry-banner .ast-container *' ); astra_generate_font_weight_css( sectionAstraSettingKey + '-text-font-family]', sectionAstraSettingKey + '-text-font-weight]', 'font-weight', '.search .ast-archive-description *, .search .ast-archive-entry-banner .ast-container *' ); astra_css( sectionAstraSettingKey + '-text-font-weight]', 'font-weight', '.search .ast-archive-description *, .search .ast-archive-entry-banner .ast-container *' ); astra_responsive_font_size( sectionAstraSettingKey + '-text-font-size]', '.search .ast-archive-description *, .search .ast-archive-entry-banner .ast-container *' ); astra_font_extras_css( sectionKey + '-text-font-extras', '.search .ast-archive-description *, .search .ast-archive-entry-banner .ast-container *' ); } } )( jQuery ); posts-structures/assets/js/minified/customizer-preview.min.js000064400000057532150322707010020653 0ustar00function astra_dynamic_build_css(r,n,i,c,t=!1){var o=AstraPostStrcturesData.tablet_break_point||768,d=AstraPostStrcturesData.mobile_break_point||544,y=t||"";wp.customize(n,function(t){t.bind(function(t){var a,e,s;t.desktop||t.mobile||t.tablet?(n=(n=n.replace("[","-")).replace("]",""),jQuery("style#"+n+"-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('")):jQuery("style#"+n+"-"+r).remove()})})}function astra_refresh_customizer(t){wp.customize(t,function(t){t.bind(function(t){wp.customize.preview.send("refresh")})})}(()=>{for(var t=AstraPostStrcturesData.post_types.length||!1,s=AstraPostStrcturesData.post_types||[],a=AstraPostStrcturesData.special_pages.length||!1,e=AstraPostStrcturesData.special_pages||[],r=AstraPostStrcturesData.tablet_break_point||768,n=AstraPostStrcturesData.mobile_break_point||544,i=0;i *:not(:last-child), body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container > *:not(:last-child), header.entry-header .read-more, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .read-more',"px"),astra_css("astra-settings[ast-dynamic-single-"+c+"-banner-text-color]","color",'header.entry-header *, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container *'),astra_css("astra-settings[ast-dynamic-single-"+c+"-banner-title-color]","color",'header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-title'),astra_css("astra-settings[ast-dynamic-single-"+c+"-banner-link-color]","color",'body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container a, header.entry-header a, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container a *, header.entry-header a *'),astra_css("astra-settings[ast-dynamic-single-"+c+"-banner-link-hover-color]","color",'body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container a:hover, header.entry-header a:hover, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container a:hover *, header.entry-header a:hover *'),astra_responsive_spacing("astra-settings[ast-dynamic-single-"+c+"-banner-padding]",'body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container',"padding",["top","right","bottom","left"]),astra_responsive_spacing("astra-settings[ast-dynamic-single-"+c+"-banner-margin]",'body .ast-single-entry-banner[data-post-type="'+c+'"]',"margin",["top","right","bottom","left"]),astra_generate_outside_font_family_css("astra-settings[ast-dynamic-single-"+c+"-title-font-family]",' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-title'),astra_generate_font_weight_css("astra-settings[ast-dynamic-single-"+c+"-title-font-family]","astra-settings[ast-dynamic-single-"+c+"-title-font-weight]","font-weight",' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-title'),astra_css("astra-settings[ast-dynamic-single-"+c+"-title-font-weight]","font-weight",' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-title'),astra_responsive_font_size("astra-settings[ast-dynamic-single-"+c+"-title-font-size]",' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-title'),astra_font_extras_css("ast-dynamic-single-"+c+"-title-font-extras",' header.entry-header .entry-title, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-title'),astra_generate_outside_font_family_css("astra-settings[ast-dynamic-single-"+c+"-text-font-family]",' header.entry-header *, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container *'),astra_generate_font_weight_css("astra-settings[ast-dynamic-single-"+c+"-text-font-family]","astra-settings[ast-dynamic-single-"+c+"-text-font-weight]","font-weight",' header.entry-header *, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container *'),astra_css("astra-settings[ast-dynamic-single-"+c+"-text-font-weight]","font-weight",' header.entry-header *, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container *'),astra_responsive_font_size("astra-settings[ast-dynamic-single-"+c+"-text-font-size]",' header.entry-header *, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container *'),astra_font_extras_css("ast-dynamic-single-"+c+"-text-font-extras",' header.entry-header *, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container *'),astra_generate_outside_font_family_css("astra-settings[ast-dynamic-single-"+c+"-meta-font-family]",' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-meta *'),astra_generate_font_weight_css("astra-settings[ast-dynamic-single-"+c+"-meta-font-family]","astra-settings[ast-dynamic-single-"+c+"-meta-font-weight]","font-weight",' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-meta *'),astra_css("astra-settings[ast-dynamic-single-"+c+"-meta-font-weight]","font-weight",' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-meta *'),astra_responsive_font_size("astra-settings[ast-dynamic-single-"+c+"-meta-font-size]",' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-meta *'),astra_font_extras_css("ast-dynamic-single-"+c+"-meta-font-extras",' header.entry-header .entry-meta, header.entry-header .entry-meta *, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-meta, body .ast-single-entry-banner[data-post-type="'+c+'"] .ast-container .entry-meta *')}for(i=0;i *:not(:last-child), body .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container > *:not(:last-child)',"px"),astra_css("astra-settings[ast-dynamic-archive-"+c+"-banner-text-color]","color",'body .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container *, '+y+" .ast-archive-description *"),astra_css("astra-settings[ast-dynamic-archive-"+c+"-banner-title-color]","color",'body .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container h1, '+y+' .ast-archive-description .ast-archive-title, body .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container h1 *, '+y+" .ast-archive-description .ast-archive-title *"),astra_css("astra-settings[ast-dynamic-archive-"+c+"-banner-link-color]","color",'body .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container a, '+y+' .ast-archive-description a, body .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container a *, '+y+" .ast-archive-description a *"),astra_css("astra-settings[ast-dynamic-archive-"+c+"-banner-link-hover-color]","color",'body .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container a:hover, '+y+' .ast-archive-description a:hover, body .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container a:hover *, '+y+" .ast-archive-description a:hover *"),astra_apply_responsive_background_css("astra-settings[ast-dynamic-archive-"+c+"-banner-custom-bg]",'body .ast-archive-entry-banner[data-post-type="'+c+'"][data-banner-background-type="custom"], '+y+" .ast-archive-description","desktop"),astra_apply_responsive_background_css("astra-settings[ast-dynamic-archive-"+c+"-banner-custom-bg]",'body .ast-archive-entry-banner[data-post-type="'+c+'"][data-banner-background-type="custom"], '+y+" .ast-archive-description","tablet"),astra_apply_responsive_background_css("astra-settings[ast-dynamic-archive-"+c+"-banner-custom-bg]",'body .ast-archive-entry-banner[data-post-type="'+c+'"][data-banner-background-type="custom"], '+y+" .ast-archive-description","mobile"),astra_responsive_spacing("astra-settings[ast-dynamic-archive-"+c+"-banner-padding]",'body .ast-archive-entry-banner[data-post-type="'+c+'"], '+y+" .ast-archive-description","padding",["top","right","bottom","left"]),astra_responsive_spacing("astra-settings[ast-dynamic-archive-"+c+"-banner-margin]",'body .ast-archive-entry-banner[data-post-type="'+c+'"], '+y+" .ast-archive-description","margin",["top","right","bottom","left"]),astra_generate_outside_font_family_css("astra-settings[ast-dynamic-archive-"+c+"-title-font-family]",'body .ast-archive-entry-banner[data-post-type="'+c+'"] h1, '+y+' .ast-archive-description h1, body .ast-archive-entry-banner[data-post-type="'+c+'"] h1 *, '+y+" .ast-archive-description h1 *"),astra_generate_font_weight_css("astra-settings[ast-dynamic-archive-"+c+"-title-font-family]","astra-settings[ast-dynamic-archive-"+c+"-title-font-weight]","font-weight",'body .ast-archive-entry-banner[data-post-type="'+c+'"] h1, '+y+' .ast-archive-description h1, body .ast-archive-entry-banner[data-post-type="'+c+'"] h1 *, '+y+" .ast-archive-description h1 *"),astra_css("astra-settings[ast-dynamic-archive-"+c+"-title-font-weight]","font-weight",'body .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container h1, '+y+' .ast-archive-description h1, body .ast-archive-entry-banner[data-post-type="'+c+'"] h1 *, '+y+" .ast-archive-description h1 *"),astra_responsive_font_size("astra-settings[ast-dynamic-archive-"+c+"-title-font-size]",'body .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container h1, '+y+' .ast-archive-description .ast-archive-title, body .ast-archive-entry-banner[data-post-type="'+c+'"] h1 *, '+y+" .ast-archive-description .ast-archive-title *"),astra_font_extras_css("ast-dynamic-archive-"+c+"-title-font-extras",'body .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container h1, '+y+' .ast-archive-description .ast-archive-title, body .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container h1 *, '+y+" .ast-archive-description h1 *"),astra_generate_outside_font_family_css("astra-settings[ast-dynamic-archive-"+c+"-text-font-family]",'body .ast-archive-entry-banner[data-post-type="'+c+'"], body .ast-archive-entry-banner[data-post-type="'+c+'"] *, '+y+" .ast-archive-description, "+y+" .ast-archive-description *"),astra_generate_font_weight_css("astra-settings[ast-dynamic-archive-"+c+"-text-font-family]","astra-settings[ast-dynamic-archive-"+c+"-text-font-weight]","font-weight",'body .ast-archive-entry-banner[data-post-type="'+c+'"], body .ast-archive-entry-banner[data-post-type="'+c+'"] *, '+y+" .ast-archive-description, "+y+" .ast-archive-description *"),astra_css("astra-settings[ast-dynamic-archive-"+c+"-text-font-weight]","font-weight",'body .ast-archive-entry-banner[data-post-type="'+c+'"], body .ast-archive-entry-banner[data-post-type="'+c+'"] *, '+y+" .ast-archive-description, "+y+" .ast-archive-description *"),astra_responsive_font_size("astra-settings[ast-dynamic-archive-"+c+"-text-font-size]",'body .ast-archive-entry-banner[data-post-type="'+c+'"], body .ast-archive-entry-banner[data-post-type="'+c+'"] *, '+y+" .ast-archive-description, "+y+" .ast-archive-description *"),astra_font_extras_css("ast-dynamic-archive-"+c+"-text-font-extras",'body .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container *, '+y+" .ast-archive-description *")}for(i=0;i *:not(:last-child), .search .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container > *:not(:last-child)',"px"),astra_css(p+"-banner-text-color]","color",".search .ast-archive-entry-banner .ast-container *, .search .ast-archive-description *"),astra_css(p+"-banner-title-color]","color",".search .ast-archive-entry-banner .ast-container h1, .search .ast-archive-description h1, .search .ast-archive-entry-banner .ast-container h1 *, .search .ast-archive-description h1 *"),astra_css(p+"-banner-link-color]","color",g+' .ast-container a, .search .ast-archive-description a, .search .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container a *, .search .ast-archive-description a *'),astra_css(p+"-banner-link-hover-color]","color",g+' .ast-container a:hover, .search .ast-archive-description a:hover, .search .ast-archive-entry-banner[data-post-type="'+c+'"] .ast-container a:hover *, .search .ast-archive-description a:hover *'),astra_apply_responsive_background_css(p+"-banner-custom-bg]",'.search .ast-archive-entry-banner[data-banner-background-type="custom"], .search .ast-archive-description',"desktop"),astra_apply_responsive_background_css(p+"-banner-custom-bg]",'.search .ast-archive-entry-banner[data-banner-background-type="custom"], .search .ast-archive-description',"tablet"),astra_apply_responsive_background_css(p+"-banner-custom-bg]",'.search .ast-archive-entry-banner[data-banner-background-type="custom"], .search .ast-archive-description',"mobile"),astra_responsive_spacing(p+"-banner-padding]",g+", .search .ast-archive-description","padding",["top","right","bottom","left"]),astra_responsive_spacing(p+"-banner-margin]",g+", .search .ast-archive-description","margin",["top","right","bottom","left"]),astra_generate_outside_font_family_css(p+"-title-font-family]",".search .ast-archive-entry-banner .ast-container h1, .search .ast-archive-description h1, .search .ast-archive-description .ast-archive-title, .search .ast-archive-entry-banner .ast-container h1 *, .search .ast-archive-description h1 *"),astra_generate_font_weight_css(p+"-title-font-family]",p+"-title-font-weight]","font-weight",".search .ast-archive-entry-banner .ast-container h1, .search .ast-archive-description h1, .search .ast-archive-description .ast-archive-title, .search .ast-archive-entry-banner .ast-container h1 *, .search .ast-archive-description h1 *"),astra_css(p+"-title-font-weight]","font-weight",".search .ast-archive-entry-banner .ast-container h1, .search .ast-archive-description h1, .search .ast-archive-description .ast-archive-title, .search .ast-archive-entry-banner .ast-container h1 *, .search .ast-archive-description h1 *"),astra_responsive_font_size(p+"-title-font-size]",".search .ast-archive-entry-banner .ast-container h1, .search .ast-archive-description h1, .search .ast-archive-description .ast-archive-title, .search .ast-archive-entry-banner .ast-container h1 *, .search .ast-archive-description h1 *"),astra_font_extras_css(h+"-title-font-extras",".search .ast-archive-entry-banner .ast-container h1, .search .ast-archive-description h1, .search .ast-archive-description .ast-archive-title, .search .ast-archive-entry-banner .ast-container h1 *, .search .ast-archive-description h1 *"),astra_generate_outside_font_family_css(p+"-text-font-family]",".search .ast-archive-description *, .search .ast-archive-entry-banner .ast-container *"),astra_generate_font_weight_css(p+"-text-font-family]",p+"-text-font-weight]","font-weight",".search .ast-archive-description *, .search .ast-archive-entry-banner .ast-container *"),astra_css(p+"-text-font-weight]","font-weight",".search .ast-archive-description *, .search .ast-archive-entry-banner .ast-container *"),astra_responsive_font_size(p+"-text-font-size]",".search .ast-archive-description *, .search .ast-archive-entry-banner .ast-container *"),astra_font_extras_css(h+"-text-font-extras",".search .ast-archive-description *, .search .ast-archive-entry-banner .ast-container *")}})(jQuery);posts-structures/class-astra-posts-structure-markup.php000064400000020171150322707010017562 0ustar00override_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 = astra_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() { if ( is_front_page() && 'page' === get_option( 'show_on_front' ) && astra_get_option( 'ast-dynamic-single-page-disable-structure-meta-on-front-page', false ) ) { return; } if ( is_search() ) { if ( true === astra_get_option( 'ast-search-page-title', true ) ) { if ( 'layout-2' === astra_get_option( 'section-search-page-title-layout', 'layout-1' ) ) { $type = 'search'; do_action( 'astra_before_archive_' . $type . '_banner_content' ); get_template_part( 'template-parts/special-banner' ); do_action( 'astra_after_archive_' . $type . '_banner_content' ); remove_action( 'astra_archive_header', 'astra_archive_page_info' ); return; } } else { add_filter( 'astra_the_title_enabled', '__return_false' ); return; } } $post_type = astra_get_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 ) { ?>
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 ); $_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(); posts-structures/customizer/class-astra-posts-special-archive-structures-configs.php000064400000124213150322707010025341 0ustar00 array( 'label' => __( 'Grid', 'astra' ), 'path' => "", ), 'blog-layout-5' => array( 'label' => __( 'List', 'astra' ), 'path' => "", ), 'blog-layout-6' => array( 'label' => __( 'Cover', 'astra' ), 'path' => "", ), ); /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $if_astra_addon = defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'blog-pro' ); /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort foreach ( Astra_Posts_Structure_Loader::get_special_page_types() as $index => $special_type ) { $section = 'ast-section-' . $special_type . '-page'; $title_section = 'section-' . $special_type . '-page-title'; $archive_structure_choices = array(); $archive_structure_choices[ $title_section . '-title' ] = array( 'clone' => false, 'is_parent' => true, 'main_index' => $title_section . '-title', 'clone_limit' => 2, 'title' => __( 'Heading', 'astra' ), ); $archive_structure_choices[ $title_section . '-description' ] = array( 'clone' => false, 'is_parent' => true, 'main_index' => $title_section . '-description', 'clone_limit' => 2, 'title' => __( 'Subheading', 'astra' ), ); $archive_structure_choices[ $title_section . '-breadcrumb' ] = __( 'Breadcrumb', 'astra' ); $_configs = array( 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' => ucfirst( $special_type ) . __( ' Page Title', 'astra' ), 'type' => 'section', 'section' => $section, 'panel' => '', 'priority' => 1, ), array( 'name' => ASTRA_THEME_SETTINGS . '[ast-' . $special_type . '-page-title]', 'type' => 'control', 'default' => astra_get_option( 'ast-' . $special_type . '-page-title', true ), 'control' => 'ast-section-toggle', 'section' => $section, 'priority' => 2, 'linked' => $title_section, 'linkText' => ucfirst( $special_type ) . __( ' Page Title', 'astra' ), 'divider' => array( 'ast_class' => 'ast-bottom-divider ast-bottom-section-divider' ), ), 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' => ' ', ), ), 'contextual_sub_control' => true, 'input_attrs' => array( 'dependents' => array( 'layout-1' => array( $title_section . '-empty-layout-message', $title_section . '-article-featured-image-position-layout-1', $title_section . '-article-featured-image-width-type' ), 'layout-2' => array( $title_section . '-featured-as-background', $title_section . '-banner-featured-overlay', $title_section . '-image-position', $title_section . '-featured-help-notice', $title_section . '-article-featured-image-position-layout-2' ), ), ), ), 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', ), ), ), 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, ), ), 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' ), 'priority' => 20, 'title' => __( 'Structure', 'astra' ), 'divider' => array( 'ast_class' => 'ast-bottom-spacing' ), 'choices' => $archive_structure_choices, ), 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' => __( 'Text', 'astra' ), ), array( 'name' => $title_section . '-found-custom-description', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'default' => astra_get_option( $title_section . '-found-custom-description' ), 'linked' => $title_section . '-description', 'type' => 'sub-control', 'control' => 'ast-text-input', 'input_attrs' => array( 'textarea' => true, ), 'section' => $title_section, 'priority' => 1, 'title' => __( 'When Results Found', 'astra' ), ), array( 'name' => $title_section . '-not-found-custom-description', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'default' => astra_get_option( $title_section . '-not-found-custom-description' ), 'linked' => $title_section . '-description', 'type' => 'sub-control', 'control' => 'ast-text-input', 'input_attrs' => array( 'textarea' => true, ), 'section' => $title_section, 'priority' => 1, 'title' => __( 'When Results Not Found', 'astra' ), ), 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' ), ), 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, ), 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' ), ), 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' ), ), 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' => array( 'none' => __( 'None', 'astra' ), 'custom' => __( 'Custom', 'astra' ), ), 'divider' => array( 'ast_class' => 'ast-section-spacing ast-bottom-spacing' ), 'responsive' => false, 'renderAs' => 'text', ), 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', ), ), ), 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, ), 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, ), 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, ), 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', ), 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' ), ), 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' ), ), 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', 'vw', 'rem' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 1, 'max' => 20, ), 'vw' => array( 'min' => 0, 'step' => 0.1, 'max' => 25, ), 'rem' => array( 'min' => 0, 'step' => 0.1, 'max' => 20, ), ), ), 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' ), ), 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' ), ), 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' ), 'title' => __( 'Font Weight', 'astra' ), 'connect' => $title_section . '-title-font-family', 'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ), ), 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' ), 'transport' => 'postMessage', 'title' => __( 'Font Size', 'astra' ), 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ), 'suffix' => array( 'px', 'em', 'vw', 'rem' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 1, 'max' => 20, ), 'vw' => array( 'min' => 0, 'step' => 0.1, 'max' => 25, ), 'rem' => array( 'min' => 0, 'step' => 0.1, 'max' => 20, ), ), ), 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', 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, ), array( 'name' => ASTRA_THEME_SETTINGS . '[ast-' . $special_type . '-content-layout]', 'type' => 'control', 'control' => 'ast-radio-image', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), 'section' => $section, 'default' => astra_get_option( 'ast-' . $special_type . '-content-layout', 'default' ), 'priority' => 3, 'title' => __( 'Container Layout', 'astra' ), 'choices' => array( 'default' => array( 'label' => __( 'Default', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'layout-default', false ) : '', ), 'normal-width-container' => array( 'label' => __( 'Normal', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'normal-width-container', false ) : '', ), 'narrow-width-container' => array( 'label' => __( 'Narrow', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'narrow-width-container', false ) : '', ), 'full-width-container' => array( 'label' => __( 'Full Width', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'full-width-container', false ) : '', ), ), 'divider' => array( 'ast_class' => 'ast-top-divider ast-bottom-spacing' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[ast-' . $special_type . '-content-style]', 'type' => 'control', 'control' => 'ast-selector', 'section' => $section, 'default' => astra_get_option( 'ast-' . $special_type . '-content-style', 'default' ), 'priority' => 3, 'title' => __( 'Container Style', 'astra' ), 'description' => __( 'Container style will apply only when layout is set to either normal or narrow.', 'astra' ), 'choices' => array( 'default' => __( 'Default', 'astra' ), 'unboxed' => __( 'Unboxed', 'astra' ), 'boxed' => __( 'Boxed', 'astra' ), ), 'renderAs' => 'text', 'responsive' => false, 'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[ast-' . $special_type . '-sidebar-layout]', 'type' => 'control', 'control' => 'ast-radio-image', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), 'section' => $section, 'default' => astra_get_option( 'ast-' . $special_type . '-sidebar-layout', 'default' ), 'description' => __( 'Sidebar will only apply when container layout is set to normal.', 'astra' ), 'priority' => 3, 'title' => __( 'Sidebar Layout', 'astra' ), 'divider' => array( 'ast_class' => 'ast-top-section-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 ) : '', ), ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[ast-' . $special_type . '-sidebar-style]', 'type' => 'control', 'control' => 'ast-selector', 'section' => $section, 'default' => astra_get_option( 'ast-' . $special_type . '-sidebar-style', 'default' ), 'priority' => 3, 'title' => __( 'Sidebar Style', 'astra' ), 'choices' => array( 'default' => __( 'Default', 'astra' ), 'unboxed' => __( 'Unboxed', 'astra' ), 'boxed' => __( 'Boxed', 'astra' ), ), 'responsive' => false, 'renderAs' => 'text', 'divider' => array( 'ast_class' => 'ast-top-divider' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[ast-' . $special_type . '-results-style]', 'type' => 'control', 'control' => 'ast-radio-image', 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_choices' ), 'section' => $section, 'default' => astra_get_option( 'ast-' . $special_type . '-results-style' ), 'priority' => 14, 'divider' => array( 'ast_class' => 'ast-top-section-divider' ), 'title' => __( 'Results Layout', 'astra' ), 'choices' => $blog_layout, ), array( 'name' => ASTRA_THEME_SETTINGS . '[ast-' . $special_type . '-results-per-page]', 'default' => astra_get_option( 'ast-' . $special_type . '-results-per-page' ), 'type' => 'control', 'control' => 'ast-number', 'qty_selector' => true, 'section' => $section, 'title' => __( 'Post Per Page', 'astra' ), 'priority' => 14, 'responsive' => false, 'input_attrs' => array( 'min' => 1, 'step' => 1, 'max' => 500, ), 'divider' => array( 'ast_class' => 'ast-top-dotted-divider ast-bottom-section-divider' ), ), array( 'name' => ASTRA_THEME_SETTINGS . '[ast-' . $special_type . '-live-search]', 'default' => astra_get_option( 'ast-' . $special_type . '-live-search' ), 'type' => 'control', 'control' => 'ast-toggle-control', 'section' => $section, 'description' => __( 'This option activates Live Search support for the search box on the no results page.', 'astra' ), 'title' => __( 'Live Search', 'astra' ), 'priority' => 15, 'context' => Astra_Builder_Helper::$general_tab, ), array( 'name' => ASTRA_THEME_SETTINGS . '[ast-' . $special_type . '-live-search-post-types]', 'default' => astra_get_option( 'ast-' . $special_type . '-live-search-post-types' ), 'type' => 'control', 'section' => $section, 'control' => 'ast-multi-selector', 'priority' => 15, 'title' => __( 'Search Within Post Types', 'astra' ), 'context' => array( Astra_Builder_Helper::$general_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[ast-' . $special_type . '-live-search]', 'operator' => '==', 'value' => true, ), ), 'transport' => 'refresh', 'choices' => astra_customizer_search_post_types_choices(), 'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ), 'renderAs' => 'text', 'input_attrs' => array( 'stack_after' => 2, // Currently stack options supports after 2 & 3. ), ), ); $configurations = array_merge( $configurations, $_configs ); } return $configurations; } } /** * Kicking this off by creating new object. */ new Astra_Posts_Special_Archive_Structures_Configs(); posts-structures/customizer/class-astra-posts-single-structures-configs.php000064400000200174150322707020023565 0ustar00 array( 'label' => __( 'Default', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'layout-default', false ) : '', ), 'normal-width-container' => array( 'label' => __( 'Normal', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'normal-width-container', false ) : '', ), 'narrow-width-container' => array( 'label' => __( 'Narrow', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'narrow-width-container', false ) : '', ), 'full-width-container' => array( 'label' => __( 'Full Width', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'full-width-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 ) : '', ), 'normal-width-container' => array( 'label' => __( 'Normal', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'normal-width-container', false ) : '', ), 'full-width-container' => array( 'label' => __( 'Full Width', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'full-width-container', 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( /** * Option: Revamped Single Container Layout. */ array( 'name' => ASTRA_THEME_SETTINGS . '[single-' . $post_type . '-ast-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 . '-ast-content-layout', 'default' ), 'priority' => 3, 'title' => __( 'Container Layout', 'astra' ), 'choices' => $this->get_new_content_layout_choices( $post_type ), 'divider' => array( 'ast_class' => 'ast-top-divider ast-bottom-spacing' ), ), /** * Option: Single Content Style. */ array( 'name' => ASTRA_THEME_SETTINGS . '[single-' . $post_type . '-content-style]', 'type' => 'control', 'control' => 'ast-selector', 'section' => $parent_section, 'default' => astra_get_option( 'single-' . $post_type . '-content-style', 'default' ), 'priority' => 3, 'title' => __( 'Container Style', 'astra' ), 'description' => __( 'Container style will apply only when layout is set to either normal or narrow.', 'astra' ), 'choices' => array( 'default' => __( 'Default', 'astra' ), 'unboxed' => __( 'Unboxed', 'astra' ), 'boxed' => __( 'Boxed', 'astra' ), ), 'renderAs' => 'text', 'responsive' => false, 'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ), ), /** * Option: Single Sidebar Layout. */ 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' ), 'description' => __( 'Sidebar will only apply when container layout is set to normal.', 'astra' ), 'priority' => 3, 'title' => __( 'Sidebar Layout', 'astra' ), 'divider' => array( 'ast_class' => 'ast-top-section-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 ) : '', ), ), ), /** * Option: Single Sidebar Style. */ array( 'name' => ASTRA_THEME_SETTINGS . '[single-' . $post_type . '-sidebar-style]', 'type' => 'control', 'control' => 'ast-selector', 'section' => $parent_section, 'default' => astra_get_option( 'single-' . $post_type . '-sidebar-style', 'default' ), 'priority' => 3, 'title' => __( 'Sidebar Style', 'astra' ), 'choices' => array( 'default' => __( 'Default', 'astra' ), 'unboxed' => __( 'Unboxed', 'astra' ), 'boxed' => __( 'Boxed', 'astra' ), ), 'responsive' => false, 'renderAs' => 'text', 'divider' => array( 'ast_class' => 'ast-top-divider' ), ), /** * Option: Single Page Content Width */ array( 'name' => ASTRA_THEME_SETTINGS . '[page-single-width]', 'type' => 'control', 'control' => 'ast-selector', 'section' => $parent_section, 'default' => astra_get_option( 'page-single-width' ), 'priority' => 6, 'title' => __( 'Content Width', 'astra' ), 'choices' => array( 'default' => __( 'Default', 'astra' ), 'custom' => __( 'Custom', 'astra' ), ), 'transport' => 'postMessage', 'responsive' => false, 'divider' => array( 'ast_class' => 'ast-top-section-divider' ), 'renderAs' => 'text', ), /** * Option: Enter Width */ array( 'name' => ASTRA_THEME_SETTINGS . '[page-single-max-width]', 'type' => 'control', 'control' => 'ast-slider', 'section' => $parent_section, 'transport' => 'postMessage', 'default' => astra_get_option( 'page-single-max-width' ), 'context' => array( Astra_Builder_Helper::$general_tab_config, array( 'setting' => ASTRA_THEME_SETTINGS . '[page-single-width]', 'operator' => '===', 'value' => 'custom', ), ), 'priority' => 6, 'title' => __( 'Custom Width', 'astra' ), 'suffix' => 'px', 'input_attrs' => array( 'min' => 0, 'step' => 1, 'max' => 1920, ), 'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ), ), ); } /** * 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 ); $_structure_defaults = 'page' === $post_type ? array( $title_section . '-image', $title_section . '-title' ) : array( $title_section . '-title', $title_section . '-meta' ); $default_edd_featured_image = ( true === astra_enable_edd_featured_image_defaults() ); 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-single-page'; } elseif ( 'download' === $post_type ) { $parent_section = 'section-edd-single'; $_structure_defaults[] = $default_edd_featured_image ? $title_section . '-image' : ''; } else { $parent_section = $section; } $structure_defaults = astra_get_option( $title_section . '-structure', $_structure_defaults ); $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' => __( 'Taxonomies', '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' => __( 'Taxonomies', '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' => __( 'Taxonomies', 'astra' ), ); } $meta_config_options['date'] = array( 'clone' => false, 'is_parent' => true, 'main_index' => 'date', 'clone_limit' => 1, 'title' => __( 'Date', 'astra' ), ); $meta_config_options['author'] = array( 'clone' => false, 'is_parent' => true, 'main_index' => 'author', 'clone_limit' => 1, 'title' => __( 'Author', '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(); $structure_sub_controls[ $title_section . '-meta' ] = array( 'clone' => false, 'is_parent' => true, 'main_index' => $title_section . '-meta', 'clone_limit' => 2, 'title' => __( 'Meta', 'astra' ), ); // 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' ), ); // Add taxonomy in structural sub-control. $structure_sub_controls[ $title_section . '-str-taxonomy' ] = array( 'clone' => false, 'is_parent' => true, 'main_index' => $title_section . '-str-taxonomy', 'clone_limit' => 2, 'title' => __( 'Taxonomies', 'astra' ), ); $configurations = array_merge( $configurations, $this->get_layout_configuration( $parent_section, $post_type ) ); // Conditional tooltip. $default_tooltip = __( "'None' respects hierarchy; 'Behind' positions the image under the article.", 'astra' ); $tooltip_product = __( "'None' respects hierarchy; 'Behind' position is not applicable for single product page.", 'astra' ); $second_layout_default_tooltip = __( "'None' respects hierarchy; 'Below' positions image on top of the article.", 'astra' ); $second_layout_tooltip_product = __( "'None' respects hierarchy; 'Below' position is not applicable for single product page.", 'astra' ); // Added check if current panel is for the single product option. $tooltip_description = ( $parent_section === 'section-woo-shop-single' ) ? $tooltip_product : $default_tooltip; $second_layout_tooltip_description = ( $parent_section === 'section-woo-shop-single' ) ? $second_layout_tooltip_product : $second_layout_default_tooltip; $_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, // @codingStandardsIgnoreStart 'title' => $this->get_dynamic_section_title( $post_type_object, $post_type ), // @codingStandardsIgnoreEnd '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' => $this->get_dynamic_section_title( $post_type_object, $post_type ), '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' => ' ', ), ), 'contextual_sub_control' => true, 'input_attrs' => array( 'dependents' => array( 'layout-1' => array( $title_section . '-empty-layout-message', $title_section . '-article-featured-image-position-layout-1', $title_section . '-article-featured-image-width-type', $title_section . '-remove-featured-padding' ), 'layout-2' => array( $title_section . '-featured-as-background', $title_section . '-banner-featured-overlay', $title_section . '-image-position', $title_section . '-featured-help-notice', $title_section . '-article-featured-image-position-layout-2' ), ), ), ), /** * 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' => $structure_defaults, '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 . '-breadcrumb' => __( 'Breadcrumb', 'astra' ), $title_section . '-excerpt' => __( 'Excerpt', 'astra' ), ), $structure_sub_controls ), ), array( 'name' => $title_section . '-article-featured-image-position-layout-1', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'type' => 'sub-control', 'control' => 'ast-selector', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-article-featured-image-position-layout-1', 'behind' ), 'priority' => 28, 'linked' => $title_section . '-image', 'transport' => 'postMessage', 'title' => __( 'Image Position', 'astra' ), 'choices' => array( 'none' => __( 'None', 'astra' ), 'behind' => __( 'Behind', 'astra' ), ), 'description' => $tooltip_description, 'responsive' => false, 'renderAs' => 'text', ), array( 'name' => $title_section . '-article-featured-image-position-layout-2', 'type' => 'sub-control', 'control' => 'ast-selector', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'linked' => $title_section . '-image', 'transport' => 'postMessage', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-article-featured-image-position-layout-2', 'none' ), 'priority' => 28, 'title' => __( 'Image Position', 'astra' ), 'choices' => array( 'none' => __( 'None', 'astra' ), 'below' => __( 'Below', 'astra' ), ), 'description' => $second_layout_tooltip_description, 'responsive' => false, 'renderAs' => 'text', ), array( 'name' => $title_section . '-article-featured-image-width-type', 'type' => 'sub-control', 'control' => 'ast-selector', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'linked' => $title_section . '-image', 'transport' => 'postMessage', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-article-featured-image-width-type', 'wide' ), 'priority' => 28, 'title' => __( 'Behind Positioned Image Width', 'astra' ), 'choices' => array( 'wide' => __( 'Wide', 'astra' ), 'full' => __( 'Full Width', 'astra' ), ), 'responsive' => false, 'divider' => array( 'ast_class' => 'ast-section-spacing' ), 'renderAs' => 'text', ), array( 'name' => $title_section . '-article-featured-image-ratio-type', 'default' => astra_get_option( $title_section . '-article-featured-image-ratio-type', 'predefined' ), 'type' => 'sub-control', 'section' => $title_section, 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'linked' => $title_section . '-image', 'transport' => 'postMessage', 'priority' => 28, 'control' => 'ast-selector', 'title' => __( 'Image Ratio', 'astra' ), 'choices' => array( 'default' => __( 'Original', 'astra' ), 'predefined' => __( 'Predefined', 'astra' ), 'custom' => __( 'Custom', 'astra' ), ), 'contextual_sub_control' => true, 'input_attrs' => array( 'dependents' => array( 'default' => array(), 'predefined' => array( $title_section . '-article-featured-image-ratio-pre-scale' ), 'custom' => array( $title_section . '-article-featured-image-custom-scale-width', $title_section . '-article-featured-image-custom-scale-height', $title_section . '-article-featured-image-custom-scale-description' ), ), ), 'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ), 'responsive' => false, 'renderAs' => 'text', ), array( 'name' => $title_section . '-article-featured-image-ratio-pre-scale', 'default' => astra_get_option( $title_section . '-article-featured-image-ratio-pre-scale', '16/9' ), 'type' => 'sub-control', 'section' => $title_section, 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'linked' => $title_section . '-image', 'transport' => 'postMessage', 'priority' => 28, 'control' => 'ast-selector', 'choices' => array( '1/1' => __( '1:1', 'astra' ), '4/3' => __( '4:3', 'astra' ), '16/9' => __( '16:9', 'astra' ), '2/1' => __( '2:1', 'astra' ), ), 'responsive' => false, 'renderAs' => 'text', ), array( 'name' => $title_section . '-article-featured-image-custom-scale-width', 'default' => astra_get_option( $title_section . '-article-featured-image-custom-scale-width', 16 ), 'type' => 'sub-control', 'control' => 'ast-number', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'linked' => $title_section . '-image', 'transport' => 'postMessage', 'section' => $title_section, 'priority' => 28, 'qty_selector' => true, 'title' => __( 'Width', 'astra' ), 'input_attrs' => array( 'style' => 'text-align:center;', 'placeholder' => __( 'Auto', 'astra' ), 'min' => 1, 'max' => 1000, ), 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), ), array( 'name' => $title_section . '-article-featured-image-custom-scale-height', 'default' => astra_get_option( $title_section . '-article-featured-image-custom-scale-height', 9 ), 'type' => 'sub-control', 'control' => 'ast-number', 'transport' => 'postMessage', 'section' => $title_section, 'priority' => 28, 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'linked' => $title_section . '-image', 'qty_selector' => true, 'title' => __( 'Height', 'astra' ), 'input_attrs' => array( 'style' => 'text-align:center;', 'placeholder' => __( 'Auto', 'astra' ), 'min' => 1, 'max' => 1000, ), 'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_number_n_blank' ), ), array( 'name' => $title_section . '-article-featured-image-custom-scale-description', 'type' => 'sub-control', 'transport' => 'postMessage', 'control' => 'ast-description', 'section' => $title_section, 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'linked' => $title_section . '-image', 'priority' => 28, 'label' => '', 'help' => sprintf( /* translators: 1: link open markup, 2: link close markup */ __( 'Calculate a personalized image ratio using this %1$s online tool %2$s for your image dimensions.', 'astra' ), '', '' ), ), array( 'name' => $title_section . '-article-featured-image-size', 'default' => astra_get_option( $title_section . '-article-featured-image-size', 'large' ), 'section' => $title_section, 'transport' => 'postMessage', 'type' => 'sub-control', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'linked' => $title_section . '-image', 'priority' => 28, 'title' => __( 'Image Size', 'astra' ), 'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ), 'control' => 'ast-select', 'choices' => astra_get_site_image_sizes( true ), 'description' => defined( 'ASTRA_EXT_VER' ) ? __( "You can specify Custom image sizes from the Single Post's 'Featured Image Size' option.", 'astra' ) : '', ), array( 'name' => $title_section . '-remove-featured-padding', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'default' => astra_get_option( $title_section . '-remove-featured-padding', false ), 'linked' => $title_section . '-image', 'type' => 'sub-control', 'control' => 'ast-toggle', 'section' => $title_section, 'divider' => array( 'ast_class' => 'ast-section-spacing' ), 'priority' => 28, 'title' => __( 'Remove Image Padding', 'astra' ), 'description' => __( 'Remove the padding around featured image when position is "None".', 'astra' ), 'transport' => 'postMessage', ), 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, 'divider' => array( 'ast_class' => 'ast-section-spacing ast-top-dotted-divider' ), 'priority' => 28, 'title' => __( 'Use as Background', 'astra' ), 'transport' => 'postMessage', ), 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' => 28, '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' => 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' => $title_section . '-structural-taxonomy', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'default' => astra_get_option( $title_section . '-structural-taxonomy' ), 'linked' => $title_section . '-str-taxonomy', 'type' => 'sub-control', 'control' => 'ast-select', 'transport' => 'refresh', 'section' => $title_section, 'priority' => 1, 'title' => __( 'Taxonomy', 'astra' ), 'choices' => $taxonomies, ), array( 'name' => $title_section . '-structural-taxonomy-style', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'type' => 'sub-control', 'control' => 'ast-selector', 'section' => $title_section, 'default' => astra_get_option( $title_section . '-structural-taxonomy-style', '' ), 'priority' => 2, 'linked' => $title_section . '-str-taxonomy', 'transport' => 'refresh', 'title' => __( 'Style', 'astra' ), 'choices' => array( '' => __( 'Default', 'astra' ), 'badge' => __( 'Badge', 'astra' ), 'underline' => __( 'Underline', 'astra' ), ), 'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ), 'responsive' => false, 'renderAs' => 'text', ), 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, 'title' => __( 'Meta', 'astra' ), 'choices' => array_merge( array( 'comments' => __( 'Comments', 'astra' ), ), $meta_config_options ), ), /** * Option: Author Prefix Label. */ array( 'name' => $title_section . '-author-prefix-label', 'default' => astra_get_option( $title_section . '-author-prefix-label', astra_default_strings( 'string-blog-meta-author-by', false ) ), 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-metadata]', 'linked' => 'author', 'type' => 'sub-control', 'control' => 'ast-text-input', 'section' => $title_section, 'divider' => array( 'ast_class' => 'ast-bottom-dotted-divider ast-bottom-section-spacing' ), 'title' => __( 'Prefix Label', 'astra' ), 'priority' => 1, 'transport' => 'postMessage', ), /** * Option: Author Avatar. */ array( 'name' => $title_section . '-author-avatar', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-metadata]', 'default' => astra_get_option( $title_section . '-author-avatar', false ), 'linked' => 'author', 'type' => 'sub-control', 'control' => 'ast-toggle', 'section' => $title_section, 'priority' => 5, 'title' => __( 'Author Avatar', 'astra' ), 'transport' => 'postMessage', ), /** * Option: Author Avatar Width. */ array( 'name' => $title_section . '-author-avatar-size', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-metadata]', 'default' => astra_get_option( $title_section . '-author-avatar-size', 30 ), 'linked' => 'author', 'type' => 'sub-control', 'control' => 'ast-slider', 'transport' => 'postMessage', 'section' => $title_section, 'priority' => 10, 'title' => __( 'Image Size', 'astra' ), 'suffix' => 'px', 'input_attrs' => array( 'min' => 1, 'step' => 1, 'max' => 200, ), ), /** * 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-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: Meta Data Separator. */ array( 'name' => $title_section . '-metadata-separator', 'default' => astra_get_option( $title_section . '-metadata-separator', '/' ), 'type' => 'sub-control', 'transport' => 'postMessage', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-structure]', 'linked' => $title_section . '-meta', 'section' => $title_section, 'priority' => 10, 'control' => 'ast-selector', 'title' => __( 'Divider Type', 'astra' ), 'choices' => array( '/' => '/', '-' => '-', '|' => '|', '•' => '•', 'none' => __( 'None', 'astra' ), ), 'responsive' => false, 'renderAs' => 'text', ), /** * 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' => 29, '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-section-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' => 30, '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 ast-bottom-section-divider' ), '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' => 2, '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', 'vw', 'rem' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 0.01, 'max' => 20, ), 'vw' => array( 'min' => 0, 'step' => 0.1, 'max' => 25, ), 'rem' => array( 'min' => 0, 'step' => 0.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', 'vw', 'rem' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 0.01, 'max' => 20, ), 'vw' => array( 'min' => 0, 'step' => 0.1, 'max' => 25, ), 'rem' => array( 'min' => 0, 'step' => 0.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', 'vw', 'rem' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 0.01, 'max' => 20, ), 'vw' => array( 'min' => 0, 'step' => 0.1, 'max' => 25, ), 'rem' => array( 'min' => 0, 'step' => 0.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, ), ); if ( 'page' === $post_type ) { /** * Option: Disable structure and meta on the front page. */ $_configs[] = array( 'name' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-disable-structure-meta-on-front-page]', 'default' => astra_get_option( $title_section . '-disable-structure-meta-on-front-page', false ), 'type' => 'control', 'section' => $title_section, 'context' => array( Astra_Builder_Helper::$general_tab_config, 'relation' => 'AND', array( 'setting' => 'show_on_front', 'operator' => '===', 'value' => 'page', ), ), 'title' => __( 'Disable on Front Page?', 'astra' ), 'priority' => 5, 'control' => 'ast-toggle-control', 'divider' => array( 'ast_class' => 'ast-top-divider ast-bottom-spacing' ), ); } if ( 'post' !== $post_type && 'product' !== $post_type ) { $_configs[] = array( 'name' => $title_section . '-parent-ast-context-tabs', 'section' => $parent_section, 'type' => 'control', 'control' => 'ast-builder-header-control', 'priority' => 0, 'description' => '', ); } if ( 'post' !== $post_type && Astra_Builder_Helper::$is_header_footer_builder_active ) { $_configs = array_merge( $_configs, Astra_Extended_Base_Configuration::prepare_advanced_tab( $parent_section ) ); } /** @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' => __( 'Taxonomy', 'astra' ), 'choices' => $taxonomies, ); $_configs[] = array( 'name' => $title_section . '-taxonomy' . $control_suffix . '-style', 'parent' => ASTRA_THEME_SETTINGS . '[' . $title_section . '-metadata]', 'default' => astra_get_option( $title_section . '-taxonomy' . $control_suffix . '-style', '' ), 'linked' => $title_section . '-taxonomy' . $control_suffix, 'type' => 'sub-control', 'control' => 'ast-selector', 'section' => $title_section, 'priority' => 10, 'transport' => 'refresh', 'title' => __( 'Style', 'astra' ), 'choices' => array( '' => __( 'Default', 'astra' ), 'badge' => __( 'Badge', 'astra' ), 'underline' => __( 'Underline', 'astra' ), ), 'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ), 'responsive' => false, 'renderAs' => 'text', ); } } $configurations = array_merge( $configurations, $_configs ); } return $configurations; } /** * Get Dynamic Section Title. * * @since 4.4.0 * @param object|null $post_type_object Post type object. * @param string $post_type Post type. * @return string */ public function get_dynamic_section_title( $post_type_object, $post_type ) { if ( ! is_null( $post_type_object ) ) { $title = isset( $post_type_object->labels->singular_name ) ? ucfirst( $post_type_object->labels->singular_name ) : ucfirst( $post_type ); } else { $title = __( 'Single Banner', 'astra' ); } /** @psalm-suppress TooManyArguments */ return apply_filters( 'astra_single_post_title', $title . __( ' Title Area', 'astra' ), $post_type ); } } /** * Kicking this off by creating new object. */ new Astra_Posts_Single_Structures_Configs(); posts-structures/customizer/class-astra-posts-archive-structures-configs.php000064400000115314150322707020023726 0ustar00 array( 'label' => __( 'Default', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'layout-default', false ) : '', ), 'normal-width-container' => array( 'label' => __( 'Normal', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'normal-width-container', false ) : '', ), 'narrow-width-container' => array( 'label' => __( 'Narrow', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'narrow-width-container', false ) : '', ), 'full-width-container' => array( 'label' => __( 'Full Width', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'full-width-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 ) : '', ), 'normal-width-container' => array( 'label' => __( 'Normal', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'normal-width-container', false ) : '', ), 'full-width-container' => array( 'label' => __( 'Full Width', 'astra' ), 'path' => ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'full-width-container', false ) : '', ), ); } } /** * Register Archive 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. } $reveal_effect = array(); /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'blog-pro' ) && ! ( 'post' === $post_type || 'product' === $post_type ) ) { /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $reveal_effect = array( 'name' => ASTRA_THEME_SETTINGS . '[archive-' . $post_type . '-ast-reveal-effect]', 'section' => $parent_section, 'type' => 'control', 'control' => 'ast-toggle-control', 'default' => astra_get_option( 'archive-' . $post_type . '-ast-reveal-effect', false ), 'title' => __( 'Reveal Effect', 'astra' ), 'priority' => 5, 'divider' => array( 'ast_class' => 'ast-section-spacing ast-top-section-divider' ), ); } return array( /** * Option: Revamped Archive Container Layout. */ array( 'name' => ASTRA_THEME_SETTINGS . '[archive-' . $post_type . '-ast-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 . '-ast-content-layout', 'default' ), 'priority' => 5, 'title' => __( 'Container Layout', 'astra' ), 'choices' => $this->get_new_content_layout_choices( $post_type ), 'transport' => 'refresh', 'divider' => array( 'ast_class' => 'ast-top-divider ast-bottom-spacing' ), ), /** * Option: Archive Content Style. */ array( 'name' => ASTRA_THEME_SETTINGS . '[archive-' . $post_type . '-content-style]', 'type' => 'control', 'control' => 'ast-selector', 'section' => $parent_section, 'default' => astra_get_option( 'archive-' . $post_type . '-content-style', 'default' ), 'priority' => 5, 'title' => __( 'Container Style', 'astra' ), 'choices' => array( 'default' => __( 'Default', 'astra' ), 'unboxed' => __( 'Unboxed', 'astra' ), 'boxed' => __( 'Boxed', 'astra' ), ), 'responsive' => false, 'renderAs' => 'text', 'description' => __( 'Container style will apply only when layout is set to either normal or narrow.', 'astra' ), 'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ), ), /** * Option: Archive Sidebar Layout. */ 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' ), 'description' => __( 'Sidebar will only apply when container layout is set to normal.', 'astra' ), 'divider' => array( 'ast_class' => 'ast-top-section-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 ) : '', ), ), ), /** * Option: Archive Sidebar Style. */ array( 'name' => ASTRA_THEME_SETTINGS . '[archive-' . $post_type . '-sidebar-style]', 'type' => 'control', 'control' => 'ast-selector', 'section' => $parent_section, 'default' => astra_get_option( 'archive-' . $post_type . '-sidebar-style', 'default' ), 'priority' => 5, 'title' => __( 'Sidebar Style', 'astra' ), 'choices' => array( 'default' => __( 'Default', 'astra' ), 'unboxed' => __( 'Unboxed', 'astra' ), 'boxed' => __( 'Boxed', 'astra' ), ), 'responsive' => false, 'renderAs' => 'text', 'divider' => array( 'ast_class' => 'ast-top-divider' ), ), $reveal_effect, ); } /** * 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, // @codingStandardsIgnoreStart 'title' => $this->get_dynamic_section_title( get_post_type_object( $post_type ), $post_type ), // @codingStandardsIgnoreEnd '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, // @codingStandardsIgnoreStart 'linkText' => $this->get_dynamic_section_title( get_post_type_object( $post_type ), $post_type ), // @codingStandardsIgnoreEnd ), /** * 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' => ' ', ), ), ), /** * 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', 'vw', 'rem' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 0.01, 'max' => 20, ), 'vw' => array( 'min' => 0, 'step' => 0.1, 'max' => 25, ), 'rem' => array( 'min' => 0, 'step' => 0.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', 'vw', 'rem' ), 'input_attrs' => array( 'px' => array( 'min' => 0, 'step' => 1, 'max' => 200, ), 'em' => array( 'min' => 0, 'step' => 0.01, 'max' => 20, ), 'vw' => array( 'min' => 0, 'step' => 0.1, 'max' => 25, ), 'rem' => array( 'min' => 0, 'step' => 0.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; } /** * Get Dynamic Section Title. * * @since 4.4.0 * @param object|null $post_type_object Post type object. * @param string $post_type Post type. * @return string */ public function get_dynamic_section_title( $post_type_object, $post_type ) { if ( ! is_null( $post_type_object ) ) { $title = ( 'post' === $post_type ) ? __( 'Blog', 'astra' ) : Astra_Posts_Structures_Configs::astra_get_dynamic_section_title( get_post_type_object( $post_type ), $post_type ); } else { $title = __( 'Archive Banner', 'astra' ); } /** @psalm-suppress TooManyArguments */ return apply_filters( 'astra_archive_post_title', $title . __( ' Title Area', 'astra' ), $post_type ); } } /** * Kicking this off by creating new object. */ new Astra_Posts_Archive_Structures_Configs(); related-posts/class-astra-related-posts-markup.php000064400000037226150322707020016351 0ustar00 Related Posts section. * * @since 3.5.0 * @return void */ public function astra_related_posts_markup() { if ( astra_target_rules_for_related_posts() ) { $this->astra_get_related_posts(); } } /** * Related Posts markup. * * @since 3.5.0 * @return bool */ public function astra_get_related_posts() { global $post; $post_id = $post->ID; $related_posts_title = astra_get_i18n_option( 'related-posts-title', _x( '%astra%', 'Single Blog/Post Related Posts: Title', 'astra' ) ); $related_post_meta = astra_get_option( 'related-posts-meta-structure' ); $related_post_structure = astra_get_option_meta( 'related-posts-structure' ); $exclude_ids = apply_filters( 'astra_related_posts_exclude_post_ids', array( $post_id ), $post_id ); $related_posts_total_count = absint( astra_get_option( 'related-posts-total-count', 2 ) ); $module_container_width = astra_get_option( 'related-posts-container-width' ); $module_container_width = 'inside' === astra_get_option( 'related-posts-box-placement' ) ? '' : 'ast-container--' . $module_container_width; $related_category_style = astra_get_option( 'related-posts-category-style' ); $related_tag_style = astra_get_option( 'related-posts-tag-style' ); // Get related posts by WP_Query. $query_posts = $this->astra_get_related_posts_by_query( $post_id ); if ( $query_posts ) { if ( ! $query_posts->have_posts() ) { return apply_filters( 'astra_related_posts_no_posts_avilable_message', '', $post_id ); } // Added flag to load wrapper section 'ast-single-related-posts-container' only once, because as we removed 'posts__not_in' param from WP_Query and we conditionally handle posts__not_in below so it needs to verify if there are other posts as well to load, then only we will display wrapper. $related_posts_section_loaded = false; do_action( 'astra_related_posts_loop_before' ); /** * WP_Query posts loop. * * Used $post_counter & ( $post_counter < $total_posts_count ) condition to manage posts in while loop because there is case where manual 'post__not_in' condition handling scenario fails within loop. * * # CASE EXAMPLE - If total posts set to 4 (where 'post__not_in' not used in WP_Query) so there is a chance that out of those 4 posts, 1 post will be currently active on frontend. * * So what will happen in this case - Within following loop the current post will exclude by if condition & only 3 posts will be shown up. * * To avoid such cases $post_counter & ( $post_counter < $total_posts_count ) condition used. * * @since 3.5.0 */ $post_counter = 1; $total_posts_count = $related_posts_total_count + 1; while ( $query_posts->have_posts() && $post_counter < $total_posts_count ) { $query_posts->the_post(); $post_id = get_the_ID(); $separator = astra_get_option( 'related-metadata-separator', '/' ); $output_str = astra_get_post_meta( $related_post_meta, $separator, 'related-posts' ); if ( is_array( $exclude_ids ) && ! in_array( $post_id, $exclude_ids ) ) { if ( false === $related_posts_section_loaded ) { if ( is_customize_preview() ) { echo '