Files
Sophia-After-Dark/archive.php
2025-05-20 23:47:21 -07:00

71 lines
1.8 KiB
PHP

<?php
/**
* The template for displaying archive pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Sophia After Dark
* @since 1.0.0
*/
$archive_style = get_theme_mod( 'sophia_after_dark_archive_style', 'sad-archive--masonry-style' );
get_header();
?>
<div class="sad-page-content-wrapper">
<div id="primary" class="content-area" itemscope itemtype="https://schema.org/CollectionPage">
<main id="main" class="site-main" role="main" aria-label="<?php esc_attr_e( 'Archive Content', 'sophia-after-dark' ); ?>">
<?php if ( 'sad-archive--block-grid-style' === $archive_style ) : ?>
<div class="archive-grid-post-wrapper">
<?php endif; ?>
<?php if ( have_posts() ) : ?>
<?php if ( 'sad-archive--masonry-style' === $archive_style ) : ?>
<div class="sophia-after-dark-content-masonry">
<div id="sad-masonry">
<?php endif; ?>
<?php
// Start the Loop
while ( have_posts() ) :
the_post();
// Load post template part
get_template_part( 'template-parts/content', get_post_type() );
endwhile;
?>
<?php if ( 'sad-archive--masonry-style' === $archive_style ) : ?>
</div>
</div>
<?php endif; ?>
<?php
// Archive pagination
the_posts_pagination( array(
'prev_text' => __( 'Previous', 'sophia-after-dark' ),
'next_text' => __( 'Next', 'sophia-after-dark' ),
'before_page_number' => '<span class="screen-reader-text">' . esc_html__( 'Page', 'sophia-after-dark' ) . ' </span>',
) );
?>
<?php else : ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>
<?php endif; ?>
<?php if ( 'sad-archive--block-grid-style' === $archive_style ) : ?>
</div>
<?php endif; ?>
</main>
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>