'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
Astra_Builder_UI_Controller::render_customizer_edit_button( 'row-editor-shortcut' );
} else {
echo '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
do_action( 'astra_related_posts_title_before' );
if ( '' !== $related_posts_title ) {
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
'astra_related_posts_title',
sprintf(
'
<%1$s class="ast-related-posts-title"> %2$s %1$s>
',
apply_filters( 'astra_related_posts_box_heading_tag', 'h2' ),
$related_posts_title
)
);
}
do_action( 'astra_related_posts_title_after' );
echo '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
$related_posts_section_loaded = true;
}
?>
>
astra_get_related_post_featured_image( $post_id );
do_action( 'astra_related_post_after_featured_image', $post_id );
} else {
?>
astra_get_related_post_excerpt( $post_id );
$this->astra_get_related_post_read_more( $post_id );
?>
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
do_action( 'astra_related_posts_loop_after' );
}
}
/**
* Render Post CTA button HTML marup.
*
* @param int $current_post_id current post ID.
*
* @since 3.5.0
*/
public function astra_get_related_post_read_more( $current_post_id ) {
if ( ! astra_get_option( 'enable-related-posts-excerpt' ) ) {
return;
}
$related_posts_content_type = apply_filters( 'astra_related_posts_content_type', 'excerpt' );
if ( 'full-content' === $related_posts_content_type ) {
return;
}
$target = apply_filters( 'astra_related_post_cta_target', '_self' );
$cta_text = apply_filters( 'astra_related_post_read_more_text', astra_get_i18n_option( 'blog-read-more-text', _x( '%astra%', 'Blogs: Read More Text', 'astra' ) ) );
$blog_read_more_as_button = astra_get_option( 'blog-read-more-as-button' );
$show_read_more_as_button = apply_filters( 'astra_related_post_read_more_as_button', $blog_read_more_as_button );
$class = '';
if ( $show_read_more_as_button ) {
$class = 'ast-button';
}
$custom_class = apply_filters( 'astra_related_post_cta_custom_classes', $class );
do_action( 'astra_related_post_before_cta', $current_post_id );
?>
< class="ast-related-post-title entry-title">
>
$alt_text ? $alt_text : get_the_title( $current_post_id ),
'itemprop' => apply_filters( 'astra_related_posts_thumbnail_itemprop', '' ),
)
)
);
$appended_class = has_post_thumbnail( $current_post_id ) ? 'post-has-thumb' : 'ast-no-thumb';
$featured_img_markup = '
';
if ( '' !== $post_thumb ) {
$featured_img_markup .= '
';
}
$featured_img_markup = apply_filters( 'astra_related_post_featured_image_after', $featured_img_markup );
$featured_img_markup .= '
';
$featured_img_markup = apply_filters( 'astra_related_post_thumbnail', $featured_img_markup, $before, $after );
if ( false === $echo ) {
return $before . $featured_img_markup . $after;
}
echo $before . $featured_img_markup . $after; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Get related posts based on configurations.
*
* @param int $post_id Current Post ID.
*
* @since 3.5.0
*
* @return WP_Query|bool
*/
public function astra_get_related_posts_by_query( $post_id ) {
$term_ids = array();
$current_post_type = get_post_type( $post_id );
$related_posts_total_count = absint( astra_get_option( 'related-posts-total-count', 2 ) );
// Taking one post extra in loop because if current post excluded from while loop then this extra one post will cover total post count. Apperently avoided 'post__not_in' from WP_Query.
$updated_total_posts_count = $related_posts_total_count + 1;
$related_posts_order_by = astra_get_option( 'related-posts-order-by', 'date' );
$related_posts_order = astra_get_option( 'related-posts-order', 'desc' );
$related_posts_based_on = astra_get_option( 'related-posts-based-on', 'categories' );
$query_args = array(
'update_post_meta_cache' => false,
'posts_per_page' => $updated_total_posts_count,
'no_found_rows' => true,
'post_status' => 'publish',
'post_type' => $current_post_type,
'orderby' => $related_posts_order_by,
'fields' => 'ids',
'order' => $related_posts_order,
);
if ( 'tags' === $related_posts_based_on ) {
$terms = get_the_tags( $post_id );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
$term_ids = wp_list_pluck( $terms, 'term_id' );
}
$query_args['tag__in'] = $term_ids;
} else {
$terms = get_the_category( $post_id );
/** @psalm-suppress RedundantConditionGivenDocblockType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
/** @psalm-suppress RedundantConditionGivenDocblockType */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$term_ids = wp_list_pluck( $terms, 'term_id' );
}
$query_args['category__in'] = $term_ids;
}
$query_args = apply_filters( 'astra_related_posts_query_args', $query_args );
return new WP_Query( $query_args );
}
}
/**
* Kicking this off by creating NEW instance.
*/
new Astra_Related_Posts_Markup();
related-posts/css/static-css.php 0000644 00000007001 15032270702 0012704 0 ustar 00 Post Title typography dynamic stylings.
$related_post_title_font_size = astra_get_option( 'related-posts-title-font-size' );
// Related Posts -> Post Meta typography dynamic stylings.
$related_post_meta_font_size = astra_get_option( 'related-posts-meta-font-size' );
// Related Posts -> Content typography dynamic stylings.
$related_post_content_font_size = astra_get_option( 'related-posts-content-font-size' );
// Related Posts -> Section Title typography dynamic stylings.
$related_posts_section_title_font_size = astra_get_option( 'related-posts-section-title-font-size' );
// Setting up container BG color by default to Related Posts's section BG color.
$content_bg_obj = astra_get_option( 'content-bg-obj-responsive' );
$container_bg_color = '#ffffff';
if ( isset( $content_bg_obj['desktop']['background-color'] ) && '' !== $content_bg_obj['desktop']['background-color'] ) {
$container_bg_color = $content_bg_obj['desktop']['background-color'];
}
// Related Posts -> Color dynamic stylings.
$related_posts_title_color = astra_get_option( 'related-posts-title-color' );
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$related_posts_bg_color = astra_get_option( 'related-posts-background-color', $container_bg_color );
$related_post_text_color = astra_get_option( 'related-posts-text-color' );
$related_posts_meta_color = astra_get_option( 'related-posts-meta-color' );
$related_posts_link_color = astra_get_option( 'related-posts-link-color' );
$related_posts_link_hover_color = astra_get_option( 'related-posts-link-hover-color' );
$related_posts_meta_link_hover_color = astra_get_option( 'related-posts-meta-link-hover-color' );
$author_avatar_size = astra_get_option( 'related-posts-author-avatar-size' );
// Aspect Ratio processing.
$aspect_ratio_type = astra_get_option( 'related-posts-image-ratio-type', '' );
$predefined_scale = astra_get_option( 'related-posts-image-ratio-pre-scale' );
$custom_scale_width = astra_get_option( 'related-posts-image-custom-scale-width', 16 );
$custom_scale_height = astra_get_option( 'related-posts-image-custom-scale-height', 9 );
$aspect_ratio = astra_get_dynamic_image_aspect_ratio( $aspect_ratio_type, $predefined_scale, $custom_scale_width, $custom_scale_height );
$with_aspect_img_width = 'predefined' === $aspect_ratio_type || 'custom' === $aspect_ratio_type ? '100%' : '';
$object_fit = 'custom' === $aspect_ratio_type ? 'cover' : '';
$css_desktop_output = array(
'.ast-single-related-posts-container .ast-related-posts-wrapper' => array(
'grid-template-columns' => Astra_Builder_Helper::$grid_size_mapping[ $desktop_grid ],
),
'.ast-related-posts-inner-section .ast-date-meta .posted-on, .ast-related-posts-inner-section .ast-date-meta .posted-on *' => array(
'background' => esc_attr( $link_color ),
'color' => astra_get_foreground_color( $link_color ),
),
'.ast-related-posts-inner-section .ast-date-meta .posted-on .date-month, .ast-related-posts-inner-section .ast-date-meta .posted-on .date-year' => array(
'color' => astra_get_foreground_color( $link_color ),
),
'.ast-single-related-posts-container' => array(
'background-color' => esc_attr( $related_posts_bg_color ),
),
/**
* Related Posts - Section Title
*/
'.ast-related-posts-title' => astra_get_font_array_css( astra_get_option( 'related-posts-section-title-font-family' ), astra_get_option( 'related-posts-section-title-font-weight' ), $related_posts_section_title_font_size, 'related-posts-section-title-font-extras', $related_posts_title_color ),
'.ast-related-posts-title-section .ast-related-posts-title' => array(
'text-align' => esc_attr( $related_posts_title_alignment ),
),
/**
* Related Posts - Post Title
*/
'.ast-related-post-content .entry-header .ast-related-post-title, .ast-related-post-content .entry-header .ast-related-post-title a' => astra_get_font_array_css( astra_get_option( 'related-posts-title-font-family' ), astra_get_option( 'related-posts-title-font-weight' ), $related_post_title_font_size, 'related-posts-title-font-extras', $related_post_text_color ),
/**
* Related Posts - Meta
*/
'.ast-related-post-content .entry-meta, .ast-related-post-content .entry-meta *' => astra_get_font_array_css( astra_get_option( 'related-posts-meta-font-family' ), astra_get_option( 'related-posts-meta-font-weight' ), $related_post_meta_font_size, 'related-posts-meta-font-extras', $related_posts_meta_color ),
'.ast-related-post-content .entry-meta a:hover, .ast-related-post-content .entry-meta span a span:hover' => array(
'color' => esc_attr( $related_posts_meta_link_hover_color ),
),
/**
* Related Posts - CTA
*/
'.ast-related-post-cta a' => array(
'color' => esc_attr( $related_posts_link_color ),
),
'.ast-related-post-cta a:hover' => array(
'color' => esc_attr( $related_posts_link_hover_color ),
),
/**
* Related Posts - Content
*/
'.ast-related-post-excerpt' => astra_get_font_array_css( astra_get_option( 'related-posts-content-font-family' ), astra_get_option( 'related-posts-content-font-weight' ), $related_post_content_font_size, 'related-posts-content-font-extras', $related_post_text_color ),
'.ast-related-post-content .post-thumb-img-content img' => array(
'aspect-ratio' => $aspect_ratio,
'width' => $with_aspect_img_width,
'object-fit' => $object_fit, // setting it to 'cover' for custom ratio option same as blogs archive page.
),
'.ast-related-post-content .ast-author-avatar' => array(
'--ast-author-avatar-size' => astra_get_css_value( $author_avatar_size, 'px' ),
),
);
if ( astra_has_global_color_format_support() ) {
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$related_posts_bg_color = astra_get_option( 'related-posts-background-color', $content_bg_obj );
if ( is_array( $related_posts_bg_color ) ) {
$css_desktop_output['.ast-single-related-posts-container'] = astra_get_responsive_background_obj( $related_posts_bg_color, 'desktop' );
} else {
$css_desktop_output['.ast-single-related-posts-container'] = array(
'background-color' => esc_attr( $related_posts_bg_color ),
);
}
}
$btn_text_color = astra_get_option( 'button-color', '#fff' );
$btn_border_color = astra_get_option( 'theme-button-border-group-border-color' );
$btn_border_h_color = astra_get_option( 'theme-button-border-group-border-h-color' );
$theme_color = astra_get_option( 'theme-color' );
$link_hover_color = astra_get_option( 'link-h-color' );
$btn_bg_color = astra_get_option( 'button-bg-color', $theme_color );
$btn_text_hover_color = astra_get_option( 'button-h-color', '#fff' );
$btn_bg_hover_color = astra_get_option( 'button-bg-h-color', $link_hover_color );
$btn_preset_style = astra_get_option( 'button-preset-style' );
$global_custom_button_border_size = astra_get_option( 'theme-button-border-group-border-size' );
if ( 'button_04' === $btn_preset_style || 'button_05' === $btn_preset_style || 'button_06' === $btn_preset_style ) {
if ( empty( $btn_border_color ) ) {
$btn_border_color = $btn_bg_color;
}
if ( '' === astra_get_option( 'button-bg-color' ) && '' === astra_get_option( 'button-color' ) ) {
$btn_text_color = $theme_color;
} elseif ( '' === astra_get_option( 'button-color' ) ) {
$btn_text_color = $btn_bg_color;
}
$btn_bg_color = 'transparent';
}
$css_desktop_output['.ast-related-cat-style--badge .cat-links > a, .ast-related-tag-style--badge .tags-links > a'] = array(
'border-style' => 'solid',
'border-top-width' => ( isset( $global_custom_button_border_size['top'] ) && '' !== $global_custom_button_border_size['top'] ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : '0',
'border-right-width' => ( isset( $global_custom_button_border_size['right'] ) && '' !== $global_custom_button_border_size['right'] ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : '0',
'border-left-width' => ( isset( $global_custom_button_border_size['left'] ) && '' !== $global_custom_button_border_size['left'] ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : '0',
'border-bottom-width' => ( isset( $global_custom_button_border_size['bottom'] ) && '' !== $global_custom_button_border_size['bottom'] ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : '0',
'padding' => '4px 8px',
'border-radius' => '3px',
'font-size' => 'inherit',
'color' => esc_attr( $btn_text_color ),
'border-color' => empty( $btn_border_color ) ? esc_attr( $btn_bg_color ) : esc_attr( $btn_border_color ),
'background-color' => esc_attr( $btn_bg_color ),
);
$css_desktop_output['.ast-related-cat-style--badge .cat-links > a:hover, .ast-related-tag-style--badge .tags-links > a:hover'] = array(
'color' => esc_attr( $btn_text_hover_color ),
'background-color' => esc_attr( $btn_bg_hover_color ),
'border-color' => empty( $btn_border_h_color ) ? esc_attr( $btn_bg_hover_color ) : esc_attr( $btn_border_h_color ),
);
$css_desktop_output['.ast-related-cat-style--underline .cat-links > a, .ast-related-tag-style--underline .tags-links > a'] = array(
'text-decoration' => 'underline',
);
$dynamic_css .= astra_parse_css( $css_desktop_output );
$css_max_tablet_output = array(
'.ast-single-related-posts-container .ast-related-posts-wrapper .ast-related-post' => array(
'width' => '100%',
),
'.ast-single-related-posts-container .ast-related-posts-wrapper' => array(
'grid-template-columns' => Astra_Builder_Helper::$grid_size_mapping[ $tablet_grid ],
),
'.ast-related-post-content .entry-header .ast-related-post-title, .ast-related-post-content .entry-header .ast-related-post-title a' => array(
'font-size' => astra_responsive_font( $related_post_title_font_size, 'tablet' ),
),
'.ast-related-post-content .entry-meta *' => array(
'font-size' => astra_responsive_font( $related_post_meta_font_size, 'tablet' ),
),
'.ast-related-post-excerpt' => array(
'font-size' => astra_responsive_font( $related_post_content_font_size, 'tablet' ),
),
'.ast-related-posts-title' => array(
'font-size' => astra_responsive_font( $related_posts_section_title_font_size, 'tablet' ),
),
);
if ( astra_has_global_color_format_support() ) {
if ( is_array( $related_posts_bg_color ) ) {
$css_max_tablet_output['.ast-single-related-posts-container'] = astra_get_responsive_background_obj( $related_posts_bg_color, 'desktop' );
} else {
$css_max_tablet_output['.ast-single-related-posts-container'] = array(
'background-color' => esc_attr( $related_posts_bg_color ),
);
}
}
$dynamic_css .= astra_parse_css( $css_max_tablet_output, '', astra_get_tablet_breakpoint() );
$css_max_mobile_output = array(
'.ast-single-related-posts-container .ast-related-posts-wrapper' => array(
'grid-template-columns' => Astra_Builder_Helper::$grid_size_mapping[ $mobile_grid ],
),
'.ast-related-post-content .entry-header .ast-related-post-title, .ast-related-post-content .entry-header .ast-related-post-title a' => array(
'font-size' => astra_responsive_font( $related_post_title_font_size, 'mobile' ),
),
'.ast-related-post-content .entry-meta *' => array(
'font-size' => astra_responsive_font( $related_post_meta_font_size, 'mobile' ),
),
'.ast-related-post-excerpt' => array(
'font-size' => astra_responsive_font( $related_post_content_font_size, 'mobile' ),
),
'.ast-related-posts-title' => array(
'font-size' => astra_responsive_font( $related_posts_section_title_font_size, 'mobile' ),
),
);
if ( astra_has_global_color_format_support() ) {
if ( is_array( $related_posts_bg_color ) ) {
$css_max_mobile_output['.ast-single-related-posts-container'] = astra_get_responsive_background_obj( $related_posts_bg_color, 'desktop' );
} else {
$css_max_mobile_output['.ast-single-related-posts-container'] = array(
'background-color' => esc_attr( $related_posts_bg_color ),
);
}
}
$dynamic_css .= astra_parse_css( $css_max_mobile_output, '', astra_get_mobile_breakpoint() );
$dynamic_css .= Astra_Extended_Base_Dynamic_CSS::prepare_inner_section_advanced_css( 'ast-sub-section-related-posts', '.site .ast-single-related-posts-container' );
return $dynamic_css;
}
return $dynamic_css;
}
related-posts/customizer/class-astra-related-posts-configs.php 0000644 00000137503 15032270703 0020706 0 ustar 00 false,
'is_parent' => true,
'main_index' => 'featured-image',
'clone_limit' => 2,
'title' => __( 'Featured Image', 'astra' ),
);
$related_structure_sub_controls['title-meta'] = array(
'clone' => false,
'is_parent' => true,
'main_index' => 'title-meta',
'clone_limit' => 2,
'title' => __( 'Title & Post Meta', 'astra' ),
);
$meta_config_options['category'] = array(
'clone' => false,
'is_parent' => true,
'main_index' => 'category',
'clone_limit' => 1,
'title' => __( 'Category', 'astra' ),
);
$meta_config_options['author'] = array(
'clone' => false,
'is_parent' => true,
'main_index' => 'author',
'clone_limit' => 1,
'title' => __( 'Author', 'astra' ),
);
$meta_config_options['date'] = array(
'clone' => false,
'is_parent' => true,
'main_index' => 'date',
'clone_limit' => 1,
'title' => __( 'Date', 'astra' ),
);
$meta_config_options['tag'] = array(
'clone' => false,
'is_parent' => true,
'main_index' => 'tag',
'clone_limit' => 1,
'title' => __( 'Tag', 'astra' ),
);
$_configs = array(
/**
* Option: Related Posts Query
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-section-heading]',
'section' => 'section-blog-single',
'type' => 'control',
'control' => 'ast-heading',
'title' => __( 'Related Posts', 'astra' ),
'priority' => 10,
),
array(
'name' => 'related-posts-section-ast-context-tabs',
'section' => 'ast-sub-section-related-posts',
'type' => 'control',
'control' => 'ast-builder-header-control',
'priority' => 0,
'description' => '',
'context' => array(),
),
array(
'name' => 'ast-sub-section-related-posts',
'title' => __( 'Related Posts', 'astra' ),
'type' => 'section',
'section' => $parent_section,
'panel' => '',
'priority' => 1,
),
array(
'name' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'type' => 'control',
'default' => astra_get_option( 'enable-related-posts' ),
'control' => 'ast-section-toggle',
'section' => $parent_section,
'priority' => 10,
'linked' => 'ast-sub-section-related-posts',
'linkText' => __( 'Related Posts', 'astra' ),
'divider' => array( 'ast_class' => 'ast-bottom-divider ast-bottom-section-divider' ),
),
/**
* Option: Related Posts Title
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-title]',
'default' => astra_get_option( 'related-posts-title' ),
'type' => 'control',
'section' => 'ast-sub-section-related-posts',
'priority' => 11,
'title' => __( 'Title', 'astra' ),
'control' => 'ast-text-input',
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
'transport' => 'postMessage',
'partial' => array(
'selector' => '.ast-related-posts-title-section .ast-related-posts-title',
'container_inclusive' => false,
'render_callback' => array( 'Astra_Related_Posts_Loader', 'render_related_posts_title' ),
),
'context' => array(
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
),
),
/**
* Option: Related Posts Title Alignment
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[releted-posts-title-alignment]',
'default' => astra_get_option( 'releted-posts-title-alignment' ),
'section' => 'ast-sub-section-related-posts',
'transport' => 'postMessage',
'title' => __( 'Title Alignment', 'astra' ),
'type' => 'control',
'control' => 'ast-selector',
'priority' => 11,
'responsive' => false,
'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ),
'context' => array(
Astra_Builder_Helper::$general_tab_config,
'relation' => 'AND',
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
array(
'setting' => ASTRA_THEME_SETTINGS . '[related-posts-title]',
'operator' => '!=',
'value' => '',
),
),
'choices' => array(
'left' => 'align-left',
'center' => 'align-center',
'right' => 'align-right',
),
),
/**
* Option: Related Posts Structure
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-structure]',
'type' => 'control',
'control' => 'ast-sortable',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ),
'section' => 'ast-sub-section-related-posts',
'default' => astra_get_option( 'related-posts-structure' ),
'priority' => 12,
'context' => array(
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
),
'title' => __( 'Posts Structure', 'astra' ),
'choices' => $related_structure_sub_controls,
'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ),
),
/**
* Option: Meta Data Separator.
*/
array(
'name' => 'related-metadata-separator',
'default' => astra_get_option( 'related-metadata-separator', '/' ),
'type' => 'sub-control',
'transport' => 'postMessage',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-structure]',
'linked' => 'title-meta',
'section' => 'ast-sub-section-related-posts',
'priority' => 10,
'control' => 'ast-selector',
'title' => __( 'Divider Type', 'astra' ),
'choices' => array(
'/' => '/',
'-' => '-',
'|' => '|',
'•' => '•',
'none' => __( 'None', 'astra' ),
),
'responsive' => false,
'renderAs' => 'text',
),
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-meta-structure]',
'type' => 'control',
'control' => 'ast-sortable',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_multi_choices' ),
'default' => astra_get_option( 'related-posts-meta-structure' ),
'context' => array(
Astra_Builder_Helper::$general_tab_config,
'relation' => 'AND',
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
array(
'setting' => ASTRA_THEME_SETTINGS . '[related-posts-structure]',
'operator' => 'contains',
'value' => 'title-meta',
),
),
'section' => 'ast-sub-section-related-posts',
'priority' => 12,
'title' => __( 'Meta', 'astra' ),
'choices' => array_merge(
array(
'comments' => __( 'Comments', 'astra' ),
),
$meta_config_options
),
'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ),
),
array(
'name' => 'related-posts-image-ratio-type',
'default' => astra_get_option( 'related-posts-image-ratio-type', '' ),
'type' => 'sub-control',
'transport' => 'postMessage',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-structure]',
'section' => 'ast-sub-section-related-posts',
'linked' => 'featured-image',
'priority' => 5,
'control' => 'ast-selector',
'title' => __( 'Image Ratio', 'astra' ),
'choices' => array(
'' => __( 'Original', 'astra' ),
'predefined' => __( 'Predefined', 'astra' ),
'custom' => __( 'Custom', 'astra' ),
),
'responsive' => false,
'renderAs' => 'text',
'contextual_sub_control' => true,
'input_attrs' => array(
'dependents' => array(
'' => array( 'related-posts-original-image-scale-description' ),
'predefined' => array( 'related-posts-image-ratio-pre-scale' ),
'custom' => array( 'related-posts-image-custom-scale-width', 'related-posts-image-custom-scale-height', 'related-posts-custom-image-scale-description' ),
),
),
),
array(
'name' => 'related-posts-image-ratio-pre-scale',
'default' => astra_get_option( 'related-posts-image-ratio-pre-scale' ),
'type' => 'sub-control',
'transport' => 'postMessage',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-structure]',
'linked' => 'featured-image',
'section' => 'ast-sub-section-related-posts',
'priority' => 10,
'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' => 'related-posts-image-custom-scale-width',
'default' => astra_get_option( 'related-posts-image-custom-scale-width', 16 ),
'type' => 'sub-control',
'control' => 'ast-number',
'transport' => 'postMessage',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-structure]',
'section' => 'ast-sub-section-related-posts',
'linked' => 'featured-image',
'priority' => 11,
'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' => 'related-posts-image-custom-scale-height',
'default' => astra_get_option( 'related-posts-image-custom-scale-height', 9 ),
'type' => 'sub-control',
'control' => 'ast-number',
'transport' => 'postMessage',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-structure]',
'section' => 'ast-sub-section-related-posts',
'linked' => 'featured-image',
'priority' => 12,
'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' => 'related-posts-custom-image-scale-description',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-structure]',
'linked' => 'featured-image',
'type' => 'sub-control',
'control' => 'ast-description',
'section' => 'ast-sub-section-related-posts',
'priority' => 14,
'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' => 'related-posts-image-size',
'default' => astra_get_option( 'related-posts-image-size', 'large' ),
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-structure]',
'section' => 'ast-sub-section-related-posts',
'linked' => 'featured-image',
'type' => 'sub-control',
'priority' => 17,
'transport' => 'postMessage',
'title' => __( 'Image Size', 'astra' ),
'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ),
'control' => 'ast-select',
'choices' => astra_get_site_image_sizes(),
'description' => __( 'Note: Image Size & Ratio won\'t work if Image Position set as Background.', 'astra' ),
),
array(
'name' => 'related-posts-author-prefix-label',
'default' => astra_get_option( 'related-posts-author-prefix-label', astra_default_strings( 'string-blog-meta-author-by', false ) ),
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-meta-structure]',
'linked' => 'author',
'type' => 'sub-control',
'control' => 'ast-text-input',
'section' => 'ast-sub-section-related-posts',
'divider' => array( 'ast_class' => 'ast-bottom-dotted-divider ast-bottom-section-spacing' ),
'title' => __( 'Prefix Label', 'astra' ),
'priority' => 1,
'transport' => 'postMessage',
),
array(
'name' => 'related-posts-author-avatar',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-meta-structure]',
'default' => astra_get_option( 'related-posts-author-avatar' ),
'linked' => 'author',
'type' => 'sub-control',
'control' => 'ast-toggle',
'section' => 'ast-sub-section-related-posts',
'priority' => 5,
'title' => __( 'Author Avatar', 'astra' ),
'transport' => 'postMessage',
),
array(
'name' => 'related-posts-author-avatar-size',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-meta-structure]',
'default' => astra_get_option( 'related-posts-author-avatar-size', 30 ),
'linked' => 'author',
'type' => 'sub-control',
'control' => 'ast-slider',
'transport' => 'postMessage',
'section' => 'ast-sub-section-related-posts',
'priority' => 10,
'title' => __( 'Image Size', 'astra' ),
'suffix' => 'px',
'input_attrs' => array(
'min' => 1,
'step' => 1,
'max' => 200,
),
),
array(
'name' => 'related-posts-meta-date-type',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-meta-structure]',
'type' => 'sub-control',
'control' => 'ast-selector',
'section' => 'ast-sub-section-related-posts',
'default' => astra_get_option( 'related-posts-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-dotted-divider ast-bottom-spacing' ),
'responsive' => false,
'renderAs' => 'text',
),
array(
'name' => 'related-posts-date-format',
'default' => astra_get_option( 'related-posts-date-format', '' ),
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-meta-structure]',
'linked' => 'date',
'type' => 'sub-control',
'control' => 'ast-select',
'section' => 'ast-sub-section-related-posts',
'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',
),
),
array(
'name' => 'related-posts-category-style',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-meta-structure]',
'type' => 'sub-control',
'control' => 'ast-selector',
'section' => 'ast-sub-section-related-posts',
'default' => astra_get_option( 'related-posts-category-style', '' ),
'priority' => 2,
'linked' => 'category',
'transport' => 'refresh',
'title' => __( 'Style', 'astra' ),
'choices' => array(
'none' => __( 'Default', 'astra' ),
'badge' => __( 'Badge', 'astra' ),
'underline' => __( 'Underline', 'astra' ),
),
'responsive' => false,
'renderAs' => 'text',
),
array(
'name' => 'related-posts-tag-style',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-meta-structure]',
'type' => 'sub-control',
'control' => 'ast-selector',
'section' => 'ast-sub-section-related-posts',
'default' => astra_get_option( 'related-posts-tag-style', '' ),
'priority' => 2,
'linked' => 'tag',
'transport' => 'refresh',
'title' => __( 'Style', 'astra' ),
'choices' => array(
'none' => __( 'Default', 'astra' ),
'badge' => __( 'Badge', 'astra' ),
'underline' => __( 'Underline', 'astra' ),
),
'responsive' => false,
'renderAs' => 'text',
),
/**
* Option: Enable excerpt for Related Posts.
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[enable-related-posts-excerpt]',
'default' => astra_get_option( 'enable-related-posts-excerpt' ),
'type' => 'control',
'control' => 'ast-toggle-control',
'title' => __( 'Enable Post Excerpt', 'astra' ),
'section' => 'ast-sub-section-related-posts',
'priority' => 12,
'context' => array(
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
),
'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ),
),
/**
* Option: Excerpt word count for Related Posts
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-excerpt-count]',
'default' => astra_get_option( 'related-posts-excerpt-count' ),
'type' => 'control',
'control' => 'ast-slider',
'context' => array(
Astra_Builder_Helper::$general_tab_config,
'relation' => 'AND',
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts-excerpt]',
'operator' => '==',
'value' => true,
),
),
'section' => 'ast-sub-section-related-posts',
'title' => __( 'Excerpt Word Count', 'astra' ),
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
'priority' => 12,
'input_attrs' => array(
'min' => 0,
'step' => 1,
'max' => 60,
),
),
/**
* Option: No. of Related Posts
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-total-count]',
'default' => astra_get_option( 'related-posts-total-count' ),
'type' => 'control',
'control' => 'ast-slider',
'context' => array(
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
),
'section' => 'ast-sub-section-related-posts',
'title' => __( 'Total Number of Related Posts', 'astra' ),
'priority' => 11,
'input_attrs' => array(
'min' => 1,
'step' => 1,
'max' => 20,
),
'divider' => array( 'ast_class' => 'ast-top-dotted-divider ast-bottom-dotted-divider' ),
),
/**
* Option: Related Posts Columns
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-grid-responsive]',
'type' => 'control',
'control' => 'ast-selector',
'section' => 'ast-sub-section-related-posts',
'default' => astra_get_option( 'related-posts-grid-responsive' ),
'priority' => 11,
'context' => array(
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
),
'title' => __( 'Grid Column Layout', 'astra' ),
'choices' => array(
'full' => __( '1', 'astra' ),
'2-equal' => __( '2', 'astra' ),
'3-equal' => __( '3', 'astra' ),
'4-equal' => __( '4', 'astra' ),
),
'responsive' => true,
'renderAs' => 'text',
'divider' => array( 'ast_class' => 'ast-bottom-dotted-divider' ),
),
/**
* Option: Related Posts Query group setting
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-query-group]',
'default' => astra_get_option( 'related-posts-query-group' ),
'type' => 'control',
'transport' => 'postMessage',
'control' => 'ast-settings-group',
'context' => array(
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
),
'title' => __( 'Posts Query', 'astra' ),
'section' => 'ast-sub-section-related-posts',
'priority' => 11,
),
/**
* Option: Related Posts based on.
*/
array(
'name' => 'related-posts-based-on',
'default' => astra_get_option( 'related-posts-based-on' ),
'type' => 'sub-control',
'transport' => 'postMessage',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-query-group]',
'section' => 'ast-sub-section-related-posts',
'priority' => 1,
'control' => 'ast-selector',
'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ),
'title' => __( 'Related Posts by', 'astra' ),
'choices' => array(
'categories' => __( 'Categories', 'astra' ),
'tags' => __( 'Tags', 'astra' ),
),
'responsive' => false,
'renderAs' => 'text',
),
/**
* Option: Display Post Structure
*/
array(
'name' => 'related-posts-order-by',
'default' => astra_get_option( 'related-posts-order-by' ),
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-query-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ),
'priority' => 2,
'transport' => 'postMessage',
'title' => __( 'Order by', 'astra' ),
'control' => 'ast-select',
'choices' => array(
'date' => __( 'Date', 'astra' ),
'title' => __( 'Title', 'astra' ),
'menu_order' => __( 'Post Order', 'astra' ),
'rand' => __( 'Random', 'astra' ),
'comment_count' => __( 'Comment Counts', 'astra' ),
),
),
/**
* Option: Display Post Structure
*/
array(
'name' => 'related-posts-order',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-query-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'transport' => 'postMessage',
'title' => __( 'Order', 'astra' ),
'default' => astra_get_option( 'related-posts-order' ),
'control' => 'ast-selector',
'priority' => 3,
'choices' => array(
'asc' => __( 'Ascending', 'astra' ),
'desc' => __( 'Descending', 'astra' ),
),
'responsive' => false,
'renderAs' => 'text',
),
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-box-placement]',
'default' => astra_get_option( 'related-posts-box-placement' ),
'type' => 'control',
'section' => 'ast-sub-section-related-posts',
'priority' => 12,
'title' => __( 'Section Placement', 'astra' ),
'control' => 'ast-selector',
'description' => __( 'Decide whether to isolate or integrate the module with the entry content area.', 'astra' ),
'divider' => array( 'ast_class' => 'ast-top-dotted-divider' ),
'choices' => array(
'default' => __( 'Default', 'astra' ),
'inside' => __( 'Contained', 'astra' ),
'outside' => __( 'Separated', 'astra' ),
),
'context' => array(
Astra_Builder_Helper::$general_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
),
'responsive' => false,
'renderAs' => 'text',
),
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-outside-location]',
'default' => astra_get_option( 'related-posts-outside-location' ),
'type' => 'control',
'section' => 'ast-sub-section-related-posts',
'priority' => 12,
'title' => __( 'Location', 'astra' ),
'control' => 'ast-selector',
'choices' => array(
'below' => __( 'Below Comments', 'astra' ),
'above' => __( 'Above Comments', 'astra' ),
),
'description' => __( 'To sync this option with comments, use the same positioning for both sections: Contained or Separated.', 'astra' ),
'divider' => array( 'ast_class' => 'ast-top-section-spacing' ),
'context' => array(
Astra_Builder_Helper::$general_tab_config,
'relation' => 'AND',
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
array(
'setting' => ASTRA_THEME_SETTINGS . '[related-posts-box-placement]',
'operator' => '!=',
'value' => 'default',
),
),
'responsive' => false,
'renderAs' => 'text',
),
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-container-width]',
'default' => astra_get_option( 'related-posts-container-width' ),
'type' => 'control',
'section' => 'ast-sub-section-related-posts',
'priority' => 12,
'title' => __( 'Container Structure', 'astra' ),
'control' => 'ast-selector',
'choices' => array(
'narrow' => __( 'Narrow', 'astra' ),
'' => __( 'Full Width', 'astra' ),
),
'divider' => array( 'ast_class' => 'ast-top-section-spacing' ),
'context' => array(
Astra_Builder_Helper::$general_tab_config,
'relation' => 'AND',
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
array(
'setting' => ASTRA_THEME_SETTINGS . '[related-posts-box-placement]',
'operator' => '==',
'value' => 'outside',
),
),
'responsive' => false,
'renderAs' => 'text',
),
/**
* Option: Related Posts colors setting group
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-colors-group]',
'default' => astra_get_option( 'related-posts-colors-group' ),
'type' => 'control',
'transport' => 'postMessage',
'control' => 'ast-settings-group',
'context' => array(
Astra_Builder_Helper::$design_tab_config,
'relation' => 'AND',
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
array(
'setting' => ASTRA_THEME_SETTINGS . '[related-posts-structure]',
'operator' => 'contains',
'value' => 'title-meta',
),
),
'title' => __( 'Content Colors', 'astra' ),
'section' => 'ast-sub-section-related-posts',
'priority' => 15,
),
/**
* Option: Related Posts title typography setting group
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-section-title-typography-group]',
'type' => 'control',
'priority' => 16,
'control' => 'ast-settings-group',
'context' => array(
Astra_Builder_Helper::$design_tab_config,
'relation' => 'AND',
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
array(
'setting' => ASTRA_THEME_SETTINGS . '[related-posts-title]',
'operator' => '!=',
'value' => '',
),
),
'title' => __( 'Section Title Font', 'astra' ),
'section' => 'ast-sub-section-related-posts',
'transport' => 'postMessage',
),
/**
* Option: Related Posts title typography setting group
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-title-typography-group]',
'type' => 'control',
'priority' => 17,
'control' => 'ast-settings-group',
'context' => array(
Astra_Builder_Helper::$design_tab_config,
'relation' => 'AND',
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
array(
'setting' => ASTRA_THEME_SETTINGS . '[related-posts-structure]',
'operator' => 'contains',
'value' => 'title-meta',
),
),
'title' => __( 'Post Title Font', 'astra' ),
'section' => 'ast-sub-section-related-posts',
'transport' => 'postMessage',
),
/**
* Option: Related Posts meta typography setting group
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-meta-typography-group]',
'type' => 'control',
'priority' => 18,
'control' => 'ast-settings-group',
'context' => array(
Astra_Builder_Helper::$design_tab_config,
'relation' => 'AND',
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
array(
'setting' => ASTRA_THEME_SETTINGS . '[related-posts-structure]',
'operator' => 'contains',
'value' => 'title-meta',
),
),
'title' => __( 'Meta Font', 'astra' ),
'section' => 'ast-sub-section-related-posts',
'transport' => 'postMessage',
),
/**
* Option: Related Posts content typography setting group
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-content-typography-group]',
'type' => 'control',
'priority' => 21,
'control' => 'ast-settings-group',
'context' => array(
Astra_Builder_Helper::$design_tab_config,
'relation' => 'AND',
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts-excerpt]',
'operator' => '==',
'value' => true,
),
),
'title' => __( 'Content Font', 'astra' ),
'section' => 'ast-sub-section-related-posts',
'transport' => 'postMessage',
),
/**
* Option: Related post block text color
*/
array(
'name' => 'related-posts-text-color',
'tab' => __( 'Normal', 'astra' ),
'type' => 'sub-control',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-colors-group]',
'section' => 'ast-sub-section-related-posts',
'default' => astra_get_option( 'related-posts-text-color' ),
'transport' => 'postMessage',
'control' => 'ast-color',
'title' => __( 'Text Color', 'astra' ),
),
/**
* Option: Related post block CTA link color
*/
array(
'name' => 'related-posts-link-color',
'tab' => __( 'Normal', 'astra' ),
'type' => 'sub-control',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-colors-group]',
'section' => 'ast-sub-section-related-posts',
'default' => astra_get_option( 'related-posts-link-color' ),
'transport' => 'postMessage',
'control' => 'ast-color',
'title' => __( 'Link Color', 'astra' ),
),
/**
* Option: Related post block BG color
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-title-color]',
'default' => astra_get_option( 'related-posts-title-color' ),
'type' => 'control',
'control' => 'ast-color',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
'section' => 'ast-sub-section-related-posts',
'transport' => 'postMessage',
'priority' => 14,
'context' => array(
Astra_Builder_Helper::$design_tab_config,
'relation' => 'AND',
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
array(
'setting' => ASTRA_THEME_SETTINGS . '[related-posts-title]',
'operator' => '!=',
'value' => '',
),
),
'title' => __( 'Section Title', 'astra' ),
'divider' => array( 'ast_class' => 'ast-top-section-spacing' ),
),
/**
* Option: Related post block BG color
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[related-posts-background-color]',
'default' => astra_get_option( 'related-posts-background-color' ),
'type' => 'control',
'control' => 'ast-color',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_alpha_color' ),
'section' => 'ast-sub-section-related-posts',
'transport' => 'postMessage',
'priority' => 14,
'context' => array(
Astra_Builder_Helper::$design_tab_config,
array(
'setting' => ASTRA_THEME_SETTINGS . '[enable-related-posts]',
'operator' => '==',
'value' => true,
),
),
'title' => __( 'Section Background', 'astra' ),
'divider' => array( 'ast_class' => 'ast-bottom-dotted-divider' ),
),
/**
* Option: Related post meta color
*/
array(
'name' => 'related-posts-meta-color',
'default' => astra_get_option( 'related-posts-meta-color' ),
'tab' => __( 'Normal', 'astra' ),
'type' => 'sub-control',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-colors-group]',
'section' => 'ast-sub-section-related-posts',
'transport' => 'postMessage',
'control' => 'ast-color',
'title' => __( 'Meta Color', 'astra' ),
),
/**
* Option: Related hover CTA link color
*/
array(
'name' => 'related-posts-link-hover-color',
'type' => 'sub-control',
'tab' => __( 'Hover', 'astra' ),
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-colors-group]',
'section' => 'ast-sub-section-related-posts',
'control' => 'ast-color',
'default' => astra_get_option( 'related-posts-link-hover-color' ),
'transport' => 'postMessage',
'title' => __( 'Link Color', 'astra' ),
),
/**
* Option: Related hover meta link color
*/
array(
'name' => 'related-posts-meta-link-hover-color',
'type' => 'sub-control',
'tab' => __( 'Hover', 'astra' ),
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-colors-group]',
'section' => 'ast-sub-section-related-posts',
'control' => 'ast-color',
'default' => astra_get_option( 'related-posts-meta-link-hover-color' ),
'transport' => 'postMessage',
'title' => __( 'Meta Link Color', 'astra' ),
),
/**
* Option: Related Posts Title Font Family
*/
array(
'name' => 'related-posts-title-font-family',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-title-typography-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'control' => 'ast-font',
'font_type' => 'ast-font-family',
'default' => astra_get_option( 'related-posts-title-font-family' ),
'title' => __( 'Font Family', 'astra' ),
'connect' => ASTRA_THEME_SETTINGS . '[related-posts-title-font-weight]',
'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ),
),
/**
* Option: Related Posts Title Font Weight
*/
array(
'name' => 'related-posts-title-font-weight',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-title-typography-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'control' => 'ast-font',
'font_type' => 'ast-font-weight',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ),
'default' => astra_get_option( 'related-posts-title-font-weight' ),
'title' => __( 'Font Weight', 'astra' ),
'connect' => 'related-posts-title-font-family',
'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ),
),
/**
* Option: Related Posts Title Font Size
*/
array(
'name' => 'related-posts-title-font-size',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-title-typography-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'control' => 'ast-responsive-slider',
'default' => astra_get_option( 'related-posts-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: Related Posts Title Font Extras
*/
array(
'name' => 'related-posts-title-font-extras',
'type' => 'sub-control',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-title-typography-group]',
'control' => 'ast-font-extras',
'section' => 'ast-sub-section-related-posts',
'default' => astra_get_option( 'related-posts-title-font-extras' ),
'title' => __( 'Font Extras', 'astra' ),
),
/**
* Option: Related Posts Title Font Family
*/
array(
'name' => 'related-posts-section-title-font-family',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-section-title-typography-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'control' => 'ast-font',
'font_type' => 'ast-font-family',
'default' => astra_get_option( 'related-posts-section-title-font-family' ),
'title' => __( 'Font Family', 'astra' ),
'connect' => ASTRA_THEME_SETTINGS . '[related-posts-section-title-font-weight]',
'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ),
),
/**
* Option: Related Posts Title Font Weight
*/
array(
'name' => 'related-posts-section-title-font-weight',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-section-title-typography-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'control' => 'ast-font',
'font_type' => 'ast-font-weight',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ),
'default' => astra_get_option( 'related-posts-section-title-font-weight' ),
'title' => __( 'Font Weight', 'astra' ),
'connect' => 'related-posts-section-title-font-family',
'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ),
),
/**
* Option: Related Posts Title Font Size
*/
array(
'name' => 'related-posts-section-title-font-size',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-section-title-typography-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'control' => 'ast-responsive-slider',
'default' => astra_get_option( 'related-posts-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' => 0.01,
'max' => 20,
),
'vw' => array(
'min' => 0,
'step' => 0.1,
'max' => 25,
),
'rem' => array(
'min' => 0,
'step' => 0.1,
'max' => 20,
),
),
),
/**
* Option: Related Posts Title Font Extras
*/
array(
'name' => 'related-posts-section-title-font-extras',
'type' => 'sub-control',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-section-title-typography-group]',
'control' => 'ast-font-extras',
'section' => 'ast-sub-section-related-posts',
'default' => astra_get_option( 'related-posts-section-title-font-extras' ),
'title' => __( 'Font Extras', 'astra' ),
),
/**
* Option: Related Posts Meta Font Family
*/
array(
'name' => 'related-posts-meta-font-family',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-meta-typography-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'control' => 'ast-font',
'font_type' => 'ast-font-family',
'default' => astra_get_option( 'related-posts-meta-font-family' ),
'title' => __( 'Font Family', 'astra' ),
'connect' => ASTRA_THEME_SETTINGS . '[related-posts-meta-font-weight]',
'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ),
),
/**
* Option: Related Posts Meta Font Weight
*/
array(
'name' => 'related-posts-meta-font-weight',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-meta-typography-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'control' => 'ast-font',
'font_type' => 'ast-font-weight',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ),
'default' => astra_get_option( 'related-posts-meta-font-weight' ),
'title' => __( 'Font Weight', 'astra' ),
'connect' => 'related-posts-meta-font-family',
'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ),
),
/**
* Option: Related Posts Meta Font Size
*/
array(
'name' => 'related-posts-meta-font-size',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-meta-typography-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'control' => 'ast-responsive-slider',
'default' => astra_get_option( 'related-posts-meta-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: Related Posts Meta Font Extras
*/
array(
'name' => 'related-posts-meta-font-extras',
'type' => 'sub-control',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-meta-typography-group]',
'control' => 'ast-font-extras',
'section' => 'ast-sub-section-related-posts',
'default' => astra_get_option( 'related-posts-meta-font-extras' ),
'title' => __( 'Font Extras', 'astra' ),
),
/**
* Option: Related Posts Content Font Family
*/
array(
'name' => 'related-posts-content-font-family',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-content-typography-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'control' => 'ast-font',
'font_type' => 'ast-font-family',
'default' => astra_get_option( 'related-posts-content-font-family' ),
'title' => __( 'Font Family', 'astra' ),
'connect' => ASTRA_THEME_SETTINGS . '[related-posts-content-font-weight]',
'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ),
),
/**
* Option: Related Posts Content Font Weight
*/
array(
'name' => 'related-posts-content-font-weight',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-content-typography-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'control' => 'ast-font',
'font_type' => 'ast-font-weight',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ),
'default' => astra_get_option( 'related-posts-content-font-weight' ),
'title' => __( 'Font Weight', 'astra' ),
'connect' => 'related-posts-content-font-family',
'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ),
),
/**
* Option: Related Posts Content Font Size
*/
array(
'name' => 'related-posts-content-font-size',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-content-typography-group]',
'section' => 'ast-sub-section-related-posts',
'type' => 'sub-control',
'control' => 'ast-responsive-slider',
'default' => astra_get_option( 'related-posts-content-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: Related Posts Content Font Extras.
*/
/**
* Option: Related Posts Meta Font Extras
*/
array(
'name' => 'related-posts-content-font-extras',
'type' => 'sub-control',
'parent' => ASTRA_THEME_SETTINGS . '[related-posts-content-typography-group]',
'control' => 'ast-font-extras',
'section' => 'ast-sub-section-related-posts',
'default' => astra_get_option( 'related-posts-content-font-extras' ),
'title' => __( 'Font Extras', 'astra' ),
),
);
$_configs = array_merge( $_configs, Astra_Extended_Base_Configuration::prepare_section_spacing_border_options( 'ast-sub-section-related-posts' ) );
$configurations = array_merge( $configurations, $_configs );
return $configurations;
}
}
/**
* Kicking this off by creating NEW instance.
*/
new Astra_Related_Posts_Configs();
related-posts/class-astra-related-posts-loader.php 0000644 00000026557 15032270703 0016326 0 ustar 00 '2-equal',
'tablet' => '2-equal',
'mobile' => 'full',
);
$defaults['related-posts-structure'] = array(
'featured-image',
'title-meta',
);
$defaults['related-posts-tag-style'] = 'none';
$defaults['related-posts-category-style'] = 'none';
$defaults['related-posts-date-format'] = '';
$defaults['related-posts-meta-date-type'] = 'published';
$defaults['related-posts-author-avatar-size'] = '';
$defaults['related-posts-author-avatar'] = false;
$defaults['related-posts-author-prefix-label'] = astra_default_strings( 'string-blog-meta-author-by', false );
$defaults['related-posts-image-size'] = '';
$defaults['related-posts-image-custom-scale-width'] = 16;
$defaults['related-posts-image-custom-scale-height'] = 9;
$defaults['related-posts-image-ratio-pre-scale'] = '16/9';
$defaults['related-posts-image-ratio-type'] = '';
$defaults['related-posts-meta-structure'] = array(
'comments',
'category',
'author',
);
// Related Posts - Color styles.
$defaults['related-posts-text-color'] = $apply_new_default_color_typo_values ? 'var(--ast-global-color-2)' : '';
$defaults['related-posts-link-color'] = '';
$defaults['related-posts-title-color'] = $apply_new_default_color_typo_values ? 'var(--ast-global-color-2)' : '';
$defaults['related-posts-background-color'] = '';
$defaults['related-posts-meta-color'] = '';
$defaults['related-posts-link-hover-color'] = '';
$defaults['related-posts-meta-link-hover-color'] = '';
// Related Posts - Title typo.
$defaults['related-posts-section-title-font-family'] = 'inherit';
$defaults['related-posts-section-title-font-weight'] = 'inherit';
$defaults['related-posts-section-title-text-transform'] = '';
$defaults['related-posts-section-title-line-height'] = $apply_new_default_color_typo_values ? '1.25' : '';
$defaults['related-posts-section-title-font-extras'] = array(
'line-height' => ! isset( $astra_options['related-posts-section-title-font-extras'] ) && isset( $astra_options['related-posts-section-title-line-height'] ) ? $astra_options['related-posts-section-title-line-height'] : '1.6',
'line-height-unit' => 'em',
'letter-spacing' => '',
'letter-spacing-unit' => 'px',
'text-transform' => ! isset( $astra_options['related-posts-section-title-font-extras'] ) && isset( $astra_options['related-posts-section-title-text-transform'] ) ? $astra_options['related-posts-section-title-text-transform'] : '',
'text-decoration' => '',
);
$defaults['related-posts-section-title-font-size'] = array(
'desktop' => $apply_new_default_color_typo_values ? '26' : '30',
'tablet' => '',
'mobile' => '',
'desktop-unit' => 'px',
'tablet-unit' => 'px',
'mobile-unit' => 'px',
);
// Related Posts - Title typo.
$defaults['related-posts-title-font-family'] = 'inherit';
$defaults['related-posts-title-font-weight'] = $apply_new_default_color_typo_values ? '500' : 'inherit';
$defaults['related-posts-title-text-transform'] = '';
$defaults['related-posts-title-line-height'] = '1';
$defaults['related-posts-title-font-size'] = array(
'desktop' => '20',
'tablet' => '',
'mobile' => '',
'desktop-unit' => 'px',
'tablet-unit' => 'px',
'mobile-unit' => 'px',
);
$defaults['related-posts-title-font-extras'] = array(
'line-height' => ! isset( $astra_options['related-posts-title-font-extras'] ) && isset( $astra_options['related-posts-title-line-height'] ) ? $astra_options['related-posts-title-line-height'] : ( $astra_blog_update ? '1.5' : '1' ),
'line-height-unit' => 'em',
'letter-spacing' => '',
'letter-spacing-unit' => 'px',
'text-transform' => ! isset( $astra_options['related-posts-title-font-extras'] ) && isset( $astra_options['related-posts-title-text-transform'] ) ? $astra_options['related-posts-title-text-transform'] : '',
'text-decoration' => '',
);
// Related Posts - Meta typo.
$defaults['related-posts-meta-font-family'] = 'inherit';
$defaults['related-posts-meta-font-weight'] = 'inherit';
$defaults['related-posts-meta-text-transform'] = '';
$defaults['related-posts-meta-line-height'] = '';
$defaults['related-posts-meta-font-size'] = array(
'desktop' => '14',
'tablet' => '',
'mobile' => '',
'desktop-unit' => 'px',
'tablet-unit' => 'px',
'mobile-unit' => 'px',
);
$defaults['related-posts-meta-font-extras'] = array(
'line-height' => ! isset( $astra_options['related-posts-meta-font-extras'] ) && isset( $astra_options['related-posts-meta-line-height'] ) ? $astra_options['related-posts-meta-line-height'] : '1.6',
'line-height-unit' => 'em',
'letter-spacing' => '',
'letter-spacing-unit' => 'px',
'text-transform' => ! isset( $astra_options['related-posts-meta-font-extras'] ) && isset( $astra_options['related-posts-meta-text-transform'] ) ? $astra_options['related-posts-meta-text-transform'] : '',
'text-decoration' => '',
);
// Related Posts - Content typo.
$defaults['related-posts-content-font-family'] = 'inherit';
$defaults['related-posts-content-font-weight'] = 'inherit';
$defaults['related-posts-content-font-extras'] = array(
'line-height' => ! isset( $astra_options['related-posts-content-font-extras'] ) && isset( $astra_options['related-posts-content-line-height'] ) ? $astra_options['related-posts-content-line-height'] : '',
'line-height-unit' => 'em',
'letter-spacing' => '',
'letter-spacing-unit' => 'px',
'text-transform' => ! isset( $astra_options['related-posts-content-font-extras'] ) && isset( $astra_options['related-posts-content-text-transform'] ) ? $astra_options['related-posts-content-text-transform'] : '',
'text-decoration' => '',
);
$defaults['related-posts-content-font-size'] = array(
'desktop' => '',
'tablet' => '',
'mobile' => '',
'desktop-unit' => 'px',
'tablet-unit' => 'px',
'mobile-unit' => 'px',
);
$defaults['ast-sub-section-related-posts-padding'] = array(
'desktop' => array(
'top' => 2.5,
'right' => 2.5,
'bottom' => 2.5,
'left' => 2.5,
),
'tablet' => array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
),
'mobile' => array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
),
'desktop-unit' => 'em',
'tablet-unit' => 'em',
'mobile-unit' => 'em',
);
$defaults['ast-sub-section-related-posts-margin'] = array(
'desktop' => array(
'top' => 2,
'right' => '',
'bottom' => '',
'left' => '',
),
'tablet' => array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
),
'mobile' => array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
),
'desktop-unit' => 'em',
'tablet-unit' => 'em',
'mobile-unit' => 'em',
);
return $defaults;
}
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*
* @since 3.5.0
*/
public function related_posts_customize_register( $wp_customize ) {
/**
* Register Config control in Related Posts.
*/
// @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
require_once ASTRA_RELATED_POSTS_DIR . 'customizer/class-astra-related-posts-configs.php';
// @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
}
/**
* Render the Related Posts title for the selective refresh partial.
*
* @since 3.5.0
*/
public function render_related_posts_title() {
return astra_get_option( 'related-posts-title' );
}
}
/**
* Kicking this off by creating NEW instace.
*/
new Astra_Related_Posts_Loader();
related-posts/class-astra-related-posts.php 0000644 00000002435 15032270703 0015047 0 ustar 00