chore: import MING theme source
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Name: 品牌專欄(文章三區)
|
||||
*
|
||||
* 品牌專欄 / 媒體報導 / 開箱評測 三個分類的文章集合頁。
|
||||
*
|
||||
* @package MING
|
||||
*/
|
||||
|
||||
get_header();
|
||||
|
||||
$ming_sections = array(
|
||||
'brand-journal' => array(
|
||||
'name' => '品牌專欄',
|
||||
'desc' => '關於陶瓷、土地與生活的書寫 —— 記錄 MING 的思考與日常。',
|
||||
),
|
||||
'media-coverage' => array(
|
||||
'name' => '媒體報導',
|
||||
'desc' => '感謝各界媒體的關注與報導,讓更多人看見陶瓷內膽的美好。',
|
||||
),
|
||||
'unboxing' => array(
|
||||
'name' => '開箱評測',
|
||||
'desc' => '真實使用者的第一視角:手感、保溫、清洗,一次看仔細。',
|
||||
),
|
||||
);
|
||||
?>
|
||||
|
||||
<section class="page-hero">
|
||||
<div class="wrap">
|
||||
<p class="eyebrow reveal">JOURNAL</p>
|
||||
<h1 class="h1 reveal"><?php the_title(); ?></h1>
|
||||
<p class="sub reveal">在這裡,我們書寫品牌的故事,也收藏世界對 MING 的回響。</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php foreach ( $ming_sections as $ming_slug => $ming_sec ) :
|
||||
$ming_cat = get_category_by_slug( $ming_slug );
|
||||
if ( ! $ming_cat ) { continue; }
|
||||
$ming_posts = get_posts( array(
|
||||
'post_type' => 'post',
|
||||
'posts_per_page' => 3,
|
||||
'post_status' => 'publish',
|
||||
'category' => $ming_cat->term_id,
|
||||
) );
|
||||
$ming_first = $ming_posts ? array_shift( $ming_posts ) : null;
|
||||
?>
|
||||
<section class="section journal-sec">
|
||||
<div class="wrap">
|
||||
<div class="journal-head reveal">
|
||||
<div>
|
||||
<p class="eyebrow"><?php echo esc_html( strtoupper( str_replace( '-', ' ', $ming_slug ) ) ); ?></p>
|
||||
<h2 class="h2"><?php echo esc_html( $ming_sec['name'] ); ?></h2>
|
||||
</div>
|
||||
<div class="journal-head-side">
|
||||
<p class="journal-desc"><?php echo esc_html( $ming_sec['desc'] ); ?></p>
|
||||
<a class="textlink" href="<?php echo esc_url( get_category_link( $ming_cat ) ); ?>">查看全部 →</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ( ! $ming_posts && ! $ming_first ) : ?>
|
||||
<p class="journal-empty reveal">此分類尚無文章,敬請期待。</p>
|
||||
<?php else : ?>
|
||||
<div class="journal-grid<?php echo $ming_posts ? '' : ' single'; ?>">
|
||||
<?php if ( $ming_first ) : ?>
|
||||
<a class="jcard feature reveal" href="<?php echo esc_url( get_permalink( $ming_first ) ); ?>">
|
||||
<div class="jimg">
|
||||
<?php if ( has_post_thumbnail( $ming_first ) ) : ?>
|
||||
<img src="<?php echo esc_url( get_the_post_thumbnail_url( $ming_first, 'large' ) ); ?>" alt="<?php echo esc_attr( get_the_title( $ming_first ) ); ?>" loading="lazy">
|
||||
<?php endif; ?>
|
||||
<span class="jcat"><?php echo esc_html( $ming_sec['name'] ); ?></span>
|
||||
</div>
|
||||
<div class="jbody">
|
||||
<time><?php echo esc_html( get_the_date( 'Y.m.d', $ming_first ) ); ?></time>
|
||||
<h3><?php echo esc_html( get_the_title( $ming_first ) ); ?></h3>
|
||||
<p><?php echo esc_html( wp_trim_words( wp_strip_all_tags( $ming_first->post_content ), 46, '…' ) ); ?></p>
|
||||
<span class="jmore">閱讀全文 →</span>
|
||||
</div>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php foreach ( $ming_posts as $ming_post ) : ?>
|
||||
<a class="jcard reveal" href="<?php echo esc_url( get_permalink( $ming_post ) ); ?>">
|
||||
<div class="jimg">
|
||||
<?php if ( has_post_thumbnail( $ming_post ) ) : ?>
|
||||
<img src="<?php echo esc_url( get_the_post_thumbnail_url( $ming_post, 'medium_large' ) ); ?>" alt="<?php echo esc_attr( get_the_title( $ming_post ) ); ?>" loading="lazy">
|
||||
<?php endif; ?>
|
||||
<span class="jcat"><?php echo esc_html( $ming_sec['name'] ); ?></span>
|
||||
</div>
|
||||
<div class="jbody">
|
||||
<time><?php echo esc_html( get_the_date( 'Y.m.d', $ming_post ) ); ?></time>
|
||||
<h3><?php echo esc_html( get_the_title( $ming_post ) ); ?></h3>
|
||||
<p><?php echo esc_html( wp_trim_words( wp_strip_all_tags( $ming_post->post_content ), 30, '…' ) ); ?></p>
|
||||
<span class="jmore">閱讀全文 →</span>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php
|
||||
get_footer();
|
||||
Reference in New Issue
Block a user