47 lines
1.9 KiB
PHP
47 lines
1.9 KiB
PHP
<?php
|
|
/**
|
|
* پست برجسته آرشیو وبلاگ
|
|
*
|
|
* @package Hesabix2
|
|
*/
|
|
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
$categories = get_the_category();
|
|
$reading_time = hesabix2_post_reading_time(get_the_ID());
|
|
?>
|
|
<article id="post-<?php the_ID(); ?>" <?php post_class('blog-entry blog-entry--featured'); ?>>
|
|
<a href="<?php the_permalink(); ?>" class="blog-entry__link">
|
|
<div class="blog-entry__media">
|
|
<?php if (has_post_thumbnail()) : ?>
|
|
<?php the_post_thumbnail('large', array(
|
|
'class' => 'blog-entry__img',
|
|
'alt' => esc_attr(get_the_title()),
|
|
)); ?>
|
|
<?php else : ?>
|
|
<div class="blog-entry__placeholder" aria-hidden="true"></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="blog-entry__content">
|
|
<?php if (!empty($categories)) : ?>
|
|
<a href="<?php echo esc_url(get_category_link($categories[0]->term_id)); ?>" class="blog-entry__cat"><?php echo esc_html($categories[0]->name); ?></a>
|
|
<?php endif; ?>
|
|
<h2 class="blog-entry__title blog-entry__title--large"><?php the_title(); ?></h2>
|
|
<p class="blog-entry__excerpt">
|
|
<?php
|
|
$excerpt = get_the_excerpt();
|
|
echo esc_html($excerpt ? wp_trim_words($excerpt, 35) : wp_trim_words(get_the_content(), 35));
|
|
?>
|
|
</p>
|
|
<p class="blog-entry__meta">
|
|
<time datetime="<?php echo esc_attr(get_the_date('c')); ?>"><?php echo esc_html(get_the_date('Y/n/d')); ?></time>
|
|
<?php if ($reading_time) : ?>
|
|
<span class="blog-entry__dot" aria-hidden="true"></span>
|
|
<span><?php echo esc_html($reading_time); ?></span>
|
|
<?php endif; ?>
|
|
</p>
|
|
</div>
|
|
</a>
|
|
</article>
|