外觀
佈景主題架構
子主題檔案組織、各檔案功能與覆寫的父主題模板。
主題資訊
| 啟用主題 | ctkpro-childtheme |
| 父主題 | sober |
| 子主題 | 是 |
| 作者 | ctkpro |
| 版本 | 1.0.0 |
| 檔案數 | 29(PHP 2 / CSS 3 / JS 2) |
目錄結構
ctkpro-childtheme/
├── functions.php
├── style.css
├── style.min.css
├── css/
│ └── theme-update.css
├── js/
│ ├── main.js
│ └── main.min.js
└── template-parts/
└── header-v4.php檔案審查
functions.php功能擴充
子主題核心:載入父主題、註冊 CSS/JS、body class、客製化設定遷移、WooCommerce 訂單列表超取偵測、超商付款自動完成訂單
| 行數 | 功能 | 用途 |
|---|---|---|
| 3-8 | ctkpro_theme_enqueue_styles | 載入父主題 functions.php |
| 11-24 | ctkpro_enqueue_styles_scripts | 載入子主題 CSS 和 JS |
| 27-34 | add_slug_body_class | body 加上 post slug class,供 CSS 定位 |
| 37-43 | ctkpro_reset_theme_mods | 切換子主題時複製父主題的客製化設定 |
| 46-62 | ctkpro_customize_register | 在 Customizer 中載入父主題設定 |
| 65-108 | add_wc_order_list_shipping_column / display_wc_order_list_shipping_column_content | WooCommerce 訂單列表加「運送方式」欄,超商取貨顯示紅字「超取需出貨」 |
| 111-141 | ctk_store_complete | 超商付款完成後自動將訂單狀態改為 completed |
template-parts/header-v4.php覆寫父主題
覆寫父主題 header-v4 模板,在右側 icon 區加入購物金點數顯示
| 行數 | 功能 | 用途 |
|---|---|---|
| 36-44 | — | 用 shortcode [rs_my_reward_points] 取得購物金,解析後顯示在 header |
js/main.js功能擴充
前台 jQuery:移除圖片 title、免運自動切換、預購/團購隱藏超商取貨
| 行數 | 功能 | 用途 |
|---|---|---|
| 2 | — | 移除所有圖片 title 屬性(SEO 清理) |
| 4-38 | hideRedundantShipping | 結帳頁面有免運選項時自動隱藏付費運送選項 |
| 41-83 | setupGiftBox | 購物車有預購/團購商品時隱藏超商取貨選項 |
css/theme-update.css樣式覆寫
全站樣式覆寫:登入彈窗、header 購物金、結帳頁面佈局、優惠券區塊、購物金兌換區塊、RWD
