79 lines
2.7 KiB
PHP
79 lines
2.7 KiB
PHP
<?php
|
|
/**
|
|
* Single Post
|
|
*
|
|
* @package XShop
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
get_header();
|
|
?>
|
|
<div class="xshop-container">
|
|
<div class="xshop-layout">
|
|
<div class="xshop-layout__content">
|
|
<?php while (have_posts()): the_post(); ?>
|
|
<article <?php post_class('xshop-prose'); ?>>
|
|
<header class="xshop-page-header">
|
|
<h1 class="xshop-page-header__title"><?php the_title(); ?></h1>
|
|
<div class="xshop-card__meta">
|
|
<time datetime="<?php echo esc_attr(get_the_date('c')); ?>"><?php echo esc_html(get_the_date()); ?></time>
|
|
<span aria-hidden="true">·</span>
|
|
<span><?php echo esc_html(get_the_author()); ?></span>
|
|
<?php
|
|
$cats = get_the_category();
|
|
if (!empty($cats[0])) {
|
|
echo '<span aria-hidden="true">·</span><a href="' . esc_url(get_category_link($cats[0]->term_id)) . '">' . esc_html($cats[0]->name) . '</a>';
|
|
}
|
|
?>
|
|
</div>
|
|
</header>
|
|
|
|
<?php if (has_post_thumbnail()): ?>
|
|
<div class="xshop-card__media" style="border-radius:var(--xshop-radius-md);margin-block-end:var(--xshop-space-6)">
|
|
<?php the_post_thumbnail('large', ['loading'=>'eager','decoding'=>'async']); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="entry-content">
|
|
<?php
|
|
the_content();
|
|
wp_link_pages([
|
|
'before' => '<nav class="xshop-pagination" aria-label="' . esc_attr__('Page links', 'xshop') . '"><span class="xshop-text-muted">' . esc_html__('Pages:', 'xshop') . '</span> ',
|
|
'after' => '</nav>',
|
|
]);
|
|
?>
|
|
</div>
|
|
|
|
<?php
|
|
$tags = get_the_tags();
|
|
if ($tags):
|
|
?>
|
|
<footer style="margin-block-start:var(--xshop-space-6)">
|
|
<p class="xshop-card__meta"><?php the_tags(esc_html__('Tags: ', 'xshop'), ', '); ?></p>
|
|
</footer>
|
|
<?php endif; ?>
|
|
</article>
|
|
|
|
<?php
|
|
// Next/previous post navigation (accessible).
|
|
the_post_navigation([
|
|
'prev_text' => '<span class="xshop-text-muted">' . esc_html__('Previous', 'xshop') . '</span><br>%title',
|
|
'next_text' => '<span class="xshop-text-muted">' . esc_html__('Next', 'xshop') . '</span><br>%title',
|
|
]);
|
|
?>
|
|
|
|
<?php
|
|
if (comments_open() || (int) get_comments_number() > 0) {
|
|
comments_template();
|
|
}
|
|
?>
|
|
<?php endwhile; ?>
|
|
</div>
|
|
<?php get_sidebar(); ?>
|
|
</div>
|
|
</div>
|
|
<?php get_footer(); ?>
|