astra_single_post_entry_featured_image()

Render Featured Image for single post at ‘astra_entry_before’ hook before post


Description


Source

File: inc/markup-extras.php

function astra_single_post_entry_featured_image() {
	$post_type           = strval( get_post_type() );
	$featured_image_size = astra_get_option( 'ast-dynamic-single-' . $post_type . '-article-featured-image-size', 'large' );

	if ( apply_filters( 'astra_post_featured_image_condition', ( has_post_thumbnail() ) ) ) {
		do_action( 'astra_article_featured_image_before' );

		$output     = '';
		$post_thumb = apply_filters(
			'astra_article_featured_image_markup',
			get_the_post_thumbnail(
				/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
				absint( astra_get_post_id() ),
				/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
				apply_filters( 'astra_post_featured_image_default_size', $featured_image_size ),
				apply_filters( 'astra_post_featured_image_itemprop', '' )
			)
		);
		if ( '' != $post_thumb ) {
			$featured_image_width = 'layout-1' === astra_get_option( 'ast-dynamic-single-' . $post_type . '-layout', 'layout-1' ) ? astra_get_option( 'ast-dynamic-single-' . $post_type . '-article-featured-image-width-type', 'wide' ) : '';
			$output              .= '<div class="ast-single-post-featured-section post-thumb ast-article-image-container--' . esc_attr( $featured_image_width ) . '">';
			$output              .= $post_thumb;
			$output              .= '</div>';
		}

		$output = apply_filters( 'astra_featured_post_thumbnail', $output );
		echo wp_kses_post( $output );

		do_action( 'astra_article_featured_image_after' );
	}
}

Changelog

Changelog
Version Description
4.4.0 Introduced.


User Contributed Notes

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