Astra_Ext_Blog_Pro_Markup::astra_post_class_blog_grid( array $classes )
Add Post Class Blog Grid
Description
Parameters
- $classes
-
(array) (Required) Body Class Array.
Return
(array)
Source
File: addons/blog-pro/classes/class-astra-ext-blog-pro-markup.php
public function astra_post_class_blog_grid( $classes ) {
$wp_doing_ajax = wp_doing_ajax();
if ( is_archive() || is_home() || is_search() || $wp_doing_ajax ) {
global $wp_query;
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$blog_grid = astra_get_option( 'blog-grid' );
$blog_grid_layout = astra_get_option( 'blog-grid-layout' );
$blog_layout = astra_get_option( 'blog-layout' );
$first_post_full_width = astra_get_option( 'first-post-full-width' );
$blog_masonry = astra_get_option( 'blog-masonry' );
$remove_featured_padding = astra_get_option( 'blog-featured-image-padding' );
$blog_space_bet_posts = astra_get_option( 'blog-space-bet-posts' );
if ( $wp_doing_ajax ) {
$classes[] = 'ast-col-sm-12';
$classes[] = 'ast-article-post';
}
if ( 'blog-layout-1' == $blog_layout ) {
if ( $remove_featured_padding ) {
$classes[] = 'remove-featured-img-padding';
}
if ( $blog_grid > 1 && $first_post_full_width && ! $blog_masonry && 0 == $wp_query->current_post && 1 == $paged ) {
// Feature Post.
if ( 3 == $blog_grid ) {
$classes[] = Astra_Addon_Builder_Helper::apply_flex_based_css() ? 'ast-width-md-66' : 'ast-col-md-8';
} elseif ( 4 == $blog_grid ) {
$classes[] = Astra_Addon_Builder_Helper::apply_flex_based_css() ? 'ast-width-50' : 'ast-col-md-6';
} else {
$classes[] = Astra_Addon_Builder_Helper::apply_flex_based_css() ? 'ast-grid-common-col' : 'ast-col-md-12';
}
$classes[] = 'ast-featured-post';
} else {
$classes[] = Astra_Addon_Builder_Helper::apply_flex_based_css() ? 'ast-width-md-' . ( 12 / $blog_grid ) : 'ast-col-md-' . ( 12 / $blog_grid );
}
} else {
if ( $blog_grid_layout > 1 && $first_post_full_width && ! $blog_masonry && 0 == $wp_query->current_post && 1 == $paged ) {
// Feature Post.
$classes[] = 'ast-col-md-12';
$classes[] = 'ast-featured-post';
} else {
$classes[] = Astra_Addon_Builder_Helper::apply_flex_based_css() ? 'ast-width-md-' . ( 12 / $blog_grid_layout ) : 'ast-col-md-' . ( 12 / $blog_grid_layout );
}
}
if ( true === astra_addon_builder_helper()->is_header_footer_builder_active ) {
$classes[] = 'ast-archive-post';
}
if ( $blog_space_bet_posts ) {
$classes[] = 'ast-separate-posts';
}
} elseif ( is_singular() ) {
$blog_layout = astra_get_option( 'blog-layout' );
$remove_featured_padding = astra_get_option( 'single-featured-image-padding' );
if ( 'blog-layout-1' == $blog_layout && $remove_featured_padding ) {
$classes[] = 'remove-featured-img-padding';
}
}
return $classes;
}
Expand full source code Collapse full source code View on Trac