slowtwitch-news/single.php

57 lines
1.8 KiB
PHP
Raw Normal View History

2024-07-02 20:45:52 +00:00
<?php get_header() ?>
2024-07-23 21:31:45 +00:00
<div class="st-article-section-topper"></div>
2024-07-02 20:45:52 +00:00
<article class="st-main-grid st-article">
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
$post_id = get_the_ID(); ?>
<h1 class="st-article__title"> <?php the_title(); ?> </h1>
<div class="st-article__author-box">
<div class="st-article__author-name">
<?php the_author() ?>
</div>
<div>
<?php the_date() ?>
</div>
</div>
<?php the_content(); ?>
</article>
<?php
if(function_exists('get_field')){
$related_posts = get_field('related_posts', $post_id);
if (isset($related_posts)) :?>
<div class="st-main-grid">
<h3>Related Articles</h3>
<div class="st-article-section-related-articles">
<?php foreach ($related_posts as $post) : setup_postdata($post);
$category = get_the_category()[0];?>
<article class="st-related-article">
<a href="<?php the_permalink(); ?>" class="st-article-section-sub-article__image-link">
<?php the_post_thumbnail(); ?>
</a>
<div class="st-article-section-sub-article__text-container">
<a href="<?php echo home_url($category->slug); ?>" class="st-article-section-sub-article__category-link"><?php echo $category->name; ?></a>
<a class="st-article-section-sub-article__title" href="<?php the_permalink(); ?>"><h3><?php the_title(); ?></h3></a>
</div>
</a>
</article>
<?php endforeach;
wp_reset_postdata(); ?>
</div>
</div>
<?php
endif;
}
}
}?>
2024-07-22 19:41:07 +00:00
<?php
comments_template();
get_footer();
?>