Files
car-t-t/archive-case.php
T
zhs123 8a2890f8b4 refactor: 多页面门店重构 — CPT + 页面模板 + README 更新
- CPT: service(服务项目) + case(案例作品集) + case_type 分类
- 页面: 关于门店/常见问题/预约联系 + archive/single 模板
- 首页精简为 hero+trust+service-teaser+case-teaser+cta
- 主题激活自动迁移 Customizer 产品数据为 service 文章
- 预约表单: nonce+honeypot+rate-limit, URL 参数预填服务
- 联系页: 门店地址/电话/营业时间/百度地图导航
- Customizer 面板改为门店语境(13 板块)
- header CTA 改为预约, helpers 更新为门店口径
- README.md 全面更新为门店多页面架构文档
2026-07-24 15:37:40 +08:00

53 lines
2.1 KiB
PHP

<?php
/**
* Case archive template with case_type filter.
*
* @package Fragrance_Trade
*/
get_header();
?>
<main id="primary" class="site-main">
<header class="page-header container pb-5">
<h1><?php esc_html_e( '案例作品', 'fragrance-trade' ); ?></h1>
<p><?php esc_html_e( '看看我们为车主完成的贴膜施工案例。', 'fragrance-trade' ); ?></p>
</header>
<div class="container pb-5">
<?php
$case_terms = get_terms(
array(
'taxonomy' => 'case_type',
'hide_empty' => false,
)
);
if ( ! empty( $case_terms ) && ! is_wp_error( $case_terms ) ) :
$current_type = isset( $_GET['case_type'] ) ? sanitize_text_field( wp_unslash( $_GET['case_type'] ) ) : '';
?>
<div class="case-filter mb-4 d-flex flex-wrap gap-2">
<a href="<?php echo esc_url( home_url( '/cases/' ) ); ?>" class="btn btn-sm <?php echo $current_type ? 'btn-outline-secondary' : 'btn-b2b-primary'; ?>"><?php esc_html_e( '全部', 'fragrance-trade' ); ?></a>
<?php foreach ( $case_terms as $term ) : ?>
<a href="<?php echo esc_url( add_query_arg( 'case_type', $term->slug, home_url( '/cases/' ) ) ); ?>" class="btn btn-sm <?php echo $current_type === $term->slug ? 'btn-b2b-primary' : 'btn-outline-secondary'; ?>"><?php echo esc_html( $term->name ); ?></a>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if ( have_posts() ) : ?>
<div class="case-grid">
<?php while ( have_posts() ) : the_post(); ?>
<a class="case-card" href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ) : ?>
<?php the_post_thumbnail( 'medium', array( 'class' => 'img-fluid' ) ); ?>
<?php else : ?>
<img src="<?php echo esc_url( fragrance_trade_asset_uri( 'products/placeholder-01.svg' ) ); ?>" alt="<?php the_title_attribute(); ?>" class="img-fluid">
<?php endif; ?>
<span class="case-card-title"><?php the_title(); ?></span>
</a>
<?php endwhile; ?>
</div>
<?php the_posts_pagination(); ?>
<?php else : ?>
<p><?php esc_html_e( '案例即将上线,敬请期待。', 'fragrance-trade' ); ?></p>
<?php endif; ?>
</div>
</main>
<?php get_footer(); ?>