slowtwitch-news/single.php

94 lines
4.2 KiB
PHP

<?php get_header() ?>
<div class="st-article-section-topper"></div>
<main class="st-main-grid">
<section class="st-article-section-grid st-article-section-grid__article-page">
<article class="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>
<a href="<?php echo get_author_posts_url($post->post_author); ?>" class="st-article-page__author-link">
<div class="st-article__author-box">
<div class="st-article__author-name">
<?php the_author() ?>
</div>
<div>
<?php the_date() ?>
</div>
</div>
</a>
<?php the_content(); ?>
<?php
$tags = get_the_tags();
if ($tags) {
?><h4>Tags:</h4><?php
foreach ($tags as $tag) {
echo '<a class="st-chip st-chip-primary st-chip-tag-cloud" href="' . get_tag_link($tag->term_id) . '">' . $tag->name . '</a>';
}
}
?>
<?php
if (function_exists('get_field')) {
$related_posts = get_field('related_posts', $post_id);
if (isset($related_posts) && is_array($related_posts)) : ?>
<div class="st-sub-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;
}
}
} ?>
<?php
comments_template();
?>
</article>
<section class="st-ad-section st-ad-section__article-page">
<?php
if ( function_exists('the_ad_placement') ) {
the_ad_placement('ads-small-a');
the_ad_placement('ads-small-b');
}
if (function_exists('dynamic_sidebar')) {
dynamic_sidebar('mailing_list');
}
?>
</section>
</section>
<section class="st-article-section-grid st-article-section-grid__article-page">
<section class="st-ad-section-long-post-end st-article">
<?php
if( function_exists('the_ad_placement') ) {
the_ad_placement('ads-long');
}
?>
</section>
</section>
</main>
<?php
get_footer();
?>