astra_primary_class_blog_layout( array $classes )

Add Blog Layout Class


Description


Parameters

$classes

(array) (Required) Body Class Array.


Return

(array)


Source

File: inc/blog/blog.php

function astra_primary_class_blog_layout( $classes ) {

		// Apply grid class to archive page.
	if ( ( is_home() ) || is_archive() || is_search() ) {

		$blog_layout = astra_get_blog_layout();

		/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
		if ( ! ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'blog-pro' ) ) ) {
			/** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort

			// If a old pro user has used blog-layout-1 to 3 and disabled astra addon then moved layout to 'blog-layout-4'.
			if ( 'blog-layout-1' == $blog_layout || 'blog-layout-2' === $blog_layout || 'blog-layout-3' === $blog_layout ) {
				$blog_layout = 'blog-layout-4';
			}

			if ( 'blog-layout-4' == $blog_layout || 'blog-layout-5' === $blog_layout || 'blog-layout-6' === $blog_layout ) {
				$classes[] = 'ast-grid-3';

			}
		}

		if ( 'blog-layout-4' == $blog_layout || 'blog-layout-5' === $blog_layout || 'blog-layout-6' === $blog_layout ) {
			$classes[] = 'ast-' . esc_attr( $blog_layout ) . '-grid';

		}

		$classes = apply_filters( 'astra_primary_class_blog_grid', $classes );
	}

	return $classes;
}

Changelog

Changelog
Version Description
4.6.0 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.