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
+33
View File
@@ -0,0 +1,33 @@
# macOS / editors
.DS_Store
.idea/
.vscode/
*.swp
*.swo
# Local credentials and operational handover material
.env
.env.*
!.env.example
*.key
*.pem
*.p12
*.pfx
wp-config.php
wp-config-*.php
/docs/private/
# Generated delivery packages and dependency caches
/dist/*
!/dist/.gitkeep
*.zip
*.tar
*.tar.gz
node_modules/
vendor/
# Local WordPress runtime data
wp-content/uploads/
wp-content/cache/
wp-content/upgrade/
wp-content/debug.log
+38
View File
@@ -0,0 +1,38 @@
# MING 明命品牌电商站
MING 明命陶瓷内胆杯品牌官网与商城的源码仓库。前台主题位于 `ming-theme/`,基于 WordPress 与 WooCommerce,不依赖页面构建器。
## 仓库结构
```text
ming-theme/ 可部署的 WordPress 主题源码
assets/reference/ 非运行时的品牌视觉参考素材
docs/brief/ 系统说明、业务策略等交付资料
docs/private/ 本地运维交接资料;已由 .gitignore 排除
scripts/ 可重复执行的打包脚本
dist/ 生成的主题 ZIP;不进入 Git
```
## 开发与打包
运行环境应使用 PHP 7.4+、WordPress 6.0+ 和 WooCommerce。修改主题时,保持 `ming-theme/functions.php` 中的 `MING_VERSION` 与 `ming-theme/style.css` 的 `Version` 一致。
执行以下命令生成可上传的主题包:
```bash
./scripts/package-theme.sh
```
产物为 `dist/ming-theme.zip`,其中包含顶层 `ming-theme/` 目录。
## 重要约束
- 不提交后台密码、Cookie、API 密钥、生产配置或本地运维交接材料。
- 主题启用钩子包含历史数据初始化逻辑,可能创建内容、菜单、商品变体与媒体资源;生产环境切换主题前必须先备份并人工确认。
- 投票、SKU 初始化、海报生成等业务功能目前仍在主题内。后续应逐步迁移至独立插件,避免主题切换影响业务数据。
## 首次推送前
1. 确认 `git status --ignored` 中没有敏感文件。
2. 轮换曾出现在旧交接文档中的后台凭据。
3. 在 Git 平台新建空仓库后,按团队身份配置 Git 用户信息、添加远程地址并推送。
Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 KiB

+1
View File
@@ -0,0 +1 @@
+6
View File
@@ -0,0 +1,6 @@
# 项目资料说明
- `brief/`:对外或项目级的系统说明、业务策略与演示资料,可随仓库版本管理。
- `private/`:运维交接、账号、服务器信息等本地资料,已被 `.gitignore` 排除,绝不推送。
源码事实以 `ming-theme/` 为准。旧交接资料中的版本、目录和部署信息可能已经过期;每次发布后应同步更新本目录内不含敏感信息的说明。
Binary file not shown.
Binary file not shown.
+20
View File
@@ -0,0 +1,20 @@
# MING 明命 WordPress 主题
这是 MING 明命品牌官网的可部署主题目录,依赖 WordPress 与 WooCommerce。
## 主要文件
- `functions.php`:主题设置、WooCommerce 扩展、投票活动、色卡、分享和海报生成。
- `front-page.php`:品牌首页与商品系列展示。
- `template-brand.php`、`template-ceramic.php`、`template-journal.php`、`template-vote.php`:品牌、材质、专栏与新品许愿页面模板。
- `single-ming_campaign.php`:单一投票活动页。
- `assets/css/`、`assets/js/`、`assets/img/`、`assets/fonts/`:运行时静态资源。
## 版本管理
每次修改会影响前台缓存时,同时更新:
1. `functions.php` 的 `MING_VERSION`;
2. `style.css` 的 `Version` 字段。
使用仓库根目录的 `scripts/package-theme.sh` 生成上传包。不要将账号、密码、Cookie、服务器地址或部署脚本放入本主题目录;主题压缩包可能会被直接部署到公开站点。
+52
View File
@@ -0,0 +1,52 @@
# ROADMAP.md — MING 明命 项目路线图
> 当前源码版本:ming-theme **v1.7.3**
> 最后更新:2026-09
---
## 0. 用户侧待办(非代码,阻塞后续开发)
| # | 事项 | 阻塞 |
|---|---|---|
| 1 | 核对所有已发布商品与变体的售价、库存、图片和 SKU | 正式交易 |
| 2 | 定制器填写社交链接(FB/IG/LINE) | footer 显示 |
| 3 | 申请绿界 ECPay 商家账号(金流审核周期约 1–2 周) | **中期所有支付功能** |
| 4 | 决定是否关闭游客结账(当前开启:可下单但订单归属游客) | 会员策略 |
---
## 1. 短期(v1.6–1.7)— 体验补全
- [ ] **v1.6 退款/取消订单 UI**:myaccount 增加取消/申请退款入口(WC 内置,主题补样式)
- [ ] **v1.6 商品相册**:多图 gallery 排版 + 移动端滑动
- [ ] **v1.7 多语言**:Polylang 接入(繁中/简中,品牌页文案需整理成可翻译字符串)
- [x] **v1.7 OG 标签**(v1.7.0 已上线 og:/twitter: meta);待做:商品结构化数据、sitemap
## 2. 中期(v1.8–2.x)— 交易闭环(依赖用户侧待办 #3)
- [ ] **v1.8 金流上线**:ECPay 插件接入(信用卡/ATM/超商代码),订单状态自动流转,替换现在的手动对账 bacs
- [ ] **v1.9 购物车持久化**:游客购物车跨会话保留(WC session cookie 延长)
- [ ] **v2.0 通知体系**:订单状态变更邮件模板品牌化(当前为 WC 默认模板)
- [ ] 物流对接:超商取货(7-11/全家)或宅配运费规则
## 3. 亿看 ERP 对接(已选型,暂不实施)
- 商品/库存 ERP→网站、订单 网站→ERP;实施前先确认并固化 SKU 对照表
- 实施为独立插件 ming-ecount-sync;前置:管理员签发 API_CERT_KEY + 登记服务器 IP
- 接口资料与运维信息不纳入源码仓库;实施前应重新核对 ERP SKU 映射
## 4. 长期 — 经营深化
- [ ] 库存与规格体系:梳理容量/颜色变体、库存与 ERP SKU 的单一事实来源
- [ ] 会员等级/积分(配合注册策略,依赖用户侧待办 #4)
- [ ] 投票活动二期:许愿商品直达预售、活动数据导出
- [ ] 数据分析:GA4 或自托管 Matomo,转化漏斗(首页→商品→结账)
---
## 优先级说明
1. **用户侧待办 #1/#3 最先做**——没有正式商品和金流,v1.8 之后的所有工作都无法验收
2. 短期项彼此独立,可按用户反馈任意排序
3. 中期金流是分水岭:之前 bacs 手动对账够用,之后务必回归测试订单状态机(bacs 的 `is_paid()` 判断逻辑已被 v1.5.2 依赖)
+52
View File
@@ -0,0 +1,52 @@
/* MING 明命 — 自托管字体(v1.5.6 起替代 Google Fonts 外链)
来源:google/fonts(OFL 授权),经子集化(Big5 常用字 + 全形标点)与字重实例化 */
@font-face {
font-family: 'Cormorant Garamond';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('../fonts/CormorantGaramond-400.woff2') format('woff2');
}
@font-face {
font-family: 'Cormorant Garamond';
font-style: normal;
font-weight: 500;
font-display: swap;
src: url('../fonts/CormorantGaramond-500.woff2') format('woff2');
}
@font-face {
font-family: 'Noto Serif TC';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('../fonts/NotoSerifTC-400.woff2') format('woff2');
}
@font-face {
font-family: 'Noto Serif TC';
font-style: normal;
font-weight: 600;
font-display: swap;
src: url('../fonts/NotoSerifTC-600.woff2') format('woff2');
}
@font-face {
font-family: 'Noto Sans TC';
font-style: normal;
font-weight: 300;
font-display: swap;
src: url('../fonts/NotoSansTC-300.woff2') format('woff2');
}
@font-face {
font-family: 'Noto Sans TC';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('../fonts/NotoSansTC-400.woff2') format('woff2');
}
@font-face {
font-family: 'Noto Sans TC';
font-style: normal;
font-weight: 500;
font-display: swap;
src: url('../fonts/NotoSansTC-500.woff2') format('woff2');
}
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

+224
View File
@@ -0,0 +1,224 @@
/* ---------- 頂欄搜尋條 ---------- */
(function(){
var btn=document.querySelector('.hsearch');
var bar=document.getElementById('ming-searchbar');
if(!btn||!bar)return;
var input=bar.querySelector('input[type="search"]');
function openBar(){
document.body.classList.add('search-open');
btn.setAttribute('aria-expanded','true');
bar.setAttribute('aria-hidden','false');
if(input)setTimeout(function(){input.focus();},120);
}
function closeBar(){
document.body.classList.remove('search-open');
btn.setAttribute('aria-expanded','false');
bar.setAttribute('aria-hidden','true');
}
btn.addEventListener('click',function(){
document.body.classList.contains('search-open')?closeBar():openBar();
});
document.addEventListener('keydown',function(ev){
if(ev.key==='Escape'&&document.body.classList.contains('search-open'))closeBar();
});
document.addEventListener('click',function(ev){
if(!document.body.classList.contains('search-open'))return;
if(!ev.target.closest('.searchbar')&&!ev.target.closest('.hsearch'))closeBar();
});
})();
/* ---------- 行動版選單 ---------- */(function(){
var burger=document.querySelector('.hamburger');
var mnav=document.getElementById('ming-mnav');
if(!burger||!mnav)return;
function openMnav(){
document.body.classList.add('mnav-open');
burger.setAttribute('aria-expanded','true');
mnav.setAttribute('aria-hidden','false');
}
function closeMnav(){
document.body.classList.remove('mnav-open');
burger.setAttribute('aria-expanded','false');
mnav.setAttribute('aria-hidden','true');
}
burger.addEventListener('click',openMnav);
var closeBtn=mnav.querySelector('.mnav-close');
if(closeBtn)closeBtn.addEventListener('click',closeMnav);
mnav.querySelectorAll('.mnav-list a,.mnav-account').forEach(function(a){
a.addEventListener('click',closeMnav);
});
document.addEventListener('keydown',function(ev){
if(ev.key==='Escape'&&document.body.classList.contains('mnav-open'))closeMnav();
});
})();
/* ---------- 進場動畫 ---------- */
var io=new IntersectionObserver(function(entries){
entries.forEach(function(en){
if(en.isIntersecting){en.target.classList.add('in');io.unobserve(en.target);}
});
},{threshold:.15});
document.querySelectorAll('.reveal').forEach(function(el){io.observe(el)});
/* ---------- 新品許願池投票 ---------- */
(function(){
if(typeof MING_VOTE==='undefined')return;
document.addEventListener('click',function(ev){
var btn=ev.target.closest('.vote-btn');
if(!btn||btn.disabled)return;
var card=btn.closest('.vcard');
if(!card)return;
var goal=parseInt(card.getAttribute('data-goal'),10)||MING_VOTE.goal||100;
btn.disabled=true;btn.textContent='提交中…';
var fd=new FormData();
fd.append('action','ming_vote');
fd.append('nonce',MING_VOTE.nonce);
fd.append('campaign_id',card.getAttribute('data-cid'));
fd.append('product_id',card.getAttribute('data-id'));
fd.append('variation_id',card.getAttribute('data-vid')||'0');
fetch(MING_VOTE.ajaxurl,{method:'POST',credentials:'same-origin',body:fd})
.then(function(r){return r.json()})
.then(function(res){
if(res.success){
var n=res.data.count;
var vc=card.querySelector('.vcount b');if(vc)vc.textContent=n;
var bar=card.querySelector('.vote-bar i');
if(bar)bar.style.width=Math.min(100,Math.round(n/goal*100))+'%';
btn.textContent='已支持 ✓';btn.classList.add('voted');
var on=card.querySelector('.cdot.is-on');
if(on&&res.data.sku_count){var w=on.closest('.cdot-wrap');if(w){var em=w.querySelector('.cdot-n');if(em)em.textContent=res.data.sku_count;}}
}else if(res.data&&res.data.need_login){
window.location.href=res.data.login_url;
}else if(res.data&&res.data.already){
btn.textContent='已支持 ✓';btn.classList.add('voted');
var vc=card.querySelector('.vcount b');if(vc&&res.data.count)vc.textContent=res.data.count;
}else if(res.data&&res.data.message==='closed'){
btn.textContent='已截止';btn.classList.add('voted');
}else{
btn.disabled=false;btn.textContent='我想要這款';
}
})
.catch(function(){btn.disabled=false;btn.textContent='我想要這款';});
});
})();
/* ---------- 社群分享(複製連結 / 原生分享) ---------- */
(function(){
document.querySelectorAll('.ming-share').forEach(function(bar){
var title=bar.getAttribute('data-title')||document.title;
var text=bar.getAttribute('data-text')||title;
var url=bar.getAttribute('data-url')||location.href;
var copyBtn=bar.querySelector('.ming-share-btn.copy');
var nativeBtn=bar.querySelector('.ming-share-btn.native');
/* 原生分享需 HTTPS 安全環境 + 瀏覽器支援,否則不顯示(HTTP 下點了也沒反應) */
var canShare = window.isSecureContext && typeof navigator.share === 'function';
if(nativeBtn){
if(canShare){nativeBtn.hidden=false;}
nativeBtn.addEventListener('click',function(){
if(!canShare){return;}
navigator.share({title:title,text:text,url:url}).catch(function(err){
if(err&&err.name==='AbortError'){return;}
if(copyBtn){copyBtn.click();} /* 分享失敗退化為複製連結 */
});
});
}
if(copyBtn){
copyBtn.addEventListener('click',function(){
var done=function(){
var old=copyBtn.lastChild;
copyBtn.classList.add('copied');
var label=copyBtn.querySelector('.copy-label');
if(!label){
label=document.createElement('span');
label.className='copy-label';
copyBtn.appendChild(label);
}
label.textContent='已複製 ✓';
setTimeout(function(){copyBtn.classList.remove('copied');if(label)label.textContent='';},2000);
};
if(navigator.clipboard&&navigator.clipboard.writeText){
navigator.clipboard.writeText(url).then(done).catch(function(){fallback();});
}else{fallback();}
function fallback(){
var ta=document.createElement('textarea');
ta.value=url;ta.style.position='fixed';ta.style.opacity='0';
document.body.appendChild(ta);ta.select();
try{document.execCommand('copy');done();}catch(e){}
document.body.removeChild(ta);
}
});
}
});
})();
/* ---------- 商品頁色卡變體按鈕 ---------- */
(function(){
document.querySelectorAll('.ming-swatches').forEach(function(sw){
var attr=sw.getAttribute('data-attribute');
if(!attr)return;
var form=sw.closest('form.variations_form');
if(!form)return;
var select=form.querySelector('select[name="attribute_'+attr+'"]');
if(!select)return;
function sync(){
var opts=select.options;
sw.querySelectorAll('.ming-swatch').forEach(function(b){
var v=b.getAttribute('data-value');
var opt=null;
for(var i=0;i<opts.length;i++){if(opts[i].value===v){opt=opts[i];break;}}
b.classList.toggle('is-active',select.value===v);
b.classList.toggle('is-disabled',!opt||opt.disabled);
});
}
sw.addEventListener('click',function(ev){
var btn=ev.target.closest('.ming-swatch');
if(!btn||btn.classList.contains('is-disabled'))return;
select.value=btn.getAttribute('data-value');
select.dispatchEvent(new Event('change',{bubbles:true}));
sync();
});
select.addEventListener('change',sync);
if(window.MutationObserver){
var mo=new MutationObserver(sync);
mo.observe(select,{attributes:true,childList:true,subtree:true});
}
sync();
});
})();
/* ---------- 色卡點點:切換卡片商品圖 + 連結預選顏色 ---------- */
(function(){
document.addEventListener('click',function(e){
var dot=e.target.closest('.cdot');
if(!dot){return;}
e.preventDefault();
var card=dot.closest('.pcard, .vcard, li.product');
if(!card){return;}
var img=dot.getAttribute('data-img');
var pic=card.querySelector('.ph img, .woocommerce-loop-product__link img');
if(img&&pic){
pic.removeAttribute('srcset');
pic.removeAttribute('sizes');
if(pic.src!==img){
pic.style.opacity='0';
pic.addEventListener('load',function(){pic.style.opacity='1';},{once:true});
pic.src=img;
}
}
var link=dot.getAttribute('data-link');
if(link){
card.querySelectorAll('a.ph, a.more, a.woocommerce-loop-product__link').forEach(function(a){a.href=link;});
}
var wrap=dot.closest('.colors');
if(wrap){wrap.querySelectorAll('.cdot').forEach(function(d){d.classList.remove('is-on');});}
dot.classList.add('is-on');
var vid=dot.getAttribute('data-vid');
if(vid){card.setAttribute('data-vid',vid);}
});
})();
+93
View File
@@ -0,0 +1,93 @@
<?php
/**
* Theme footer.
*
* @package MING
*/
$ming_base = is_front_page() ? '' : esc_url( home_url( '/' ) );
$ming_company = get_theme_mod( 'ming_company', '明序有限公司' );
$ming_email = get_theme_mod( 'ming_email', '' );
$ming_phone = get_theme_mod( 'ming_phone', '' );
$ming_address = get_theme_mod( 'ming_address', '' );
$ming_taxid = get_theme_mod( 'ming_taxid', '' );
$ming_facebook = get_theme_mod( 'ming_facebook', '' );
$ming_ig = get_theme_mod( 'ming_instagram', '' );
$ming_line = get_theme_mod( 'ming_line', '' );
$ming_has_social = ( $ming_facebook || $ming_ig || $ming_line );
$ming_mailto = $ming_email ? $ming_email : 'hello@ming.example';
?>
<footer class="footer">
<div class="wrap footer-grid">
<div>
<div class="flogo">
<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/img/logo-light.png' ); ?>" alt="MING 明命" width="847" height="811">
</div>
<p class="fdesc">以時間為序,以土地為根,以光明為引。MING 專注於陶瓷內膽飲具,讓喝水這件日常小事,成為人與自然之間溫柔的連結。</p>
<?php if ( $ming_has_social ) : ?>
<div class="social">
<?php if ( $ming_facebook ) : ?>
<a href="<?php echo esc_url( $ming_facebook ); ?>" target="_blank" rel="noopener" aria-label="Facebook" title="Facebook">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"/></svg>
</a>
<?php endif; ?>
<?php if ( $ming_ig ) : ?>
<a href="<?php echo esc_url( $ming_ig ); ?>" target="_blank" rel="noopener" aria-label="Instagram" title="Instagram">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="4" width="16" height="16" rx="4.5"/><circle cx="12" cy="12" r="3.8"/><circle cx="16.8" cy="7.2" r=".9" fill="currentColor" stroke="none"/></svg>
</a>
<?php endif; ?>
<?php if ( $ming_line ) : ?>
<a href="<?php echo esc_url( $ming_line ); ?>" target="_blank" rel="noopener" aria-label="LINE" title="LINE">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4C7 4 3 6.9 3 10.6c0 3.3 2.9 6 6.8 6.6.3.1.7.2.8.5.1.2.1.6 0 .9l-.4 1.3c0 .2-.1.6.5.4.6-.3 3.3-2 4.5-2.7 2.9-1.3 4.8-3.6 4.8-7C21 6.9 17 4 12 4z"/><text x="12" y="13" text-anchor="middle" font-size="5.2" font-weight="600" fill="currentColor" stroke="none" font-family="sans-serif" letter-spacing=".5">LINE</text></svg>
</a>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
<div>
<h4>顧客服務</h4>
<ul>
<?php if ( has_nav_menu( 'footer_service' ) ) : ?>
<?php wp_nav_menu( array( 'theme_location' => 'footer_service', 'container' => false, 'items_wrap' => '%3$s', 'depth' => 1 ) ); ?>
<?php else : ?>
<li><a href="<?php echo esc_url( home_url( '/contact-us/' ) ); ?>">聯絡我們</a></li>
<li><a href="<?php echo esc_url( home_url( '/faq/' ) ); ?>">常見問題 FAQ</a></li>
<?php endif; ?>
</ul>
</div>
<div>
<h4>購物指南</h4>
<ul>
<?php if ( has_nav_menu( 'footer_guide' ) ) : ?>
<?php wp_nav_menu( array( 'theme_location' => 'footer_guide', 'container' => false, 'items_wrap' => '%3$s', 'depth' => 1 ) ); ?>
<?php else : ?>
<li><a href="<?php echo esc_url( home_url( '/ordering-guide/' ) ); ?>">訂購須知</a></li>
<li><a href="<?php echo esc_url( home_url( '/return-policy/' ) ); ?>">退換貨政策</a></li>
<li><a href="<?php echo esc_url( home_url( '/privacy-policy/' ) ); ?>">隱私權政策</a></li>
<?php endif; ?>
</ul>
</div>
<div>
<h4>品牌探索</h4>
<ul>
<?php if ( has_nav_menu( 'footer_brand' ) ) : ?>
<?php wp_nav_menu( array( 'theme_location' => 'footer_brand', 'container' => false, 'items_wrap' => '%3$s', 'depth' => 1 ) ); ?>
<?php else : ?>
<li><a href="<?php echo esc_attr( ming_page_url_by_template( 'template-brand.php', $ming_base . '#philosophy' ) ); ?>">關於我們</a></li>
<li><a href="<?php echo esc_attr( ming_page_url_by_template( 'template-ceramic.php', $ming_base . '#core' ) ); ?>">陶瓷內膽</a></li>
<li><a href="<?php echo esc_attr( ming_page_url_by_template( 'template-vote.php', $ming_base ) ); ?>">新品許願</a></li>
<li><a href="<?php echo esc_attr( ming_shop_url() ); ?>">線上商店</a></li>
<?php endif; ?>
</ul>
</div>
</div>
<div class="footer-bottom">
<span>© <?php echo esc_html( gmdate( 'Y' ) ); ?> <?php echo esc_html( $ming_company ? $ming_company : 'MING 明命' ); ?><?php if ( $ming_taxid ) : ?> · 統一編號 <?php echo esc_html( $ming_taxid ); ?><?php endif; ?><?php if ( $ming_phone ) : ?> · <a href="tel:<?php echo esc_attr( preg_replace( '/[^0-9+\-]/', '', $ming_phone ) ); ?>"><?php echo esc_html( $ming_phone ); ?></a><?php endif; ?><?php if ( $ming_email ) : ?> · <a href="mailto:<?php echo esc_attr( $ming_email ); ?>"><?php echo esc_html( $ming_email ); ?></a><?php endif; ?><?php if ( $ming_address ) : ?> · <?php echo esc_html( $ming_address ); ?><?php endif; ?></span>
<span>明亮生命 自然連結</span>
</div>
</footer>
<?php wp_footer(); ?>
</body>
</html>
+214
View File
@@ -0,0 +1,214 @@
<?php
/**
* Front page template — MING 明命品牌首頁.
*
* @package MING
*/
get_header();
$ming_brand_url = ming_page_url_by_template( 'template-brand.php', '#philosophy' );
$ming_shop = ming_shop_url();
$ming_email = get_theme_mod( 'ming_email', '' );
$ming_mailto = $ming_email ? $ming_email : 'hello@ming.example';
/* 首頁產品卡:即時從 WooCommerce 商品讀取(名稱/圖片/價格/連結均來自後台商品) */
$ming_curated = array(
array( 'key' => '冰霸', 'series' => 'Ming Fate', 'desc' => '大容量陶瓷內膽,寬口好加冰,一提就走的全天候補水夥伴。' ),
array( 'key' => '雙用', 'series' => 'Brew Series', 'desc' => '重力鎖水設計,直飲、泡茶兩種用法自由切換,六色可選。' ),
array( 'key' => '小清新', 'series' => 'Fresh Series', 'desc' => '輕盈小巧的陶瓷內膽杯,日常通勤的溫柔陪伴。' ),
array( 'key' => '漸層', 'series' => 'Gradient Series', 'desc' => '如晨霧般的漸層色彩,裝下一天的光線變化。' ),
array( 'key' => '迷你', 'series' => 'Mini Series', 'desc' => '一手掌握的小尺寸,放進小包也不佔空間。' ),
array( 'key' => '隨行', 'series' => 'Handle Series', 'desc' => '一體成型提手設計,戶外運動、郊遊都好攜帶。' ),
);
$ming_cards = array();
if ( class_exists( 'WooCommerce' ) ) {
$ming_pq = new WP_Query( array(
'post_type' => 'product',
'posts_per_page' => -1,
'post_status' => 'publish',
'orderby' => array( 'menu_order' => 'ASC', 'date' => 'ASC' ),
) );
foreach ( $ming_pq->posts as $ming_pp ) {
$ming_prod = wc_get_product( $ming_pp->ID );
if ( ! $ming_prod ) { continue; }
$ming_series = 'MING';
$ming_desc = '';
foreach ( $ming_curated as $ming_cu ) {
if ( false !== mb_strpos( $ming_pp->post_title, $ming_cu['key'] ) ) {
$ming_series = $ming_cu['series'];
$ming_desc = $ming_cu['desc'];
break;
}
}
$ming_excerpt = trim( wp_strip_all_tags( $ming_prod->get_short_description() ) );
if ( $ming_excerpt ) { $ming_desc = $ming_excerpt; }
$ming_colors = ming_product_color_options( $ming_prod );
$ming_cards[] = array(
'name' => $ming_prod->get_name(),
'link' => get_permalink( $ming_pp->ID ),
'img' => get_the_post_thumbnail_url( $ming_pp->ID, 'large' ),
'series' => $ming_series,
'desc' => $ming_desc,
'price' => $ming_prod->get_price_html(),
'colors' => $ming_colors,
);
}
wp_reset_postdata();
}
?>
<!-- Hero -->
<section class="hero" id="top">
<div class="logo-show">
<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/img/' ); ?>logo.png" alt="MING 明命品牌標誌" width="847" height="811">
</div>
<h1 class="reveal"><span class="hl">以時間為序<span class="d-sp"> </span><span class="m-br"></span>以土地為根</span><span class="hl">以<em>光明</em>為引</span></h1>
<p class="sub reveal">連結人與自然 · 連結生活與生命</p>
<div class="hero-cta reveal">
<a class="btn" href="<?php echo esc_attr( $ming_shop ); ?>">立即選購</a>
<a class="btn ghost" href="<?php echo esc_attr( $ming_brand_url ); ?>">關於我們</a>
</div>
<div class="rule"></div>
<figure class="hero-figure reveal">
<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/img/' ); ?>hero.jpg" alt="MING 陶瓷內膽杯全色系" width="1294" height="1216">
<span class="frame-tag">陶瓷內膽系列</span>
<span class="frame-note">MING FATE · 提手冰霸杯</span>
</figure>
</section>
<!-- 品牌理念(摘要) -->
<section class="section" id="philosophy">
<div class="wrap philo-grid">
<div class="philo-logo reveal">
<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/img/' ); ?>logo.png" alt="MING 品牌標誌" width="847" height="811">
<p class="caption">MING — 取「明」與「命」之意</p>
</div>
<div class="philo-copy reveal">
<p class="eyebrow">BRAND PHILOSOPHY</p>
<h2 class="h2">MING,不止是名字,<br class="d-br">而是對「明」與「命」的詮釋</h2>
<div class="divider"></div>
<p>外圓以時鐘與田地為意象,象徵時間的流轉與土地的循環,表達人與天地、時間與萬物之間持續而深刻的連結。</p>
<p>「明」,是光明,是看見,是對美好生活的嚮往;「命」,是生命,是人與自然之間的連結,也是萬物生生不息的延續。</p>
<div class="keywords">
<div class="kw"><b>明</b><span>光明 · 看見</span></div>
<div class="kw"><b>命</b><span>生命 · 連結</span></div>
<div class="kw"><b>三</b><span>三生萬物</span></div>
</div>
<a class="textlink" href="<?php echo esc_attr( $ming_brand_url ); ?>">關於我們 →</a>
</div>
</div>
</section>
<!-- 品牌宣傳片(外觀→自訂→MING 品牌宣傳片 設定;支援 YouTube / 本機 mp4,站內播放) -->
<?php if ( get_theme_mod( 'ming_video_enable' ) && get_theme_mod( 'ming_video_url' ) ) : ?>
<?php
$ming_vsrc = get_theme_mod( 'ming_video_source', 'youtube' );
$ming_vurl = trim( (string) get_theme_mod( 'ming_video_url' ) );
$ming_vtitle = get_theme_mod( 'ming_video_title', '品牌宣傳片' );
$ming_vdesc = get_theme_mod( 'ming_video_desc', '' );
/* 自動識別:只要網址能解析出 YouTube ID 就走 iframe,與來源選項無關(避免貼錯來源導致黑屏) */
$ming_ytid = ming_youtube_id( $ming_vurl );
?>
<section class="section video-sec" id="brand-video">
<div class="wrap video-grid">
<div class="video-copy reveal">
<p class="eyebrow">BRAND FILM</p>
<h2 class="h2"><?php echo esc_html( $ming_vtitle ); ?></h2>
<div class="divider"></div>
<?php if ( $ming_vdesc ) : ?><p class="video-desc"><?php echo nl2br( esc_html( $ming_vdesc ) ); ?></p><?php endif; ?>
</div>
<div class="video-frame reveal">
<?php if ( $ming_ytid ) : ?>
<iframe src="https://www.youtube-nocookie.com/embed/<?php echo esc_attr( $ming_ytid ); ?>?rel=0" title="<?php echo esc_attr( $ming_vtitle ); ?>" loading="lazy" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<?php elseif ( preg_match( '/\.(mp4|webm|mov|m4v)(\?|#|$)/i', $ming_vurl ) || 'mp4' === $ming_vsrc ) : ?>
<video controls preload="metadata" playsinline poster="">
<source src="<?php echo esc_url( $ming_vurl ); ?>" type="video/mp4">
您的瀏覽器不支援影片播放。
</video>
<?php else : ?>
<div class="video-invalid">影片連結無法識別<?php echo current_user_can( 'manage_options' ) ? '(請至 外觀 → 自訂 → 品牌宣傳片 檢查網址)' : ''; ?></div>
<?php endif; ?>
</div>
</div>
</section>
<?php endif; ?>
<!-- 產品系列 -->
<section class="section" id="products">
<div class="wrap">
<div class="prod-head reveal">
<div>
<p class="eyebrow">COLLECTION</p>
<h2 class="h2">陶瓷內膽杯系列</h2>
</div>
<p class="note">純陶瓷內膽 · 抗酸鹼 · 耐腐蝕 · 無異味</p>
</div>
<div class="prod-grid" id="prodGrid">
<?php foreach ( $ming_cards as $ming_c ) : ?>
<article class="pcard reveal">
<a class="ph" href="<?php echo esc_url( $ming_c['link'] ); ?>"><?php if ( $ming_c['img'] ) : ?><img src="<?php echo esc_url( $ming_c['img'] ); ?>" alt="<?php echo esc_attr( $ming_c['name'] ); ?>" loading="lazy"><?php endif; ?></a>
<div class="pb">
<div class="series"><?php echo esc_html( $ming_c['series'] ); ?></div>
<h3><?php echo esc_html( $ming_c['name'] ); ?></h3>
<?php if ( $ming_c['price'] ) : ?><span class="price"><?php echo wp_kses_post( $ming_c['price'] ); ?></span><?php endif; ?>
<?php if ( $ming_c['desc'] ) : ?><p><?php echo esc_html( $ming_c['desc'] ); ?></p><?php endif; ?>
<div class="foot">
<span class="colors"><?php foreach ( $ming_c['colors'] as $ming_col ) : ?>
<button type="button" class="cdot" style="background:<?php echo esc_attr( $ming_col['hex'] ); ?>" title="<?php echo esc_attr( $ming_col['name'] ); ?>" aria-label="<?php echo esc_attr( $ming_col['name'] ); ?>"<?php if ( ! empty( $ming_col['img'] ) ) : ?> data-img="<?php echo esc_url( $ming_col['img'] ); ?>"<?php endif; ?> data-link="<?php echo esc_url( $ming_col['link'] ); ?>"></button>
<?php endforeach; ?></span>
<a class="more" href="<?php echo esc_url( $ming_c['link'] ); ?>">了解詳情</a>
</div>
</div>
</article>
<?php endforeach; ?>
</div>
<div class="prod-cta reveal">
<a class="btn" href="<?php echo esc_attr( $ming_shop ); ?>">進入商店,看全部商品</a>
</div>
</div>
</section>
<!-- 四大核心 -->
<section class="section core" id="core">
<div class="wrap">
<p class="eyebrow reveal">CORE PRODUCT</p>
<h2 class="h2 reveal">純陶瓷內膽,<br>解決你的後顧之憂</h2>
<div class="core-grid">
<div class="core-list reveal">
<div class="core-item">
<span class="no">01</span>
<div><h3>純陶瓷內膽</h3><p>內壁採用純陶瓷材質,不易殘留、減少細菌滋生,裝咖啡、茶飲、果汁都不串味。</p></div>
</div>
<div class="core-item">
<span class="no">02</span>
<div><h3>保冷保熱</h3><p>雙層真空結構搭配陶瓷內膽,長效鎖溫,冰飲熱飲都維持剛剛好的口感。</p></div>
</div>
<div class="core-item">
<span class="no">03</span>
<div><h3>全身可拆洗</h3><p>杯蓋、吸管、內膽皆可拆開清洗,每個角落都乾淨,日常使用更安心。</p></div>
</div>
<div class="core-item">
<span class="no">04</span>
<div><h3>舒適手提</h3><p>加粗手柄設計,握感舒適、一提就走,通勤、運動、旅行都自在隨行。</p></div>
</div>
</div>
<figure class="core-figure reveal">
<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/img/' ); ?>detail-liner.jpg" alt="陶瓷內膽結構分解" width="790" height="993">
<figcaption class="cap">CERAMIC LINER · 抗酸鹼 耐腐蝕 無異味</figcaption>
</figure>
</div>
</div>
</section>
<!-- 結語 -->
<section class="closing" id="contact">
<div class="reveal">
<p class="q">讓每一件事物<br>都擁有屬於<em>自己的光</em></p>
<p class="sub">ENJOY YOUR DRINKING — MING</p>
<a class="cta" href="mailto:<?php echo esc_attr( $ming_mailto ); ?>">聯絡我們</a>
</div>
</section>
<?php
get_footer();
File diff suppressed because it is too large Load Diff
+124
View File
@@ -0,0 +1,124 @@
<?php
/**
* Theme header.
*
* @package MING
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<div class="topbar">MING 明命 · 明亮生命 自然連結</div>
<header class="site-header">
<div class="header-inner">
<button class="hamburger" type="button" aria-label="<?php esc_attr_e( '開啟選單', 'ming' ); ?>" aria-expanded="false" aria-controls="ming-mnav">
<span></span><span></span><span></span>
</button>
<a class="brand" href="<?php echo esc_url( home_url( '/' ) ); ?>" aria-label="MING 首頁">
<?php if ( has_custom_logo() ) : ?>
<?php
$custom_logo_id = get_theme_mod( 'custom_logo' );
echo wp_get_attachment_image(
$custom_logo_id,
'full',
false,
array( 'class' => 'brand-mark', 'alt' => get_bloginfo( 'name' ) )
);
?>
<?php else : ?>
<img class="brand-mark" src="<?php echo esc_url( get_template_directory_uri() . '/assets/img/logo-mark.png' ); ?>" alt="MING 標誌" width="847" height="620">
<?php endif; ?>
<span class="wm">MING</span>
</a>
<nav class="mainnav" aria-label="<?php esc_attr_e( '主選單', 'ming' ); ?>">
<?php
if ( has_nav_menu( 'primary' ) ) {
wp_nav_menu(
array(
'theme_location' => 'primary',
'container' => false,
'items_wrap' => '%3$s',
'depth' => 1,
)
);
} else {
echo ming_fallback_menu(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</nav>
<div class="header-actions">
<?php if ( class_exists( 'WooCommerce' ) ) : ?>
<button class="haction hsearch" type="button" aria-label="<?php esc_attr_e( '搜尋商品', 'ming' ); ?>" aria-expanded="false" aria-controls="ming-searchbar" title="<?php esc_attr_e( '搜尋商品', 'ming' ); ?>">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.3-4.3"/></svg>
</button>
<a class="haction" href="<?php echo esc_url( wc_get_page_permalink( 'myaccount' ) ); ?>" aria-label="<?php esc_attr_e( '會員中心', 'ming' ); ?>" title="<?php esc_attr_e( '會員中心', 'ming' ); ?>">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 3.6-6.5 8-6.5s8 2.5 8 6.5"/></svg>
</a>
<a class="haction hcart" href="<?php echo esc_url( wc_get_cart_url() ); ?>" aria-label="<?php esc_attr_e( '購物車', 'ming' ); ?>" title="<?php esc_attr_e( '購物車', 'ming' ); ?>">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 7h12l-1.2 12.2a1.5 1.5 0 0 1-1.5 1.3H8.7a1.5 1.5 0 0 1-1.5-1.3L6 7z"/><path d="M9 10V6a3 3 0 0 1 6 0v4"/></svg>
<span class="hcount"><?php echo esc_html( WC()->cart->get_cart_contents_count() ); ?></span>
</a>
<?php endif; ?>
</div>
</div>
</header>
<?php if ( class_exists( 'WooCommerce' ) ) : ?>
<div class="searchbar" id="ming-searchbar" aria-hidden="true">
<form class="searchbar-form" role="search" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<input type="search" name="s" placeholder="<?php esc_attr_e( '搜尋商品名稱,例如:冰霸杯', 'ming' ); ?>" aria-label="<?php esc_attr_e( '搜尋商品', 'ming' ); ?>" autocomplete="off">
<input type="hidden" name="post_type" value="product">
<button type="submit" class="btn"><?php esc_html_e( '搜尋', 'ming' ); ?></button>
</form>
</div>
<?php endif; ?>
<div class="mnav-overlay" aria-hidden="true"></div>
<div class="mnav" id="ming-mnav" aria-hidden="true">
<div class="mnav-head">
<button class="mnav-close" type="button" aria-label="<?php esc_attr_e( '關閉選單', 'ming' ); ?>">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M5 5l14 14M19 5L5 19"/></svg>
</button>
<span class="mnav-brand">MING</span>
</div>
<nav class="mnav-list" aria-label="<?php esc_attr_e( '行動版選單', 'ming' ); ?>">
<?php
if ( has_nav_menu( 'primary' ) ) {
wp_nav_menu(
array(
'theme_location' => 'primary',
'container' => false,
'items_wrap' => '%3$s',
'depth' => 1,
'link_after' => '<span class="mnav-arrow">→</span>',
)
);
} else {
echo ming_fallback_menu(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</nav>
<div class="mnav-foot">
<?php if ( class_exists( 'WooCommerce' ) ) : ?>
<form class="mnav-search" role="search" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<input type="search" name="s" placeholder="<?php esc_attr_e( '搜尋商品…', 'ming' ); ?>" aria-label="<?php esc_attr_e( '搜尋商品', 'ming' ); ?>">
<input type="hidden" name="post_type" value="product">
<button type="submit" aria-label="<?php esc_attr_e( '搜尋', 'ming' ); ?>">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.3-4.3"/></svg>
</button>
</form>
<a class="mnav-account" href="<?php echo esc_url( wc_get_page_permalink( 'myaccount' ) ); ?>">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 3.6-6.5 8-6.5s8 2.5 8 6.5"/></svg>
<?php echo is_user_logged_in() ? esc_html__( '會員中心', 'ming' ) : esc_html__( '登入 / 註冊', 'ming' ); ?>
</a>
<?php endif; ?>
</div>
</div>
+83
View File
@@ -0,0 +1,83 @@
<?php
/**
* Fallback template (posts / archives / search).
*
* @package MING
*/
get_header();
?>
<main class="section">
<div class="wrap">
<?php if ( have_posts() ) : ?>
<?php if ( ! is_singular() ) : ?>
<p class="eyebrow">MING</p>
<h2 class="h2"><?php echo is_search() ? esc_html__( '搜尋結果', 'ming' ) : esc_html( get_the_archive_title() ? wp_strip_all_tags( get_the_archive_title() ) : __( '文章', 'ming' ) ); ?></h2>
<?php endif; ?>
<?php if ( is_category() ) : ?>
<div class="archive-journal-grid">
<?php
while ( have_posts() ) :
the_post();
$ming_acat = get_the_category();
$ming_aname = $ming_acat ? $ming_acat[0]->name : '';
?>
<a class="jcard" href="<?php the_permalink(); ?>">
<div class="jimg">
<?php if ( has_post_thumbnail() ) : ?>
<img src="<?php echo esc_url( get_the_post_thumbnail_url( null, 'medium_large' ) ); ?>" alt="<?php the_title_attribute(); ?>" loading="lazy">
<?php endif; ?>
<?php if ( $ming_aname ) : ?><span class="jcat"><?php echo esc_html( $ming_aname ); ?></span><?php endif; ?>
</div>
<div class="jbody">
<time><?php echo esc_html( get_the_date( 'Y.m.d' ) ); ?></time>
<h3><?php the_title(); ?></h3>
<p><?php echo esc_html( wp_trim_words( wp_strip_all_tags( get_the_content() ), 30, '…' ) ); ?></p>
<span class="jmore">閱讀全文 →</span>
</div>
</a>
<?php
endwhile;
?>
</div>
<?php the_posts_pagination( array( 'prev_text' => __( '上一頁', 'ming' ), 'next_text' => __( '下一頁', 'ming' ) ) ); ?>
<?php else : ?>
<div style="max-width:46em;margin-top:2.5rem">
<?php
while ( have_posts() ) :
the_post();
?>
<article <?php post_class(); ?> style="margin-bottom:3rem">
<h3 style="font-family:var(--serif);font-weight:600;font-size:1.3rem;letter-spacing:.1em;color:var(--green-deep)">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h3>
<div style="font-size:.78rem;letter-spacing:.2em;color:var(--muted);margin:.4rem 0 1rem"><?php echo esc_html( get_the_date() ); ?></div>
<div class="entry-content">
<?php is_singular() ? the_content() : the_excerpt(); ?>
</div>
</article>
<?php
endwhile;
the_posts_pagination(
array(
'prev_text' => __( '上一頁', 'ming' ),
'next_text' => __( '下一頁', 'ming' ),
)
);
?>
</div>
<?php endif; ?>
<?php else : ?>
<p class="eyebrow">404</p>
<h2 class="h2"><?php esc_html_e( '找不到內容', 'ming' ); ?></h2>
<p style="margin-top:1.5rem;color:var(--muted)"><?php esc_html_e( '這裡沒有任何內容,請回到首頁。', 'ming' ); ?></p>
<p style="margin-top:2rem"><a class="cta" style="display:inline-block;padding:.95rem 3.2rem;border:1px solid var(--green-deep);font-size:.82rem;letter-spacing:.4em;color:var(--green-deep)" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php esc_html_e( '回首頁', 'ming' ); ?></a></p>
<?php endif; ?>
</div>
</main>
<?php
get_footer();
+47
View File
@@ -0,0 +1,47 @@
<?php
/**
* Page template.
*
* @package MING
*/
get_header();
// WooCommerce 頁面(購物車 / 結帳 / 我的帳戶)需要完整寬度。
$ming_wide = function_exists( 'is_account_page' )
&& ( is_account_page() || is_cart() || is_checkout() || is_wc_endpoint_url() );
$ming_wrap_style = $ming_wide ? '' : ' style="max-width:46em"';
?>
<main class="section">
<div class="wrap"<?php echo $ming_wrap_style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php
while ( have_posts() ) :
the_post();
?>
<article <?php post_class(); ?>>
<p class="eyebrow">MING</p>
<h2 class="h2"><?php the_title(); ?></h2>
<div class="entry-content" style="margin-top:2.5rem">
<?php
the_content();
wp_link_pages(
array(
'before' => '<div class="page-links">' . esc_html__( '頁面:', 'ming' ),
'after' => '</div>',
)
);
?>
</div>
</article>
<?php
if ( comments_open() || get_comments_number() ) {
comments_template();
}
endwhile;
?>
</div>
</main>
<?php
get_footer();
Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

+76
View File
@@ -0,0 +1,76 @@
<?php
/**
* Search results — product search renders as a WooCommerce-style grid.
*
* @package MING
*/
get_header();
$ming_is_product_search = is_search() && ( 'product' === get_query_var( 'post_type' ) ) && class_exists( 'WooCommerce' );
?>
<main class="section">
<div class="wrap">
<p class="eyebrow">SEARCH</p>
<h2 class="h2">
<?php
/* translators: %s: search query. */
printf( esc_html__( '「%s」的搜尋結果', 'ming' ), esc_html( get_search_query() ) );
?>
</h2>
<?php if ( have_posts() ) : ?>
<?php if ( $ming_is_product_search ) : ?>
<ul class="products columns-4 ming-search-grid">
<?php
while ( have_posts() ) :
the_post();
wc_get_template_part( 'content', 'product' );
endwhile;
?>
</ul>
<?php else : ?>
<div style="max-width:46em;margin-top:2.5rem">
<?php
while ( have_posts() ) :
the_post();
?>
<article <?php post_class(); ?> style="margin-bottom:3rem">
<h3 style="font-family:var(--serif);font-weight:600;font-size:1.3rem;letter-spacing:.1em;color:var(--green-deep)">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h3>
<div class="entry-content"><?php the_excerpt(); ?></div>
</article>
<?php
endwhile;
?>
</div>
<?php endif; ?>
<?php
the_posts_pagination(
array(
'prev_text' => __( '上一頁', 'ming' ),
'next_text' => __( '下一頁', 'ming' ),
)
);
?>
<?php else : ?>
<div class="search-empty">
<p><?php esc_html_e( '找不到相關商品,換個關鍵字試試。', 'ming' ); ?></p>
<form role="search" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>" class="searchbar-form">
<input type="search" name="s" value="<?php echo esc_attr( get_search_query() ); ?>" placeholder="<?php esc_attr_e( '搜尋商品名稱', 'ming' ); ?>">
<input type="hidden" name="post_type" value="product">
<button type="submit" class="btn"><?php esc_html_e( '搜尋', 'ming' ); ?></button>
</form>
<a class="textlink" href="<?php echo esc_attr( ming_shop_url() ); ?>"><?php esc_html_e( '瀏覽全部商品 →', 'ming' ); ?></a>
</div>
<?php endif; ?>
</div>
</main>
<?php
get_footer();
+126
View File
@@ -0,0 +1,126 @@
<?php
/**
* 單一投票活動頁.
*
* @package MING
*/
get_header();
$ming_cid = get_the_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_expired = ming_campaign_expired( $ming_cid );
$ming_uid = get_current_user_id();
$ming_voted = array();
$ming_voted_sk = array(); // pid => vid.
foreach ( $ming_uid ? (array) get_user_meta( $ming_uid, 'ming_voted_c' . $ming_cid, true ) : array() as $ming_e ) {
$ming_ep = explode( ':', (string) $ming_e );
$ming_voted[] = (int) $ming_ep[0];
if ( ! empty( $ming_ep[1] ) ) { $ming_voted_sk[ (int) $ming_ep[0] ] = (int) $ming_ep[1]; }
}
$ming_items = array();
foreach ( array_map( 'intval', (array) get_post_meta( $ming_cid, 'ming_products', true ) ) as $ming_pid ) {
$ming_prod = wc_get_product( $ming_pid );
if ( ! $ming_prod || 'publish' !== get_post_status( $ming_pid ) ) { continue; }
$ming_colors = ming_product_color_options( $ming_prod );
foreach ( $ming_colors as $ming_ci => $ming_co ) {
$ming_colors[ $ming_ci ]['votes'] = ! empty( $ming_co['vid'] ) ? (int) get_post_meta( $ming_co['vid'], 'ming_votes_c' . $ming_cid, true ) : 0;
}
// 預設選中色:商品預設屬性 > 使用者已投的色 > 第一個.
$ming_dslug = '';
$ming_defs = $ming_prod->get_default_attributes();
if ( ! empty( $ming_defs['pa_color'] ) ) { $ming_dslug = $ming_defs['pa_color']; }
$ming_sel = 0;
foreach ( $ming_colors as $ming_ci => $ming_co ) {
if ( $ming_co['slug'] && $ming_co['slug'] === $ming_dslug ) { $ming_sel = $ming_ci; break; }
}
if ( isset( $ming_voted_sk[ $ming_pid ] ) ) {
foreach ( $ming_colors as $ming_ci => $ming_co ) {
if ( ! empty( $ming_co['vid'] ) && $ming_co['vid'] === $ming_voted_sk[ $ming_pid ] ) { $ming_sel = $ming_ci; break; }
}
}
$ming_items[] = array(
'id' => $ming_pid,
'name' => $ming_prod->get_name(),
'link' => get_permalink( $ming_pid ),
'img' => get_the_post_thumbnail_url( $ming_pid, 'large' ),
'desc' => trim( wp_strip_all_tags( $ming_prod->get_short_description() ) ),
'colors' => $ming_colors,
'sel' => $ming_sel,
'votes' => (int) get_post_meta( $ming_pid, 'ming_votes_c' . $ming_cid, true ),
);
}
usort( $ming_items, function( $a, $b ) { return $b['votes'] - $a['votes']; } );
?>
<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">
<?php if ( $ming_expired ) : ?>
本活動已截止,感謝大家的參與。
<?php elseif ( $ming_deadline ) : ?>
活動截止:<?php echo esc_html( date_i18n( 'Y年n月j日 H:i', strtotime( $ming_deadline ) ) ); ?> · 每人每款一票
<?php else : ?>
告訴我們你最想要哪一款,呼聲最高的款式將優先生產。每人每款一票。
<?php endif; ?>
</p>
</div>
</section>
<section class="section">
<div class="wrap">
<?php if ( empty( $ming_items ) ) : ?>
<p class="vote-empty reveal">本活動尚未設定參與商品。</p>
<?php else : ?>
<div class="prod-grid vote-grid">
<?php foreach ( $ming_items as $ming_it ) :
$ming_pct = min( 100, round( $ming_it['votes'] / $ming_goal * 100 ) );
$ming_voted_this = in_array( $ming_it['id'], $ming_voted, true );
?>
<article class="pcard vcard reveal" data-id="<?php echo esc_attr( $ming_it['id'] ); ?>" data-cid="<?php echo esc_attr( $ming_cid ); ?>" data-goal="<?php echo esc_attr( $ming_goal ); ?>" data-vid="<?php echo esc_attr( ! empty( $ming_it['colors'][ $ming_it['sel'] ]['vid'] ) ? $ming_it['colors'][ $ming_it['sel'] ]['vid'] : 0 ); ?>">
<a class="ph" href="<?php echo esc_url( $ming_it['link'] ); ?>"><?php if ( $ming_it['img'] ) : ?><img src="<?php echo esc_url( $ming_it['img'] ); ?>" alt="<?php echo esc_attr( $ming_it['name'] ); ?>" loading="lazy"><?php endif; ?></a>
<div class="pb">
<h3><?php echo esc_html( $ming_it['name'] ); ?></h3>
<?php if ( $ming_it['desc'] ) : ?><p><?php echo esc_html( $ming_it['desc'] ); ?></p><?php endif; ?>
<?php if ( $ming_it['colors'] ) : ?>
<span class="colors vote-colors"><?php foreach ( $ming_it['colors'] as $ming_ci => $ming_col ) : ?>
<span class="cdot-wrap"><button type="button" class="cdot<?php echo $ming_ci === $ming_it['sel'] ? ' is-on' : ''; ?>" style="background:<?php echo esc_attr( $ming_col['hex'] ); ?>" title="<?php echo esc_attr( $ming_col['name'] ); ?>" aria-label="<?php echo esc_attr( $ming_col['name'] ); ?>" data-vid="<?php echo esc_attr( $ming_col['vid'] ); ?>"<?php if ( ! empty( $ming_col['img'] ) ) : ?> data-img="<?php echo esc_url( $ming_col['img'] ); ?>"<?php endif; ?> data-link="<?php echo esc_url( $ming_col['link'] ); ?>"></button><em class="cdot-n"><?php echo (int) $ming_col['votes']; ?></em></span>
<?php endforeach; ?></span>
<?php endif; ?>
<div class="vote-meta">
<span class="vcount"><b><?php echo esc_html( $ming_it['votes'] ); ?></b> 人想要</span>
<span class="vgoal">目標 <?php echo esc_html( $ming_goal ); ?> 人</span>
</div>
<div class="vote-bar"><i style="width:<?php echo esc_attr( $ming_pct ); ?>%"></i></div>
<?php if ( $ming_expired ) : ?>
<button type="button" class="vote-btn voted" disabled>已截止</button>
<?php else : ?>
<button type="button" class="vote-btn<?php echo $ming_voted_this ? ' voted' : ''; ?>"<?php echo $ming_voted_this ? ' disabled' : ''; ?>>
<?php echo $ming_voted_this ? '已支持 ✓' : '我想要這款'; ?>
</button>
<?php endif; ?>
</div>
</article>
<?php endforeach; ?>
</div>
<p class="vote-note reveal"><?php echo $ming_expired ? '感謝參與,結果將作為新品備貨依據。' : '登入會員後即可投票,每人每款一票。票數即時更新。'; ?></p>
<div class="vote-share reveal">
<p class="vote-share-text">覺得哪一款最該生產?分享給朋友一起來投票,讓呼聲被看見。</p>
<?php
ming_share_bar( array(
'title' => get_the_title() . '|MING 明命 新品許願池',
'text' => '我正在 MING 明命的新品許願池投票:' . get_the_title() . ',一起來許願,呼聲最高的款式將優先生產!',
'label' => '分享這個許願活動',
) );
?>
</div>
<?php endif; ?>
</div>
</section>
<?php
get_footer();
+97
View File
@@ -0,0 +1,97 @@
<?php
/**
* 單篇文章模板(品牌專欄 / 媒體報導 / 開箱評測).
*
* @package MING
*/
get_header();
while ( have_posts() ) :
the_post();
$ming_cats = get_the_category();
$ming_cat = $ming_cats ? $ming_cats[0] : null;
$ming_catnm = $ming_cat ? $ming_cat->name : __( '文章', 'ming' );
?>
<section class="page-hero post-hero">
<div class="wrap">
<p class="eyebrow reveal"><?php echo esc_html( strtoupper( $ming_cat ? $ming_cat->slug : 'journal' ) ); ?></p>
<h1 class="h1 reveal"><?php the_title(); ?></h1>
<p class="sub reveal">
<?php if ( $ming_cat ) : ?><a class="post-cat" href="<?php echo esc_url( get_category_link( $ming_cat ) ); ?>"><?php echo esc_html( $ming_catnm ); ?></a> · <?php endif; ?>
<time datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo esc_html( get_the_date( 'Y.m.d' ) ); ?></time>
</p>
</div>
</section>
<article class="section post-body">
<div class="wrap post-wrap">
<?php if ( has_post_thumbnail() ) : ?>
<figure class="post-cover reveal">
<img src="<?php echo esc_url( get_the_post_thumbnail_url( null, 'large' ) ); ?>" alt="<?php the_title_attribute(); ?>">
</figure>
<?php endif; ?>
<div class="post-content reveal">
<?php the_content(); ?>
</div>
<div class="post-foot reveal">
<?php
ming_share_bar( array(
'title' => get_the_title() . '|MING 明命',
'text' => wp_trim_words( wp_strip_all_tags( get_the_content() ), 30, '…' ),
'label' => '分享這篇文章',
) );
?>
<div class="post-back">
<a class="textlink" href="<?php echo esc_url( ming_page_url_by_template( 'template-journal.php', get_permalink( get_option( 'page_for_posts' ) ) ) ); ?>">← 返回品牌專欄</a>
</div>
</div>
</div>
</article>
<?php
// 同分類其他文章.
if ( $ming_cat ) :
$ming_related = get_posts( array(
'post_type' => 'post',
'posts_per_page' => 3,
'category' => $ming_cat->term_id,
'post__not_in' => array( get_the_ID() ),
) );
if ( $ming_related ) :
?>
<section class="section journal-sec post-related">
<div class="wrap">
<div class="journal-head reveal">
<div>
<p class="eyebrow">MORE</p>
<h2 class="h2">更多「<?php echo esc_html( $ming_catnm ); ?>」</h2>
</div>
</div>
<div class="journal-grid">
<?php foreach ( $ming_related 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_catnm ); ?></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>
</div>
</section>
<?php
endif;
endif;
endwhile;
get_footer();
+15
View File
@@ -0,0 +1,15 @@
/*
Theme Name: MING 明命
Theme URI: https://ming.example
Author: MING 明命
Author URI: https://ming.example
Description: MING 明命品牌官網主題 —— 陶瓷內膽杯 · 明亮生命 自然連結。單頁式品牌首頁,支援 WooCommerce 商城、會員中心、購物車角標、社群連結與公司資訊自訂。
Version: 1.7.3
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ming
Tags: custom-logo, one-page, e-commerce, translation-ready
*/
+98
View File
@@ -0,0 +1,98 @@
<?php
/**
* Template Name: 品牌故事
*
* MING 明命完整品牌故事頁:完整理念、五大意象、因緣橫幅。
*
* @package MING
*/
get_header();
?>
<!-- 頁首 -->
<section class="page-hero">
<div class="wrap">
<p class="eyebrow reveal">BRAND STORY</p>
<h2 class="h2 reveal">MING 明命 · 品牌故事</h2>
<p class="page-hero-sub reveal">明亮生命,自然連結 —— 一枚標誌裡的五個信念</p>
</div>
</section>
<!-- 品牌理念(完整版) -->
<section class="section" id="philosophy">
<div class="wrap philo-grid">
<div class="philo-logo reveal">
<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/img/' ); ?>logo.png" alt="MING 品牌標誌" width="847" height="811">
<p class="caption">MING — 取「明」與「命」之意</p>
</div>
<div class="philo-copy reveal">
<p class="eyebrow">BRAND PHILOSOPHY</p>
<h2 class="h2">MING,不止是名字,<br>而是對「明」與「命」的詮釋</h2>
<div class="divider"></div>
<p>外圓以時鐘與田地為意象,象徵時間的流轉與土地的循環,表達人與天地、時間與萬物之間持續而深刻的連結。</p>
<p>圓形之中以「三」為概念,延伸出生物與萬物的意象——三生萬物,萬物由自然孕育,也在自然之中生長、循環與延續。中心如同一輪太陽,象徵光、溫度與生命,代表希望與明亮。</p>
<p>「明」,是光明,是看見,是對美好生活的嚮往;「命」,是生命,是人與自然之間的連結,也是萬物生生不息的延續。</p>
<div class="keywords">
<div class="kw"><b>明</b><span>光明 · 看見</span></div>
<div class="kw"><b>命</b><span>生命 · 連結</span></div>
<div class="kw"><b>三</b><span>三生萬物</span></div>
</div>
</div>
</div>
</section>
<!-- 五大意象 -->
<section class="section symbols" id="symbols">
<div class="wrap">
<p class="eyebrow reveal">FIVE SYMBOLS</p>
<h2 class="h2 reveal">藏在一枚標誌裡的五個信念</h2>
<div class="symbol-row reveal">
<div class="symbol">
<svg viewBox="0 0 64 64"><circle cx="32" cy="32" r="22"/><line x1="32" y1="10" x2="32" y2="18"/><line x1="54" y1="32" x2="46" y2="32"/><line x1="32" y1="54" x2="32" y2="46"/><line x1="10" y1="32" x2="18" y2="32"/><circle cx="32" cy="32" r="2.4"/></svg>
<h3>時間</h3><p>時光流轉,<br>生生不息。</p>
</div>
<div class="symbol">
<svg viewBox="0 0 64 64"><path d="M12 26 q10 -8 20 0 q10 8 20 0"/><path d="M12 34 q10 -8 20 0 q10 8 20 0"/><path d="M12 42 q10 -8 20 0 q10 8 20 0"/></svg>
<h3>土地</h3><p>自然孕育,<br>萬物生長。</p>
</div>
<div class="symbol">
<svg viewBox="0 0 64 64"><line x1="16" y1="22" x2="48" y2="22"/><line x1="16" y1="32" x2="48" y2="32"/><line x1="16" y1="42" x2="48" y2="42"/></svg>
<h3>三生萬物</h3><p>生物萬象,<br>循環延續。</p>
</div>
<div class="symbol">
<svg viewBox="0 0 64 64"><circle cx="32" cy="32" r="13"/><line x1="32" y1="8" x2="32" y2="14"/><line x1="32" y1="50" x2="32" y2="56"/><line x1="8" y1="32" x2="14" y2="32"/><line x1="50" y1="32" x2="56" y2="32"/><line x1="15" y1="15" x2="19" y2="19"/><line x1="45" y1="45" x2="49" y2="49"/><line x1="49" y1="15" x2="45" y2="19"/><line x1="19" y1="45" x2="15" y2="49"/></svg>
<h3>太陽與光</h3><p>光明溫暖,<br>希望明亮。</p>
</div>
<div class="symbol">
<svg viewBox="0 0 64 64"><circle cx="32" cy="32" r="22"/><text x="32" y="28" text-anchor="middle" font-size="15" fill="var(--green)" stroke="none" font-family="'Noto Serif TC',serif">明</text><text x="32" y="48" text-anchor="middle" font-size="15" fill="var(--green)" stroke="none" font-family="'Noto Serif TC',serif">命</text></svg>
<h3>明・命</h3><p>生命因光而明,<br>萬物因自然而生。</p>
</div>
</div>
</div>
</section>
<!-- 因緣橫幅 -->
<section class="fate-banner">
<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/img/' ); ?>banner-fate.jpg" alt="山巒晨霧,光的意象">
<div class="veil"></div>
<div class="fate-copy">
<div class="inner reveal">
<p class="mark">FATE &amp; CONNECTION</p>
<h2>命,還有因緣的意義</h2>
<p>「命」,不只是生命的起點與結束,更是無數因緣條件交織而成的軌跡。我們所遇見的一切人、事、物,都是因緣合和而來,彼此影響、相互成就。珍惜每一段相遇,善待每一個當下——讓每一件事物,都擁有屬於自己的光。</p>
</div>
</div>
</section>
<!-- 結語 -->
<section class="closing">
<div class="reveal">
<p class="q">讓每一件事物<br>都擁有屬於<em>自己的光</em></p>
<p class="sub">ENJOY YOUR DRINKING — MING</p>
<a class="cta" href="<?php echo esc_attr( ming_shop_url() ); ?>">逛逛我們的商品</a>
</div>
</section>
<?php
get_footer();
+118
View File
@@ -0,0 +1,118 @@
<?php
/**
* Template Name: 陶瓷內膽
*
* MING 明命陶瓷內膽技術介紹頁。
*
* @package MING
*/
get_header();
?>
<!-- 頁首 -->
<section class="page-hero ceramic-hero">
<div class="wrap">
<p class="eyebrow reveal">CERAMIC LINER</p>
<h2 class="h2 reveal">純陶瓷內膽,<br>一杯安心的本質</h2>
<p class="page-hero-sub reveal">抗酸鹼 · 耐腐蝕 · 無異味 · 好清洗</p>
</div>
</section>
<!-- 四大核心 -->
<section class="section core" id="core">
<div class="wrap">
<p class="eyebrow reveal">CORE PRODUCT</p>
<h2 class="h2 reveal">純陶瓷內膽,<br>解決你的後顧之憂</h2>
<div class="core-grid">
<div class="core-list reveal">
<div class="core-item">
<span class="no">01</span>
<div><h3>純陶瓷內膽</h3><p>內壁採用純陶瓷材質,不易殘留、減少細菌滋生,裝咖啡、茶飲、果汁都不串味。</p></div>
</div>
<div class="core-item">
<span class="no">02</span>
<div><h3>保冷保熱</h3><p>雙層真空結構搭配陶瓷內膽,長效鎖溫,冰飲熱飲都維持剛剛好的口感。</p></div>
</div>
<div class="core-item">
<span class="no">03</span>
<div><h3>全身可拆洗</h3><p>杯蓋、吸管、內膽皆可拆開清洗,每個角落都乾淨,日常使用更安心。</p></div>
</div>
<div class="core-item">
<span class="no">04</span>
<div><h3>舒適手提</h3><p>加粗手柄設計,握感舒適、一提就走,通勤、運動、旅行都自在隨行。</p></div>
</div>
</div>
<figure class="core-figure reveal">
<img src="<?php echo esc_url( get_template_directory_uri() . '/assets/img/' ); ?>detail-liner.jpg" alt="陶瓷內膽結構分解" width="790" height="993">
<figcaption class="cap">CERAMIC LINER · 抗酸鹼 耐腐蝕 無異味</figcaption>
</figure>
</div>
</div>
</section>
<!-- 材質比較 -->
<section class="section compare">
<div class="wrap">
<p class="eyebrow reveal">WHY CERAMIC</p>
<h2 class="h2 reveal">陶瓷內膽 vs 一般金屬內膽</h2>
<div class="compare-table reveal">
<div class="cr head">
<div></div><div class="cer">純陶瓷內膽</div><div>一般金屬內膽</div>
</div>
<div class="cr">
<div class="k">酸鹼飲品</div>
<div class="cer">抗酸鹼,咖啡、茶、果汁都安心</div><div>易與酸性飲品產生反應</div>
</div>
<div class="cr">
<div class="k">氣味殘留</div>
<div class="cer">不吸附味道,不易串味</div><div>容易殘留味道與顏色</div>
</div>
<div class="cr">
<div class="k">清潔保養</div>
<div class="cer">釉面光滑,一沖即淨</div><div>細紋易藏污,需費力刷洗</div>
</div>
<div class="cr">
<div class="k">口感風味</div>
<div class="cer">如瓷杯般純淨,還原飲品本味</div><div>可能帶有金屬味</div>
</div>
</div>
</div>
</section>
<!-- 使用場景 -->
<section class="section scenes">
<div class="wrap">
<p class="eyebrow reveal">EVERYDAY MOMENTS</p>
<h2 class="h2 reveal">從清晨到夜晚,都是它的位置</h2>
<div class="scene-grid reveal">
<div class="scene">
<span class="no">晨</span>
<h3>一杯手沖咖啡</h3>
<p>陶瓷內膽不與咖啡的酸質反應,香氣與層次完整保留。</p>
</div>
<div class="scene">
<span class="no">午</span>
<h3>冷泡茶與果汁</h3>
<p>寬口好加冰,保冷長效,下午茶時光清涼不打折。</p>
</div>
<div class="scene">
<span class="no">夜</span>
<h3>溫熱的晚安茶</h3>
<p>睡前一杯溫熱花草茶,陶瓷的溫潤口感讓人放鬆。</p>
</div>
</div>
</div>
</section>
<!-- CTA -->
<section class="closing">
<div class="reveal">
<p class="q">好內膽,<br>是好喝的<em>開始</em></p>
<p class="sub">CERAMIC LINER — MING</p>
<a class="cta" href="<?php echo esc_attr( ming_shop_url() ); ?>">逛逛陶瓷內膽杯</a>
</div>
</section>
<?php
get_footer();
+103
View File
@@ -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();
+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();
+18
View File
@@ -0,0 +1,18 @@
<?php
/**
* WooCommerce wrapper template — keeps shop pages inside the MING layout.
*
* @package MING
*/
get_header();
?>
<main class="section">
<div class="wrap">
<?php woocommerce_content(); ?>
</div>
</main>
<?php
get_footer();
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
archive="$repo_dir/dist/ming-theme.zip"
mkdir -p "$repo_dir/dist"
rm -f "$archive"
(
cd "$repo_dir"
zip -qr "$archive" ming-theme -x '*/.DS_Store'
)
echo "Created: $archive"