featured article on archive pages

This commit is contained in:
Ross Trottier 2024-07-19 13:53:03 -06:00
parent 535ff3198c
commit a50dbca257
2 changed files with 45 additions and 0 deletions

View File

@ -4,12 +4,34 @@
<div class="st-article-archives"> <div class="st-article-archives">
<?php <?php
$count = $wp_the_query->post_count; $count = $wp_the_query->post_count;
$article_number = 0;
custom_breadcrumbs(); custom_breadcrumbs();
if (have_posts()) { if (have_posts()) {
while (have_posts()) { while (have_posts()) {
the_post(); the_post();
$category = get_the_category()[0]; $category = get_the_category()[0];
$count++; $count++;
$article_number++;
if ($article_number == 1) {
$author = get_userdata( $post->post_author );
?>
<article class="st-article-archive-article st-article-archive-article-featured">
<a href="<?php the_permalink(); ?>" class="st-article-section-wide-article__image-link">
<?php the_post_thumbnail(); ?>
</a>
<div class="st-article-section-wide-article__text-container">
<a href="<?php echo home_url($category->slug); ?>"
class="st-article-section-wide-article__category-link"><?php echo $category->name; ?></a>
<a class="st-article-section-wide-article__title" href="<?php the_permalink(); ?>">
<h3><?php the_title(); ?></h3>
</a>
<p class="st-article-section-wide-article__excerpt"><?php the_excerpt(); ?></p>
<a href="<?php echo get_author_posts_url( $post->post_author ); ?>" class="st-article-section-main-article__author-link">by <?php echo $author->display_name; ?>, <?php the_time('F j, Y'); ?></a>
</div>
</a>
</article>
<?php
} else {
?> ?>
<article class="st-article-archive-article"> <article class="st-article-archive-article">
<a href="<?php the_permalink(); ?>" class="st-article-section-wide-article__image-link"> <a href="<?php the_permalink(); ?>" class="st-article-section-wide-article__image-link">
@ -28,9 +50,11 @@
<?php <?php
} }
} }
}
wp_reset_postdata(); wp_reset_postdata();
?> ?>
<!-- HERE IS WHERE THE AD WILL GO -->
</div> </div>
<?php list_pagination($count); ?> <?php list_pagination($count); ?>
</div> </div>

View File

@ -942,6 +942,10 @@ COMPONENTS
font-size: 1.5rem; font-size: 1.5rem;
} }
.st-article-archive-article-featured .st-article-section-main-article__author-link {
display: none;
}
@media (min-width: 760px) { @media (min-width: 760px) {
.st-article-section-four-oh-four, .st-article-section-four-oh-four,
.st-article-archives { .st-article-archives {
@ -954,6 +958,19 @@ COMPONENTS
.st-article-archives .pagination { .st-article-archives .pagination {
grid-column: 1/span 2; grid-column: 1/span 2;
} }
.st-article-archive-article-featured {
grid-column: 1/span 2;
grid-row: 2/span 2;
}
.st-article-archive-article-featured img {
width: 100%;
}
.st-article-archive-article-featured .st-article-section-main-article__author-link {
display: initial;
}
} }
@media (min-width: 1200px) { @media (min-width: 1200px) {
@ -970,6 +987,10 @@ COMPONENTS
.st-article-archives .pagination { .st-article-archives .pagination {
grid-column: 1/span 4; grid-column: 1/span 4;
} }
.st-article-archive-article-featured img {
height: 73.25%;
}
} }
/* Pagination */ /* Pagination */