chore: import MING theme source

This commit is contained in:
2026-09-23 09:29:09 +08:00
parent 63b5a4beba
commit d9946a3da4
53 changed files with 4476 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
<?php
/**
* Template Name: 新品許願池(投票活動列表)
*
* @package MING
*/
get_header();
$ming_camps = get_posts( array(
'post_type' => 'ming_campaign',
'posts_per_page' => -1,
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
) );
?>
<section class="page-hero">
<div class="wrap">
<p class="eyebrow reveal">NEW ARRIVAL · VOTE</p>
<h1 class="h1 reveal"><?php the_title(); ?></h1>
<p class="sub reveal">我們正在籌備下一批新品。告訴我們你最想要哪一款,<br>呼聲最高的款式將優先生產。</p>
</div>
</section>
<section class="section">
<div class="wrap">
<?php if ( empty( $ming_camps ) ) : ?>
<p class="vote-empty reveal">目前沒有進行中的投票活動。</p>
<?php else : ?>
<div class="camp-grid">
<?php foreach ( $ming_camps as $ming_camp ) :
$ming_cid = $ming_camp->ID;
$ming_goal = (int) get_post_meta( $ming_cid, 'ming_goal', true ) ?: ming_vote_goal();
$ming_deadline = get_post_meta( $ming_cid, 'ming_deadline', true );
$ming_items = array_filter( array_map( 'intval', (array) get_post_meta( $ming_cid, 'ming_products', true ) ), function( $ming_pid ) { return 'publish' === get_post_status( $ming_pid ); } );
$ming_total = ming_campaign_total_votes( $ming_cid );
$ming_expired = ming_campaign_expired( $ming_cid );
?>
<a class="camp-card reveal" href="<?php echo esc_url( get_permalink( $ming_cid ) ); ?>">
<div class="camp-top">
<span class="camp-badge <?php echo $ming_expired ? 'closed' : 'live'; ?>"><?php echo $ming_expired ? '已截止' : '進行中'; ?></span>
<?php if ( $ming_deadline ) : ?>
<span class="camp-deadline">截止 <?php echo esc_html( date_i18n( 'Y/m/d H:i', strtotime( $ming_deadline ) ) ); ?></span>
<?php else : ?>
<span class="camp-deadline">長期進行</span>
<?php endif; ?>
</div>
<h3><?php echo esc_html( $ming_camp->post_title ); ?></h3>
<div class="camp-meta">
<span><b><?php echo esc_html( $ming_total ); ?></b> 人參與</span>
<span><?php echo count( $ming_items ); ?> 款商品</span>
<span>目標 <?php echo esc_html( $ming_goal ); ?> 人</span>
</div>
<span class="camp-go"><?php echo $ming_expired ? '查看結果 →' : '前往投票 →'; ?></span>
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
<div class="vote-share reveal">
<p class="vote-share-text">邀請朋友一起來許願 —— 呼聲最高的款式,將優先生產。</p>
<?php
ming_share_bar( array(
'title' => get_the_title() . '|MING 明命',
'text' => 'MING 明命新品許願池:告訴我們你最想要哪一款,呼聲最高的款式將優先生產!',
'label' => '分享許願池',
) );
?>
</div>
</div>
</section>
<?php
get_footer();