<?php
/**
 * Template part for displaying posts in the Link format.
 *
 * Displays the post title as the link text, pointing to the first URL
 * found in the content (or the permalink as fallback).
 *
 * @package FansPaysite
 * @since   2.3
 */

$link_url = get_url_in_content( get_the_content() );
if ( ! $link_url ) {
	$link_url = get_the_permalink();
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'fps-post-card fps-format-link' ); ?>>
	<div class="fps-post-body">
		<div class="fps-format-icon"><i class="fas fa-link"></i></div>
		<h2><a href="<?php echo esc_url( $link_url ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
		<?php the_excerpt(); ?>
		<span class="fps-format-meta"><?php echo esc_html( wp_parse_url( $link_url, PHP_URL_HOST ) ); ?></span>
	</div>
</article>
