Astra_Related_Posts_Markup::astra_get_related_post_excerpt( int $current_post_id )

Related Posts Excerpt markup.


Description


Parameters

$current_post_id

(int) (Required) current post ID.


Source

File: inc/modules/related-posts/class-astra-related-posts-markup.php

	public function astra_get_related_post_excerpt( $current_post_id ) {
		if ( ! astra_get_option( 'enable-related-posts-excerpt' ) ) {
			return;
		}

		$related_posts_content_type = apply_filters( 'astra_related_posts_content_type', 'excerpt' );

		if ( 'full-content' === $related_posts_content_type ) {
			return the_content();
		}

		$excerpt_length = absint( astra_get_option( 'related-posts-excerpt-count' ) );

		$excerpt = wp_trim_words( get_the_excerpt(), $excerpt_length );

		if ( ! $excerpt ) {
			$excerpt = null;
		}

		$excerpt = apply_filters( 'astra_related_post_excerpt', $excerpt, $current_post_id );

		do_action( 'astra_related_post_before_excerpt', $current_post_id );

		?>
			<p class="ast-related-post-excerpt entry-content clear">
				<?php echo wp_kses_post( $excerpt ); ?>
			</p>
		<?php

		do_action( 'astra_related_post_after_excerpt', $current_post_id );
	}

Changelog

Changelog
Version Description
3.5.0 Introduced.


User Contributed Notes

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