69 lines
2.4 KiB
PHP
69 lines
2.4 KiB
PHP
<?php
|
|
/** Archive template. @package Fragrance_Trade */
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
get_header();
|
|
|
|
$is_news_archive = is_category() || is_tag() || is_date() || is_author();
|
|
?>
|
|
<?php if ( $is_news_archive ) : ?>
|
|
<main id="primary" class="site-main">
|
|
<div class="page-content container news-page news-archive">
|
|
<?php
|
|
get_template_part(
|
|
'template-parts/breadcrumb',
|
|
null,
|
|
array(
|
|
'items' => array(
|
|
array( 'label' => __( '首页', 'fragrance-trade' ), 'url' => home_url( '/' ) ),
|
|
array( 'label' => __( '新闻资讯', 'fragrance-trade' ), 'url' => fragrance_trade_news_url() ),
|
|
array( 'label' => wp_strip_all_tags( get_the_archive_title() ), 'url' => null ),
|
|
),
|
|
)
|
|
);
|
|
?>
|
|
<header class="news-page-header">
|
|
<p class="section-eyebrow"><?php esc_html_e( '新闻归档', 'fragrance-trade' ); ?></p>
|
|
<h1><?php the_archive_title(); ?></h1>
|
|
<?php the_archive_description( '<div class="archive-description">', '</div>' ); ?>
|
|
</header>
|
|
<?php if ( have_posts() ) : ?>
|
|
<div class="news-grid">
|
|
<?php
|
|
while ( have_posts() ) :
|
|
the_post();
|
|
get_template_part( 'template-parts/content', 'news-card' );
|
|
endwhile;
|
|
?>
|
|
</div>
|
|
<div class="news-pagination">
|
|
<?php the_posts_pagination(); ?>
|
|
</div>
|
|
<?php else : ?>
|
|
<section class="news-empty">
|
|
<h2><?php esc_html_e( '此归档暂时没有新闻', 'fragrance-trade' ); ?></h2>
|
|
<p><?php esc_html_e( '可以返回新闻资讯页面浏览其他内容。', 'fragrance-trade' ); ?></p>
|
|
<a class="btn btn-b2b-primary" href="<?php echo esc_url( fragrance_trade_news_url() ); ?>"><?php esc_html_e( '返回新闻资讯', 'fragrance-trade' ); ?></a>
|
|
</section>
|
|
<?php endif; ?>
|
|
</div>
|
|
</main>
|
|
<?php else : ?>
|
|
<main id="primary" class="site-main container py-5 fragrance-content-area">
|
|
<header class="page-header mb-5"><h1 class="page-title"><?php the_archive_title(); ?></h1><?php the_archive_description( '<div class="archive-description">', '</div>' ); ?></header>
|
|
<?php if ( have_posts() ) : ?>
|
|
<div class="row g-5">
|
|
<?php while ( have_posts() ) : the_post(); ?>
|
|
<div class="col-12"><?php get_template_part( 'template-parts/content', get_post_type() ); ?></div>
|
|
<?php endwhile; ?>
|
|
</div>
|
|
<?php the_posts_pagination(); ?>
|
|
<?php else : ?>
|
|
<?php get_template_part( 'template-parts/content', 'none' ); ?>
|
|
<?php endif; ?>
|
|
</main>
|
|
<?php endif; ?>
|
|
<?php get_footer(); ?>
|