Files
car-t-t/inc/setup.php
T
zhs123 2a64ce8daa feat: initial commit - 汽车贴膜门店 WordPress 主题 (B2B Trade v2.0.0)
- WordPress classic theme for car tinting/foil shop
- 13 homepage template parts
- Customizer panel with 13 sections
- RFQ inquiry form handler
- Bootstrap 5.3 + AOS + Colorbox frontend
- 13 SVG placeholder images
- Chinese content defaults
2026-07-24 13:52:59 +08:00

66 lines
3.4 KiB
PHP

<?php
/**
* Theme setup and frontend assets.
*
* @package Fragrance_Trade
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/** Register theme features and menus. */
function fragrance_trade_setup() {
load_theme_textdomain( 'fragrance-trade', get_template_directory() . '/languages' );
add_theme_support( 'title-tag' );
add_theme_support( 'custom-logo', array( 'height' => 96, 'width' => 260, 'flex-height' => true, 'flex-width' => true ) );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'style', 'script' ) );
add_image_size( 'fragrance-capability', 760, 720, true );
register_nav_menus(
array(
'primary' => __( '主导航', 'fragrance-trade' ),
)
);
}
add_action( 'after_setup_theme', 'fragrance_trade_setup' );
/**
* Return a cache-busting version for a local theme asset.
*
* @param string $relative_path Path relative to the theme root.
* @param string $fallback Version used when the file cannot be read.
* @return string
*/
function fragrance_trade_asset_version( $relative_path, $fallback ) {
$file = get_theme_file_path( '/' . ltrim( $relative_path, '/' ) );
return file_exists( $file ) ? (string) filemtime( $file ) : $fallback;
}
/** Load theme styles and scripts through the WordPress dependency system. */
function fragrance_trade_enqueue_assets() {
$version = wp_get_theme()->get( 'Version' );
wp_enqueue_style( 'fragrance-bootstrap', 'https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.0-alpha3/css/bootstrap.min.css', array(), '5.3.0-alpha3' );
wp_enqueue_style( 'fragrance-fonts', 'https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@200;300;400;500;600;700&family=Jost:wght@200;300;400;500&family=Noto+Sans+SC:wght@300;400;500;700&display=swap', array(), null );
wp_enqueue_style( 'fragrance-normalize', get_template_directory_uri() . '/assets/css/normalize.css', array(), fragrance_trade_asset_version( 'assets/css/normalize.css', $version ) );
wp_enqueue_style( 'fragrance-vendor', get_template_directory_uri() . '/assets/css/vendor.css', array(), fragrance_trade_asset_version( 'assets/css/vendor.css', $version ) );
wp_enqueue_style( 'fragrance-base', get_stylesheet_uri(), array( 'fragrance-bootstrap', 'fragrance-vendor' ), fragrance_trade_asset_version( 'style.css', $version ) );
wp_enqueue_style( 'fragrance-theme', get_template_directory_uri() . '/assets/css/theme.css', array( 'fragrance-base' ), fragrance_trade_asset_version( 'assets/css/theme.css', $version ) );
wp_enqueue_script( 'fragrance-bootstrap', 'https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.0-alpha3/js/bootstrap.bundle.min.js', array(), '5.3.0-alpha3', true );
wp_enqueue_script( 'fragrance-plugins', get_template_directory_uri() . '/assets/js/plugins.js', array( 'jquery' ), fragrance_trade_asset_version( 'assets/js/plugins.js', $version ), true );
wp_enqueue_script( 'fragrance-theme', get_template_directory_uri() . '/assets/js/theme.js', array( 'jquery', 'fragrance-bootstrap', 'fragrance-plugins' ), fragrance_trade_asset_version( 'assets/js/theme.js', $version ), true );
wp_localize_script(
'fragrance-theme',
'fragranceTrade',
array(
'motionQuery' => '(prefers-reduced-motion: reduce)',
)
);
}
add_action( 'wp_enqueue_scripts', 'fragrance_trade_enqueue_assets' );