Compare commits
3
Commits
d9946a3da4
...
d7f545bd23
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7f545bd23 | ||
|
|
981ea44d5e | ||
|
|
5d60409903 |
@@ -1,5 +1,6 @@
|
|||||||
/* MING 明命 — 自托管字体(v1.5.6 起替代 Google Fonts 外链)
|
/* MING 明命 — 自托管字體(v1.5.6 起替代 Google Fonts 外鏈)
|
||||||
来源:google/fonts(OFL 授权),经子集化(Big5 常用字 + 全形标点)与字重实例化 */
|
繁體中文站點使用下列 TC 字型;其他站點語言由主題選用對應系統字型。
|
||||||
|
來源:google/fonts(OFL 授權),經子集化(Big5 常用字 + 全形標點)與字重實例化。 */
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Cormorant Garamond';
|
font-family: 'Cormorant Garamond';
|
||||||
|
|||||||
@@ -8,9 +8,10 @@
|
|||||||
--ink:#2B2B26;
|
--ink:#2B2B26;
|
||||||
--muted:#7A756A;
|
--muted:#7A756A;
|
||||||
--line:rgba(43,43,38,.16);
|
--line:rgba(43,43,38,.16);
|
||||||
--serif:'Noto Serif TC',serif;
|
/* WordPress 依站點語言於前台覆寫下列字型堆疊。 */
|
||||||
--latin:'Cormorant Garamond','Noto Serif TC',serif;
|
--serif:Georgia,'Times New Roman',serif;
|
||||||
--sans:'Noto Sans TC',sans-serif;
|
--latin:'Cormorant Garamond',Georgia,'Times New Roman',serif;
|
||||||
|
--sans:system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
|
||||||
}
|
}
|
||||||
*{margin:0;padding:0;box-sizing:border-box}
|
*{margin:0;padding:0;box-sizing:border-box}
|
||||||
html{scroll-behavior:smooth}
|
html{scroll-behavior:smooth}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 695 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 19 KiB |
@@ -39,7 +39,7 @@ $ming_mailto = $ming_email ? $ming_email : 'hello@ming.example';
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ( $ming_line ) : ?>
|
<?php if ( $ming_line ) : ?>
|
||||||
<a href="<?php echo esc_url( $ming_line ); ?>" target="_blank" rel="noopener" aria-label="LINE" title="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>
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="font-family:var(--sans)"><path d="M12 4C7 4 3 6.9 3 10.6c0 3.3 2.9 6 6.8 6.6.3.1.7.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" letter-spacing=".5">LINE</text></svg>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+120
-3
@@ -9,7 +9,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
define( 'MING_VERSION', '1.7.3' );
|
define( 'MING_VERSION', '1.7.4' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Theme setup.
|
* Theme setup.
|
||||||
@@ -52,6 +52,66 @@ function ming_setup() {
|
|||||||
}
|
}
|
||||||
add_action( 'after_setup_theme', 'ming_setup' );
|
add_action( 'after_setup_theme', 'ming_setup' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the site's WordPress locale in a form suitable for comparisons.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function ming_site_locale() {
|
||||||
|
return strtolower( str_replace( '-', '_', get_locale() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build font stacks for the language selected in WordPress settings.
|
||||||
|
*
|
||||||
|
* Self-hosted TC font files are used for Traditional Chinese. Other site
|
||||||
|
* languages use the appropriate platform font stack and do not request a
|
||||||
|
* Chinese Traditional web font.
|
||||||
|
*
|
||||||
|
* @return string CSS custom-property declarations.
|
||||||
|
*/
|
||||||
|
function ming_font_stack_css() {
|
||||||
|
$locale = ming_site_locale();
|
||||||
|
$fonts = array(
|
||||||
|
'sans' => "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
||||||
|
'serif' => "Georgia, 'Times New Roman', serif",
|
||||||
|
'latin' => "'Cormorant Garamond', Georgia, 'Times New Roman', serif",
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( preg_match( '/^zh_(?:hant(?:_|$)|tw(?:_|$)|hk(?:_|$)|mo(?:_|$))/', $locale ) ) {
|
||||||
|
$fonts = array(
|
||||||
|
'sans' => "'Noto Sans TC', 'Noto Sans CJK TC', 'PingFang TC', 'Microsoft JhengHei', 'Heiti TC', sans-serif",
|
||||||
|
'serif' => "'Noto Serif TC', 'Noto Serif CJK TC', 'Songti TC', 'PMingLiU', 'MingLiU', serif",
|
||||||
|
'latin' => "'Cormorant Garamond', 'Noto Serif TC', 'Noto Serif CJK TC', 'Songti TC', serif",
|
||||||
|
);
|
||||||
|
} elseif ( preg_match( '/^zh_/', $locale ) ) {
|
||||||
|
$fonts = array(
|
||||||
|
'sans' => "'Noto Sans SC', 'Noto Sans CJK SC', 'PingFang SC', 'Microsoft YaHei', 'Heiti SC', sans-serif",
|
||||||
|
'serif' => "'Noto Serif SC', 'Noto Serif CJK SC', 'Songti SC', SimSun, serif",
|
||||||
|
'latin' => "'Cormorant Garamond', 'Noto Serif SC', 'Noto Serif CJK SC', 'Songti SC', serif",
|
||||||
|
);
|
||||||
|
} elseif ( preg_match( '/^ja(?:_|$)/', $locale ) ) {
|
||||||
|
$fonts = array(
|
||||||
|
'sans' => "'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, sans-serif",
|
||||||
|
'serif' => "'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', serif",
|
||||||
|
'latin' => "'Cormorant Garamond', 'Noto Serif JP', 'Hiragino Mincho ProN', serif",
|
||||||
|
);
|
||||||
|
} elseif ( preg_match( '/^ko(?:_|$)/', $locale ) ) {
|
||||||
|
$fonts = array(
|
||||||
|
'sans' => "'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif",
|
||||||
|
'serif' => "'Noto Serif KR', AppleMyungjo, Batang, serif",
|
||||||
|
'latin' => "'Cormorant Garamond', 'Noto Serif KR', AppleMyungjo, serif",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprintf(
|
||||||
|
":root {\n\t--serif: %1\$s;\n\t--latin: %2\$s;\n\t--sans: %3\$s;\n}\n",
|
||||||
|
$fonts['serif'],
|
||||||
|
$fonts['latin'],
|
||||||
|
$fonts['sans']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueue assets.
|
* Enqueue assets.
|
||||||
*/
|
*/
|
||||||
@@ -65,6 +125,7 @@ function ming_assets() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
wp_enqueue_style( 'ming-main', get_template_directory_uri() . '/assets/css/main.css', array( 'ming-fonts' ), MING_VERSION );
|
wp_enqueue_style( 'ming-main', get_template_directory_uri() . '/assets/css/main.css', array( 'ming-fonts' ), MING_VERSION );
|
||||||
|
wp_add_inline_style( 'ming-main', ming_font_stack_css() );
|
||||||
wp_enqueue_script( 'ming-main', get_template_directory_uri() . '/assets/js/main.js', array(), MING_VERSION, true );
|
wp_enqueue_script( 'ming-main', get_template_directory_uri() . '/assets/js/main.js', array(), MING_VERSION, true );
|
||||||
|
|
||||||
// Pass image directory to JS (product grid).
|
// Pass image directory to JS (product grid).
|
||||||
@@ -91,7 +152,12 @@ add_action( 'wp_enqueue_scripts', 'ming_assets' );
|
|||||||
* Theme favicon.
|
* Theme favicon.
|
||||||
*/
|
*/
|
||||||
function ming_favicon() {
|
function ming_favicon() {
|
||||||
echo '<link rel="icon" type="image/png" href="' . esc_url( get_template_directory_uri() . '/assets/img/logo-mark.png' ) . '">' . "\n";
|
$asset_uri = get_template_directory_uri() . '/assets/img/';
|
||||||
|
|
||||||
|
echo '<link rel="icon" href="' . esc_url( $asset_uri . 'favicon.ico' ) . '" sizes="any">' . "\n";
|
||||||
|
echo '<link rel="icon" type="image/svg+xml" href="' . esc_url( $asset_uri . 'favicon.svg' ) . '">' . "\n";
|
||||||
|
echo '<link rel="icon" type="image/png" sizes="32x32" href="' . esc_url( $asset_uri . 'favicon-32.png' ) . '">' . "\n";
|
||||||
|
echo '<link rel="apple-touch-icon" sizes="180x180" href="' . esc_url( $asset_uri . 'apple-touch-icon.png' ) . '">' . "\n";
|
||||||
}
|
}
|
||||||
add_action( 'wp_head', 'ming_favicon' );
|
add_action( 'wp_head', 'ming_favicon' );
|
||||||
|
|
||||||
@@ -734,6 +800,57 @@ add_action( 'after_switch_theme', 'ming_seed_footer_content' );
|
|||||||
* ==========================================================*/
|
* ==========================================================*/
|
||||||
|
|
||||||
/* ---------- OG / Twitter 分享標籤 ---------- */
|
/* ---------- OG / Twitter 分享標籤 ---------- */
|
||||||
|
/**
|
||||||
|
* Return an Open Graph locale derived from the WordPress site language.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function ming_og_locale() {
|
||||||
|
$locale = ming_site_locale();
|
||||||
|
|
||||||
|
if ( 0 === strpos( $locale, 'zh_' ) ) {
|
||||||
|
if ( preg_match( '/(?:hk)/', $locale ) ) {
|
||||||
|
return 'zh_HK';
|
||||||
|
}
|
||||||
|
if ( preg_match( '/(?:mo)/', $locale ) ) {
|
||||||
|
return 'zh_MO';
|
||||||
|
}
|
||||||
|
|
||||||
|
return preg_match( '/(?:hant|tw)/', $locale ) ? 'zh_TW' : 'zh_CN';
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode( '_', $locale );
|
||||||
|
$language = isset( $parts[0] ) ? $parts[0] : 'en';
|
||||||
|
$region = '';
|
||||||
|
foreach ( array_reverse( $parts ) as $part ) {
|
||||||
|
if ( 2 === strlen( $part ) && ctype_alpha( $part ) ) {
|
||||||
|
$region = strtoupper( $part );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $region ) {
|
||||||
|
return $language . '_' . $region;
|
||||||
|
}
|
||||||
|
|
||||||
|
$default_regions = array(
|
||||||
|
'ar' => 'SA',
|
||||||
|
'de' => 'DE',
|
||||||
|
'en' => 'US',
|
||||||
|
'es' => 'ES',
|
||||||
|
'fr' => 'FR',
|
||||||
|
'it' => 'IT',
|
||||||
|
'ja' => 'JP',
|
||||||
|
'ko' => 'KR',
|
||||||
|
'nl' => 'NL',
|
||||||
|
'pl' => 'PL',
|
||||||
|
'pt' => 'BR',
|
||||||
|
'ru' => 'RU',
|
||||||
|
);
|
||||||
|
|
||||||
|
return isset( $default_regions[ $language ] ) ? $language . '_' . $default_regions[ $language ] : 'en_US';
|
||||||
|
}
|
||||||
|
|
||||||
add_action( 'wp_head', 'ming_og_tags', 5 );
|
add_action( 'wp_head', 'ming_og_tags', 5 );
|
||||||
function ming_og_tags() {
|
function ming_og_tags() {
|
||||||
if ( is_admin() || ( function_exists( 'is_embed' ) && is_embed() ) ) { return; }
|
if ( is_admin() || ( function_exists( 'is_embed' ) && is_embed() ) ) { return; }
|
||||||
@@ -779,7 +896,7 @@ function ming_og_tags() {
|
|||||||
echo '<meta property="og:description" content="' . esc_attr( $desc ) . '">' . "\n";
|
echo '<meta property="og:description" content="' . esc_attr( $desc ) . '">' . "\n";
|
||||||
echo '<meta property="og:url" content="' . esc_url( $url ) . '">' . "\n";
|
echo '<meta property="og:url" content="' . esc_url( $url ) . '">' . "\n";
|
||||||
echo '<meta property="og:type" content="' . esc_attr( $type ) . '">' . "\n";
|
echo '<meta property="og:type" content="' . esc_attr( $type ) . '">' . "\n";
|
||||||
echo '<meta property="og:locale" content="zh_TW">' . "\n";
|
echo '<meta property="og:locale" content="' . esc_attr( ming_og_locale() ) . '">' . "\n";
|
||||||
if ( $image ) {
|
if ( $image ) {
|
||||||
echo '<meta property="og:image" content="' . esc_url( $image ) . '">' . "\n";
|
echo '<meta property="og:image" content="' . esc_url( $image ) . '">' . "\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Theme URI: https://ming.example
|
|||||||
Author: MING 明命
|
Author: MING 明命
|
||||||
Author URI: https://ming.example
|
Author URI: https://ming.example
|
||||||
Description: MING 明命品牌官網主題 —— 陶瓷內膽杯 · 明亮生命 自然連結。單頁式品牌首頁,支援 WooCommerce 商城、會員中心、購物車角標、社群連結與公司資訊自訂。
|
Description: MING 明命品牌官網主題 —— 陶瓷內膽杯 · 明亮生命 自然連結。單頁式品牌首頁,支援 WooCommerce 商城、會員中心、購物車角標、社群連結與公司資訊自訂。
|
||||||
Version: 1.7.3
|
Version: 1.7.4
|
||||||
Requires at least: 6.0
|
Requires at least: 6.0
|
||||||
Tested up to: 6.7
|
Tested up to: 6.7
|
||||||
Requires PHP: 7.4
|
Requires PHP: 7.4
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ get_header();
|
|||||||
<h3>太陽與光</h3><p>光明溫暖,<br>希望明亮。</p>
|
<h3>太陽與光</h3><p>光明溫暖,<br>希望明亮。</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="symbol">
|
<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>
|
<svg viewBox="0 0 64 64" style="font-family:var(--serif)"><circle cx="32" cy="32" r="22"/><text x="32" y="28" text-anchor="middle" font-size="15" fill="var(--green)" stroke="none">明</text><text x="32" y="48" text-anchor="middle" font-size="15" fill="var(--green)" stroke="none">命</text></svg>
|
||||||
<h3>明・命</h3><p>生命因光而明,<br>萬物因自然而生。</p>
|
<h3>明・命</h3><p>生命因光而明,<br>萬物因自然而生。</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user