astra_setup_article_featured_image()

Prepare rendering Featured Image for single post at ‘astra_header_after’ hook after header.


Description

Required on single post only.


Source

File: inc/markup-extras.php

function astra_setup_article_featured_image() {
	if ( ! is_singular() ) {
		return;
	}

	$post_type           = strval( get_post_type() );
	$banner_title_layout = astra_get_option( 'ast-dynamic-single-' . $post_type . '-layout', 'layout-1' );
	$single_structure    = astra_get_option( 'ast-dynamic-single-' . $post_type . '-structure', astra_get_option( 'ast-dynamic-single-' . $post_type . '-structure', 'page' === $post_type ? array( 'ast-dynamic-single-' . $post_type . '-image', 'ast-dynamic-single-' . $post_type . '-title' ) : array( 'ast-dynamic-single-' . $post_type . '-title', 'ast-dynamic-single-' . $post_type . '-meta' ) ) );

	if ( ! in_array( 'ast-dynamic-single-' . $post_type . '-image', $single_structure ) ) {
		return;
	}

	if ( 'layout-1' === $banner_title_layout ) {
		$article_featured_image_position = astra_get_option( 'ast-dynamic-single-' . $post_type . '-article-featured-image-position-layout-1', 'behind' );
	} else {
		$article_featured_image_position = astra_get_option( 'ast-dynamic-single-' . $post_type . '-article-featured-image-position-layout-2', 'none' );
	}

	if ( 'none' !== $article_featured_image_position ) {
		add_action( 'astra_entry_before', 'astra_single_post_entry_featured_image' );
	}
}

Changelog

Changelog
Version Description
4.4.0 Introduced.


User Contributed Notes

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