Astra_Related_Posts_Markup::astra_get_related_post_read_more( int $current_post_id )

Render Post CTA button HTML marup.


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_read_more( $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;
		}

		$target = apply_filters( 'astra_related_post_cta_target', '_self' );

		$cta_text = apply_filters( 'astra_related_post_read_more_text', astra_get_option( 'blog-read-more-text' ) );

		$show_read_more_as_button = apply_filters( 'astra_related_post_read_more_as_button', astra_get_option( 'blog-read-more-as-button' ) );

		$class = '';

		if ( $show_read_more_as_button ) {
			$class = 'ast-button';
		}

		$custom_class = apply_filters( 'astra_related_post_cta_custom_classes', $class );

		do_action( 'astra_related_post_before_cta', $current_post_id );

		?>
			<p class="ast-related-post-cta read-more">
				<a class="ast-related-post-link <?php echo esc_html( $custom_class ); ?>" href="<?php echo esc_url( apply_filters( 'astra_related_post_link', get_the_permalink(), $current_post_id ) ); ?>" target="<?php echo esc_html( $target ); ?>" rel="bookmark noopener noreferrer"><?php echo esc_html( $cta_text ); ?></a>
			</p>
		<?php

		do_action( 'astra_related_post_after_cta', $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.