Files
repa-woocommerce/theme/single.php
FrontendDev 1cc5a8ecfe Add RAR Storefront WordPress theme
Implements the Reply All Regrets™ frontend design: retro office aesthetic
with manila/ink/stamp-red/olive palette, Fraunces + JetBrains Mono + Inter
typography. Includes homepage, category, product detail, blog, about, cart
templates with WooCommerce integration and interactive JS (filter, sort, gallery).

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-02 20:38:29 -04:00

101 lines
4.1 KiB
PHP

<?php
/**
* Single blog post — "The Memo" article
*/
get_header();
the_post();
$cats = get_the_category();
$cat = $cats ? $cats[0]->name : 'Field Notes';
$wc = max(1, ceil(str_word_count(strip_tags(get_the_content())) / 200));
$thumb = get_the_post_thumbnail_url(get_the_ID(), 'full');
?>
<div class="rar-breadcrumb">
<a href="<?php echo esc_url(home_url('/')); ?>">Home</a> /
<a href="<?php echo esc_url(home_url('/blog/')); ?>">The Memo</a> /
<span><?php the_title(); ?></span>
</div>
<section class="rar-post-header">
<div class="rar-form-tag" style="margin-bottom:16px;">
<?php echo esc_html(strtoupper($cat)); ?> · <?php the_date('M j, Y'); ?> · <?php echo esc_html($wc); ?> MIN READ
</div>
<h1><?php the_title(); ?></h1>
<div style="display:flex;align-items:center;gap:20px;margin-top:20px;font-family:var(--mono);font-size:11px;letter-spacing:0.14em;text-transform:uppercase;color:var(--ink-muted);">
<span>By <?php the_author(); ?></span>
<span>·</span>
<span><?php the_date('F j, Y'); ?></span>
</div>
</section>
<?php if ($thumb) : ?>
<div style="padding:0 56px;margin-bottom:-1px;">
<div style="aspect-ratio:16/9;overflow:hidden;border:1px solid var(--hairline-strong);">
<img src="<?php echo esc_url($thumb); ?>" alt="<?php the_title_attribute(); ?>" style="width:100%;height:100%;object-fit:cover;" />
</div>
</div>
<?php endif; ?>
<article class="rar-post-content">
<?php the_content(); ?>
<?php wp_link_pages(); ?>
<div style="margin-top:48px;padding-top:24px;border-top:1.5px solid var(--ink);">
<div style="display:flex;gap:8px;flex-wrap:wrap;">
<?php
$tags = get_the_tags();
if ($tags) {
foreach ($tags as $tag) {
echo '<span class="rar-tag">' . esc_html($tag->name) . '</span>';
}
}
?>
</div>
</div>
</article>
<!-- Author box -->
<div style="padding:48px 56px;background:var(--paper);border-top:1px solid var(--hairline-strong);">
<div style="max-width:720px;margin:0 auto;display:flex;gap:24px;align-items:flex-start;">
<?php echo get_avatar(get_the_author_meta('email'), 64, '', '', ['style' => 'border-radius:2px;border:1px solid var(--hairline-strong);flex-shrink:0;']); ?>
<div>
<div style="font-family:var(--mono);font-size:10px;letter-spacing:0.18em;text-transform:uppercase;color:var(--ink-muted);margin-bottom:6px;">Filed by</div>
<div style="font-family:var(--serif);font-size:22px;font-weight:500;"><?php the_author(); ?></div>
<p style="font-size:14px;color:var(--ink-muted);margin:6px 0 0;line-height:1.5;"><?php the_author_meta('description'); ?></p>
</div>
</div>
</div>
<!-- Related posts -->
<?php
$related = get_posts([
'numberposts' => 3,
'post__not_in' => [get_the_ID()],
'category__in' => wp_get_post_categories(get_the_ID()),
'post_status' => 'publish',
]);
if (!empty($related)) :
?>
<section class="rar-blog-section" style="padding-top:64px;">
<?php rar_section_head('FORM 10 · RELATED DISPATCHES', 'More from the memo.'); ?>
<div class="rar-blog-grid">
<?php foreach ($related as $rp) :
$rt = get_the_post_thumbnail_url($rp->ID, 'rar-blog-thumb');
$rc = get_the_category($rp->ID);
$rcat = $rc ? $rc[0]->name : 'Notes';
?>
<a href="<?php echo get_permalink($rp->ID); ?>" class="rar-blog-card">
<div class="rar-blog-card__thumb">
<?php if ($rt) : ?><img src="<?php echo esc_url($rt); ?>" alt="<?php echo esc_attr($rp->post_title); ?>" /><?php endif; ?>
</div>
<div class="rar-blog-card__tag"><?php echo esc_html(strtoupper($rcat)); ?> · <?php echo strtoupper(date('M j', strtotime($rp->post_date))); ?></div>
<div class="rar-blog-card__title"><?php echo esc_html($rp->post_title); ?></div>
</a>
<?php endforeach; ?>
</div>
</section>
<?php endif; ?>
<?php get_footer(); ?>