<?php
/**
 * Template part for displaying results in search pages
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package go_mechanic
 */

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <div class="search-container">
        <header class="entry-header">
            <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>

            <?php if ( 'post' === get_post_type() ) : ?>
            <div class="entry-meta d-flex">
                <div class="post-date">
                    <i class="fa-regular fa-calendar"></i> <a
                        href="<?php the_permalink();?>"><?php echo esc_html(get_the_date('d M Y')); ?></a>

                </div>

                <div class="post-category">
                    <i class="fa-regular fa-folder"></i>
                    <a href="<?php echo esc_url(get_category_link(get_the_category()[0]->term_id)); ?>">
                        <?php echo esc_html(get_the_category()[0]->name); ?>
                    </a>
                </div>

                <div class="post-time">
                    <i class="fa-regular fa-clock"></i>
                    <a href="#" class="read-only-link">
                        <?php echo esc_html(go_mechanic_get_reading_time()); ?>
                    </a>
                </div>
            </div><!-- .entry-meta -->
            <?php endif; ?>
        </header><!-- .entry-header -->

        <?php go_mechanic_post_thumbnail(); ?>

        <div class="entry-summary">
            <?php the_excerpt(); ?>
        </div><!-- .entry-summary -->
    </div>

</article><!-- #post-<?php the_ID(); ?> -->