Astra_Get_Blog_Archive::execute( array $args )

Execute the ability.


Description


Parameters

$args

(array) (Required) Input arguments.


Return

(array) Result array.


Source

File: inc/abilities/customizer/posttypes/blog/class-astra-get-blog-archive.php

	public function execute( $args ) {
		$blog_layout    = astra_get_option( 'blog-layout', 'blog-layout-5' );
		$posts_per_page = astra_get_option( 'blog-post-per-page', get_option( 'posts_per_page', 10 ) );
		$sidebar_layout = astra_get_option( 'site-sidebar-layout', 'right-sidebar' );
		$sidebar_style  = astra_get_option( 'site-sidebar-style', 'unboxed' );
		$sidebar_width  = astra_get_option( 'site-sidebar-width', 30 );

		$layout_labels = array(
			'blog-layout-classic' => 'Classic Layout',
			'blog-layout-1'       => 'Layout 1',
			'blog-layout-2'       => 'Layout 2',
			'blog-layout-3'       => 'Layout 3',
			'blog-layout-4'       => 'Grid',
			'blog-layout-5'       => 'List',
			'blog-layout-6'       => 'Cover',
		);

		$sidebar_layout_labels = array(
			'no-sidebar'    => 'No Sidebar',
			'left-sidebar'  => 'Left Sidebar',
			'right-sidebar' => 'Right Sidebar',
		);

		$sidebar_style_labels = array(
			'unboxed' => 'Unboxed',
			'boxed'   => 'Boxed',
		);

		$blog_layout_name    = isset( $layout_labels[ $blog_layout ] ) ? $layout_labels[ $blog_layout ] : $blog_layout;
		$sidebar_layout_name = isset( $sidebar_layout_labels[ $sidebar_layout ] ) ? $sidebar_layout_labels[ $sidebar_layout ] : $sidebar_layout;
		$sidebar_style_name  = isset( $sidebar_style_labels[ $sidebar_style ] ) ? $sidebar_style_labels[ $sidebar_style ] : $sidebar_style;

		return Astra_Abilities_Response::success(
			/* translators: 1: blog layout name, 2: posts per page, 3: sidebar layout name, 4: sidebar style name, 5: sidebar width */
			sprintf(
				__( 'Your blog archive is using the "%1$s" layout with %2$d posts per page. Sidebar is set to "%3$s" (%4$s style, %5$d%% width).', 'astra' ),
				$blog_layout_name,
				(int) $posts_per_page,
				$sidebar_layout_name,
				$sidebar_style_name,
				(int) $sidebar_width
			),
			array(
				'blog_layout'               => $blog_layout,
				'blog_layout_label'         => $blog_layout_name,
				'posts_per_page'            => (int) $posts_per_page,
				'sidebar_layout'            => $sidebar_layout,
				'sidebar_layout_label'      => $sidebar_layout_name,
				'sidebar_style'             => $sidebar_style,
				'sidebar_style_label'       => $sidebar_style_name,
				'sidebar_width'             => (int) $sidebar_width,
				'available_blog_layouts'    => $layout_labels,
				'available_sidebar_layouts' => $sidebar_layout_labels,
				'available_sidebar_styles'  => $sidebar_style_labels,
			)
		);
	}


User Contributed Notes

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