add author archive special page

This commit is contained in:
Ross Trottier 2024-08-16 17:20:24 -06:00
parent c98c6e2fa8
commit 37b0fdb2bc
2 changed files with 80 additions and 2 deletions

76
author.php Normal file
View File

@ -0,0 +1,76 @@
<?php get_header() ?>
<div class="st-article-section-topper"></div>
<div class="st-main-grid">
<?php $author_name = get_the_author( ); ?>
<h1 class="st-author-page-author-name">Articles by <?php echo $author_name ?></h1>
</div>
<div class="st-main-grid">
<div class="st-article-archives">
<?php
$count = $wp_the_query->post_count;
$article_number = 0;
?>
<div class="st-author-page-breadcrumb-placeholder"></div>
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
$category = get_the_category()[0];
$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">
<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>
</div>
</a>
</article>
<?php
}
}
}
wp_reset_postdata();
?>
</div>
<!-- HERE IS WHERE THE AD WILL GO -->
<section class="st-ad-section-long-archive">
<?php
if(function_exists('the_ad_group')){
the_ad_group(149);
}
?>
</section>
<?php list_pagination($count); ?>
</div>
<?php get_footer() ?>

View File

@ -1236,7 +1236,8 @@ COMPONENTS
}
.st-article-archives .breadcrumbs,
.st-article-archives .pagination {
.st-article-archives .pagination,
.st-author-page-breadcrumb-placeholder {
grid-column: 1/span 2;
}
@ -1278,7 +1279,8 @@ COMPONENTS
}
.st-article-archives .breadcrumbs,
.st-article-archives .pagination {
.st-article-archives .pagination,
.st-author-page-breadcrumb-placeholder {
grid-column: 1/span 4;
}