46 lines
1.5 KiB
PHP
46 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* Blog post card.
|
|
*
|
|
* @package Gustavo_Portfolio
|
|
*/
|
|
|
|
$gustavoo_categories = get_the_category();
|
|
$gustavoo_category = $gustavoo_categories ? $gustavoo_categories[0] : null;
|
|
?>
|
|
|
|
<article <?php post_class( 'post-card' ); ?>>
|
|
<?php if ( has_post_thumbnail() ) : ?>
|
|
<a class="post-card__media" href="<?php the_permalink(); ?>" tabindex="-1" aria-hidden="true">
|
|
<?php
|
|
the_post_thumbnail(
|
|
'gustavoo-post-card',
|
|
array(
|
|
'class' => 'post-card__image',
|
|
'loading' => 'lazy',
|
|
'decoding' => 'async',
|
|
'alt' => '',
|
|
)
|
|
);
|
|
?>
|
|
</a>
|
|
<?php endif; ?>
|
|
|
|
<div class="post-card__body">
|
|
<div class="post-card__meta">
|
|
<?php if ( $gustavoo_category ) : ?>
|
|
<a class="post-card__category" href="<?php echo esc_url( get_category_link( $gustavoo_category ) ); ?>"><?php echo esc_html( $gustavoo_category->name ); ?></a>
|
|
<?php endif; ?>
|
|
<?php gustavoo_portfolio_posted_on(); ?>
|
|
<span class="reading-time"><?php echo esc_html( gustavoo_portfolio_reading_time() ); ?></span>
|
|
</div>
|
|
|
|
<h2 class="post-card__title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
|
|
<p class="post-card__excerpt"><?php echo esc_html( wp_trim_words( get_the_excerpt(), 26 ) ); ?></p>
|
|
<a class="post-card__more" href="<?php the_permalink(); ?>">
|
|
<?php esc_html_e( 'Ler artigo', 'gustavoo-portfolio' ); ?> <span aria-hidden="true">→</span>
|
|
<span class="screen-reader-text">: <?php the_title(); ?></span>
|
|
</a>
|
|
</div>
|
|
</article>
|