<?php /** * 宠物纪念品网站 - WordPress主题 * Pet Memorial Website - WordPress Theme * * @package EternalPaws * @version 1.0.0 */ if (!defined('ABSPATH')) exit; // === 主题设置 === function eternal_paws_setup() { // 主题支持 add_theme_support('title-tag'); add_theme_support('post-thumbnails'); add_theme_support('custom-logo'); add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption')); add_theme_support('responsive-embeds'); // 导航菜单 register_nav_menus(array( 'primary' => __('Primary Menu', 'eternal-paws'), 'footer' => __('Footer Menu', 'eternal-paws'), )); // 缩略图尺寸 add_image_size('memorial-card', 600, 400, true); add_image_size('testimonial-avatar', 100, 100, true); add_image_size('hero-bg', 1920, 1080, true); } add_action('after_setup_theme', 'eternal_paws_setup'); // === 加载样式和脚本 === function eternal_paws_scripts() { $theme_version = wp_get_theme()->get('Version'); // Google Fonts wp_enqueue_style('google-fonts', 'https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Lato:wght@300;400;500;600;700&display=swap', array(), null); // 配置文件 wp_enqueue_script('site-config', get_template_directory_uri() . '/config.js', array(), $theme_version, false); // 主样式 wp_enqueue_style('main-style', get_template_directory_uri() . '/css/style.css', array(), $theme_version); // 动画效果样式 wp_enqueue_style('animations-style', get_template_directory_uri() . '/css/animations.css', array('main-style'), $theme_version); // 主脚本 wp_enqueue_script('main-script', get_template_directory_uri() . '/js/main.js', array('site-config'), $theme_version, true); // 动画效果脚本 wp_enqueue_script('animations-script', get_template_directory_uri() . '/js/animations.js', array(), $theme_version, true); } add_action('wp_enqueue_scripts', 'eternal_paws_scripts'); // === 自定义设置面板 === function eternal_paws_customize_register($wp_customize) { // --- 基本信息 --- $wp_customize->add_section('paws_site_info', array( 'title' => __('Site Information', 'eternal-paws'), 'priority' => 30, )); $wp_customize->add_setting('site_tagline', array( 'default' => 'Forever in Our Hearts', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('site_tagline', array( 'label' => __('Site Tagline', 'eternal-paws'), 'section' => 'paws_site_info', 'type' => 'text', )); // --- 社交媒体 --- $wp_customize->add_section('paws_social', array( 'title' => __('Social Media Links', 'eternal-paws'), 'priority' => 35, )); $social_platforms = array( 'facebook' => 'Facebook URL', 'instagram' => 'Instagram URL', 'tiktok' => 'TikTok URL', 'whatsapp' => 'WhatsApp URL', 'twitter' => 'Twitter/X URL', 'pinterest' => 'Pinterest URL', 'youtube' => 'YouTube URL', ); foreach ($social_platforms as $key => $label) { $wp_customize->add_setting("social_{$key}", array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control("social_{$key}", array( 'label' => __($label, 'eternal-paws'), 'section' => 'paws_social', 'type' => 'url', )); } // --- Hero区域 --- $wp_customize->add_section('paws_hero', array( 'title' => __('Hero Section', 'eternal-paws'), 'priority' => 40, )); $wp_customize->add_setting('hero_title', array( 'default' => 'Forever in Our Hearts', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('hero_title', array( 'label' => __('Hero Title', 'eternal-paws'), 'section' => 'paws_hero', 'type' => 'text', )); $wp_customize->add_setting('hero_subtitle', array( 'default' => 'Custom Pet Memorial Gifts', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('hero_subtitle', array( 'label' => __('Hero Subtitle', 'eternal-paws'), 'section' => 'paws_hero', 'type' => 'text', )); $wp_customize->add_setting('hero_description', array( 'default' => '', 'sanitize_callback' => 'sanitize_textarea_field', )); $wp_customize->add_control('hero_description', array( 'label' => __('Hero Description', 'eternal-paws'), 'section' => 'paws_hero', 'type' => 'textarea', )); $wp_customize->add_setting('hero_background', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'hero_background', array( 'label' => __('Hero Background Image', 'eternal-paws'), 'section' => 'paws_hero', ))); $wp_customize->add_setting('hero_cta_text', array( 'default' => 'Create Your Memorial', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('hero_cta_text', array( 'label' => __('Primary CTA Button Text', 'eternal-paws'), 'section' => 'paws_hero', 'type' => 'text', )); // Hero Buttons (新增) $wp_customize->add_setting('hero_cta_link', array( 'default' => '#memorials', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control('hero_cta_link', array( 'label' => __('Primary CTA Button Link', 'eternal-paws'), 'section' => 'paws_hero', 'type' => 'url', )); $wp_customize->add_setting('hero_secondary_btn_text', array( 'default' => 'Our Story', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('hero_secondary_btn_text', array( 'label' => __('Secondary Button Text', 'eternal-paws'), 'section' => 'paws_hero', 'type' => 'text', )); $wp_customize->add_setting('hero_secondary_btn_link', array( 'default' => '#about', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control('hero_secondary_btn_link', array( 'label' => __('Secondary Button Link', 'eternal-paws'), 'section' => 'paws_hero', 'type' => 'url', )); // --- 关于我们 --- $wp_customize->add_section('paws_about', array( 'title' => __('About Section', 'eternal-paws'), 'priority' => 45, )); $wp_customize->add_setting('about_title', array( 'default' => 'Our Story', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('about_title', array( 'label' => __('About Title', 'eternal-paws'), 'section' => 'paws_about', 'type' => 'text', )); $wp_customize->add_setting('about_content', array( 'default' => '', 'sanitize_callback' => 'sanitize_textarea_field', )); $wp_customize->add_control('about_content', array( 'label' => __('About Content (one paragraph per line)', 'eternal-paws'), 'section' => 'paws_about', 'type' => 'textarea', )); $wp_customize->add_setting('about_image', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'about_image', array( 'label' => __('About Image', 'eternal-paws'), 'section' => 'paws_about', ))); // About Signature (新增) $wp_customize->add_setting('about_signature', array( 'default' => 'With love, The PetWood Keepsake Team', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('about_signature', array( 'label' => __('Signature Text', 'eternal-paws'), 'section' => 'paws_about', 'type' => 'text', )); // --- Memorials Section (新增) --- $wp_customize->add_section('paws_memorials_section', array( 'title' => __('Memorials Section', 'eternal-paws'), 'priority' => 47, )); $wp_customize->add_setting('memorials_title', array( 'default' => 'Our Memorial Collection', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('memorials_title', array( 'label' => __('Section Title', 'eternal-paws'), 'section' => 'paws_memorials_section', 'type' => 'text', )); $wp_customize->add_setting('memorials_subtitle', array( 'default' => 'Handcrafted with Love', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('memorials_subtitle', array( 'label' => __('Section Subtitle', 'eternal-paws'), 'section' => 'paws_memorials_section', 'type' => 'text', )); // --- Process Section (新增) --- $wp_customize->add_section('paws_process', array( 'title' => __('Process Section', 'eternal-paws'), 'priority' => 48, )); $wp_customize->add_setting('process_title', array( 'default' => 'How It Works', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('process_title', array( 'label' => __('Section Title', 'eternal-paws'), 'section' => 'paws_process', 'type' => 'text', )); $wp_customize->add_setting('process_subtitle', array( 'default' => 'Simple & Heartfelt', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('process_subtitle', array( 'label' => __('Section Subtitle', 'eternal-paws'), 'section' => 'paws_process', 'type' => 'text', )); $wp_customize->add_setting('process_steps_json', array( 'default' => wp_json_encode(array( array('number' => '01', 'title' => 'Share Your Story', 'description' => 'Tell us about your beloved pet. Share photos, stories, and what made them special.'), array('number' => '02', 'title' => 'Choose Your Memorial', 'description' => 'Select from our collection of memorial options or work with us on a custom design.'), array('number' => '03', 'title' => 'We Craft with Care', 'description' => 'Our artisans create your memorial piece with attention to every detail.'), array('number' => '04', 'title' => 'Delivered with Love', 'description' => 'Your finished memorial is carefully packaged and delivered to your door.'), ), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), 'sanitize_callback' => 'sanitize_textarea_field', )); $wp_customize->add_control('process_steps_json', array( 'label' => __('Process Steps (JSON)', 'eternal-paws'), 'description' => __('Accepts JSON format. Array of objects with "number", "title", "description" fields.', 'eternal-paws'), 'section' => 'paws_process', 'type' => 'textarea', )); // --- Testimonials Section (新增) --- $wp_customize->add_section('paws_testimonials', array( 'title' => __('Testimonials Section', 'eternal-paws'), 'priority' => 49, )); $wp_customize->add_setting('testimonials_title', array( 'default' => 'Stories from Our Family', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('testimonials_title', array( 'label' => __('Section Title', 'eternal-paws'), 'section' => 'paws_testimonials', 'type' => 'text', )); $wp_customize->add_setting('testimonials_subtitle', array( 'default' => 'Words from Pet Parents Like You', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('testimonials_subtitle', array( 'label' => __('Section Subtitle', 'eternal-paws'), 'section' => 'paws_testimonials', 'type' => 'text', )); // --- 联系信息 --- $wp_customize->add_section('paws_contact_info', array( 'title' => __('Contact Information', 'eternal-paws'), 'priority' => 55, )); $wp_customize->add_setting('contact_email', array( 'default' => 'hello@pawsandmemories.com', 'sanitize_callback' => 'sanitize_email', )); $wp_customize->add_control('contact_email', array( 'label' => __('Email', 'eternal-paws'), 'section' => 'paws_contact_info', 'type' => 'email', )); $wp_customize->add_setting('contact_phone', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('contact_phone', array( 'label' => __('Phone', 'eternal-paws'), 'section' => 'paws_contact_info', 'type' => 'text', )); $wp_customize->add_setting('contact_address', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('contact_address', array( 'label' => __('Address', 'eternal-paws'), 'section' => 'paws_contact_info', 'type' => 'text', )); // Contact Section Settings (新增) $wp_customize->add_setting('contact_title', array( 'default' => 'Create Your Memorial', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('contact_title', array( 'label' => __('Contact Section Title', 'eternal-paws'), 'section' => 'paws_contact_info', 'type' => 'text', )); $wp_customize->add_setting('contact_subtitle', array( 'default' => "Let's Honor Your Beloved Pet Together", 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('contact_subtitle', array( 'label' => __('Contact Section Subtitle', 'eternal-paws'), 'section' => 'paws_contact_info', 'type' => 'text', )); $wp_customize->add_setting('contact_submit_text', array( 'default' => 'Send Request', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('contact_submit_text', array( 'label' => __('Form Submit Button Text', 'eternal-paws'), 'section' => 'paws_contact_info', 'type' => 'text', )); // --- Stray Care Section (新增) --- $wp_customize->add_section('paws_stray_care', array( 'title' => __('Stray Care Section', 'eternal-paws'), 'priority' => 56, )); $wp_customize->add_setting('stray_title', array( 'default' => 'Paws in Need', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('stray_title', array( 'label' => __('Section Title', 'eternal-paws'), 'section' => 'paws_stray_care', 'type' => 'text', )); $wp_customize->add_setting('stray_subtitle', array( 'default' => 'Helping Stray Cats & Dogs', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('stray_subtitle', array( 'label' => __('Section Subtitle', 'eternal-paws'), 'section' => 'paws_stray_care', 'type' => 'text', )); $wp_customize->add_setting('stray_intro', array( 'default' => 'While we celebrate the memories of our beloved companions, we also believe in helping those who still need homes. For every memorial purchased, we donate to local animal shelters.', 'sanitize_callback' => 'sanitize_textarea_field', )); $wp_customize->add_control('stray_intro', array( 'label' => __('Intro Paragraph', 'eternal-paws'), 'section' => 'paws_stray_care', 'type' => 'textarea', )); $wp_customize->add_setting('stray_image', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'stray_image', array( 'label' => __('Section Image', 'eternal-paws'), 'section' => 'paws_stray_care', ))); $wp_customize->add_setting('stray_stats_json', array( 'default' => wp_json_encode(array( array('number' => '500+', 'label' => 'Pets Helped'), array('number' => '15', 'label' => 'Shelter Partners'), array('number' => '$10,000+', 'label' => 'Donated This Year'), array('number' => '200+', 'label' => 'Pets Adopted'), ), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), 'sanitize_callback' => 'sanitize_textarea_field', )); $wp_customize->add_control('stray_stats_json', array( 'label' => __('Statistics (JSON)', 'eternal-paws'), 'description' => __('Accepts JSON format. Array of objects with "number" and "label" fields.', 'eternal-paws'), 'section' => 'paws_stray_care', 'type' => 'textarea', )); $wp_customize->add_setting('stray_help_json', array( 'default' => wp_json_encode(array( array('icon' => '🏠', 'title' => 'Adopt, Don\'t Shop', 'description' => 'Consider adopting from a shelter.'), array('icon' => '🎁', 'title' => 'Donate Supplies', 'description' => 'Food, blankets, toys—shelters always need donations.'), array('icon' => '🤝', 'title' => 'Volunteer', 'description' => 'Give your time to walk dogs, socialize cats.'), array('icon' => '📢', 'title' => 'Spread the Word', 'description' => 'Share adoptable pets on social media.'), ), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), 'sanitize_callback' => 'sanitize_textarea_field', )); $wp_customize->add_control('stray_help_json', array( 'label' => __('How to Help Items (JSON)', 'eternal-paws'), 'description' => __('Accepts JSON format. Array of objects with "icon", "title", "description" fields.', 'eternal-paws'), 'section' => 'paws_stray_care', 'type' => 'textarea', )); $wp_customize->add_setting('stray_donate_text', array( 'default' => 'Donate Now', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('stray_donate_text', array( 'label' => __('Donate Button Text', 'eternal-paws'), 'section' => 'paws_stray_care', 'type' => 'text', )); $wp_customize->add_setting('stray_donate_link', array( 'default' => '#contact', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control('stray_donate_link', array( 'label' => __('Donate Button Link', 'eternal-paws'), 'section' => 'paws_stray_care', 'type' => 'url', )); $wp_customize->add_setting('stray_adopt_text', array( 'default' => 'Adopt Today', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('stray_adopt_text', array( 'label' => __('Adopt Button Text', 'eternal-paws'), 'section' => 'paws_stray_care', 'type' => 'text', )); $wp_customize->add_setting('stray_adopt_link', array( 'default' => '#contact', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control('stray_adopt_link', array( 'label' => __('Adopt Button Link', 'eternal-paws'), 'section' => 'paws_stray_care', 'type' => 'url', )); // --- Footer Section (新增) --- $wp_customize->add_section('paws_footer', array( 'title' => __('Footer', 'eternal-paws'), 'priority' => 60, )); $wp_customize->add_setting('footer_copyright', array( 'default' => '&copy; ' . date('Y') . ' PetWood Keepsake. All rights reserved.', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('footer_copyright', array( 'label' => __('Copyright Text (HTML allowed)', 'eternal-paws'), 'section' => 'paws_footer', 'type' => 'text', )); $wp_customize->add_setting('footer_description', array( 'default' => '', 'sanitize_callback' => 'sanitize_textarea_field', )); $wp_customize->add_control('footer_description', array( 'label' => __('Footer Brand Description', 'eternal-paws'), 'description' => __('Leave empty to use default site tagline.', 'eternal-paws'), 'section' => 'paws_footer', 'type' => 'textarea', )); $wp_customize->add_setting('footer_newsletter_title', array( 'default' => 'Stay Connected', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('footer_newsletter_title', array( 'label' => __('Newsletter Title', 'eternal-paws'), 'section' => 'paws_footer', 'type' => 'text', )); $wp_customize->add_setting('footer_newsletter_desc', array( 'default' => 'Join our community of pet lovers. Get updates on new memorial designs and stray animal care initiatives.', 'sanitize_callback' => 'sanitize_textarea_field', )); $wp_customize->add_control('footer_newsletter_desc', array( 'label' => __('Newsletter Description', 'eternal-paws'), 'section' => 'paws_footer', 'type' => 'textarea', )); $wp_customize->add_setting('footer_links_json', array( 'default' => wp_json_encode(array( array('title' => 'Home', 'link' => '#home'), array('title' => 'About Us', 'link' => '#about'), array('title' => 'Memorials', 'link' => '#memorials'), array('title' => 'Stray Care', 'link' => '#stray-care'), array('title' => 'Contact', 'link' => '#contact'), ), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), 'sanitize_callback' => 'sanitize_textarea_field', )); $wp_customize->add_control('footer_links_json', array( 'label' => __('Quick Links (JSON)', 'eternal-paws'), 'description' => __('Accepts JSON format. Array of objects with "title" and "link" fields.', 'eternal-paws'), 'section' => 'paws_footer', 'type' => 'textarea', )); } add_action('customize_register', 'eternal_paws_customize_register'); // === 覆盖config.js中的设置(来自WordPress自定义器) === function eternal_paws_inline_config() { $config_overrides = array(); // 社交媒体 $social_keys = array('facebook', 'instagram', 'tiktok', 'whatsapp', 'twitter', 'pinterest', 'youtube'); foreach ($social_keys as $key) { $val = get_theme_mod("social_{$key}", ''); if (!empty($val)) { $config_overrides['social'][$key] = esc_url($val); } } // Hero $hero_title = get_theme_mod('hero_title', ''); if (!empty($hero_title)) $config_overrides['hero']['title'] = esc_html($hero_title); $hero_subtitle = get_theme_mod('hero_subtitle', ''); if (!empty($hero_subtitle)) $config_overrides['hero']['subtitle'] = esc_html($hero_subtitle); $hero_desc = get_theme_mod('hero_description', ''); if (!empty($hero_desc)) $config_overrides['hero']['description'] = esc_html($hero_desc); $hero_bg = get_theme_mod('hero_background', ''); if (!empty($hero_bg)) $config_overrides['hero']['background_image'] = esc_url($hero_bg); $hero_cta = get_theme_mod('hero_cta_text', ''); if (!empty($hero_cta)) $config_overrides['hero']['cta_button'] = esc_html($hero_cta); // Hero Buttons $hero_cta_link = get_theme_mod('hero_cta_link', ''); if (!empty($hero_cta_link)) $config_overrides['hero']['cta_link'] = esc_url($hero_cta_link); $hero_secondary_text = get_theme_mod('hero_secondary_btn_text', ''); if (!empty($hero_secondary_text)) $config_overrides['hero']['secondary_btn_text'] = esc_html($hero_secondary_text); $hero_secondary_link = get_theme_mod('hero_secondary_btn_link', ''); if (!empty($hero_secondary_link)) $config_overrides['hero']['secondary_btn_link'] = esc_url($hero_secondary_link); // 关于 $about_title = get_theme_mod('about_title', ''); if (!empty($about_title)) $config_overrides['about']['title'] = esc_html($about_title); $about_content = get_theme_mod('about_content', ''); if (!empty($about_content)) { $paragraphs = array_filter(array_map('trim', explode("\n", $about_content))); $config_overrides['about']['content'] = array_map('esc_html', $paragraphs); } $about_image = get_theme_mod('about_image', ''); if (!empty($about_image)) $config_overrides['about']['image'] = esc_url($about_image); $about_signature = get_theme_mod('about_signature', ''); if (!empty($about_signature)) $config_overrides['about']['signature'] = esc_html($about_signature); // Memorials $memorials_title = get_theme_mod('memorials_title', ''); if (!empty($memorials_title)) $config_overrides['memorials']['title'] = esc_html($memorials_title); $memorials_subtitle = get_theme_mod('memorials_subtitle', ''); if (!empty($memorials_subtitle)) $config_overrides['memorials']['subtitle'] = esc_html($memorials_subtitle); // Process $process_title = get_theme_mod('process_title', ''); if (!empty($process_title)) $config_overrides['process']['title'] = esc_html($process_title); $process_subtitle = get_theme_mod('process_subtitle', ''); if (!empty($process_subtitle)) $config_overrides['process']['subtitle'] = esc_html($process_subtitle); $process_steps_json = get_theme_mod('process_steps_json', ''); if (!empty($process_steps_json)) { $steps = json_decode($process_steps_json, true); if (is_array($steps)) $config_overrides['process']['steps'] = $steps; } // Testimonials $testimonials_title = get_theme_mod('testimonials_title', ''); if (!empty($testimonials_title)) $config_overrides['testimonials']['title'] = esc_html($testimonials_title); $testimonials_subtitle = get_theme_mod('testimonials_subtitle', ''); if (!empty($testimonials_subtitle)) $config_overrides['testimonials']['subtitle'] = esc_html($testimonials_subtitle); // Stray Care $stray_title = get_theme_mod('stray_title', ''); if (!empty($stray_title)) $config_overrides['stray_care']['title'] = esc_html($stray_title); $stray_subtitle = get_theme_mod('stray_subtitle', ''); if (!empty($stray_subtitle)) $config_overrides['stray_care']['subtitle'] = esc_html($stray_subtitle); $stray_intro = get_theme_mod('stray_intro', ''); if (!empty($stray_intro)) $config_overrides['stray_care']['intro'] = esc_html($stray_intro); $stray_image = get_theme_mod('stray_image', ''); if (!empty($stray_image)) $config_overrides['stray_care']['image'] = esc_url($stray_image); $stray_stats_json = get_theme_mod('stray_stats_json', ''); if (!empty($stray_stats_json)) { $stats = json_decode($stray_stats_json, true); if (is_array($stats)) $config_overrides['stray_care']['stats'] = $stats; } $stray_help_json = get_theme_mod('stray_help_json', ''); if (!empty($stray_help_json)) { $help = json_decode($stray_help_json, true); if (is_array($help)) $config_overrides['stray_care']['help'] = $help; } $stray_donate_text = get_theme_mod('stray_donate_text', ''); if (!empty($stray_donate_text)) $config_overrides['stray_care']['donate_text'] = esc_html($stray_donate_text); $stray_donate_link = get_theme_mod('stray_donate_link', ''); if (!empty($stray_donate_link)) $config_overrides['stray_care']['donate_link'] = esc_url($stray_donate_link); $stray_adopt_text = get_theme_mod('stray_adopt_text', ''); if (!empty($stray_adopt_text)) $config_overrides['stray_care']['adopt_text'] = esc_html($stray_adopt_text); $stray_adopt_link = get_theme_mod('stray_adopt_link', ''); if (!empty($stray_adopt_link)) $config_overrides['stray_care']['adopt_link'] = esc_url($stray_adopt_link); // Contact $contact_title = get_theme_mod('contact_title', ''); if (!empty($contact_title)) $config_overrides['contact']['title'] = esc_html($contact_title); $contact_subtitle = get_theme_mod('contact_subtitle', ''); if (!empty($contact_subtitle)) $config_overrides['contact']['subtitle'] = esc_html($contact_subtitle); $contact_submit_text = get_theme_mod('contact_submit_text', ''); if (!empty($contact_submit_text)) $config_overrides['contact']['submit_text'] = esc_html($contact_submit_text); // 联系信息 $email = get_theme_mod('contact_email', ''); if (!empty($email)) $config_overrides['site']['email'] = sanitize_email($email); $phone = get_theme_mod('contact_phone', ''); if (!empty($phone)) $config_overrides['site']['phone'] = esc_html($phone); $address = get_theme_mod('contact_address', ''); if (!empty($address)) $config_overrides['site']['address'] = esc_html($address); // Footer $footer_copyright = get_theme_mod('footer_copyright', ''); if (!empty($footer_copyright)) $config_overrides['footer']['copyright'] = $footer_copyright; $footer_desc = get_theme_mod('footer_description', ''); if (!empty($footer_desc)) $config_overrides['footer']['description'] = esc_html($footer_desc); $footer_newsletter_title = get_theme_mod('footer_newsletter_title', ''); if (!empty($footer_newsletter_title)) $config_overrides['footer']['newsletter_title'] = esc_html($footer_newsletter_title); $footer_newsletter_desc = get_theme_mod('footer_newsletter_desc', ''); if (!empty($footer_newsletter_desc)) $config_overrides['footer']['newsletter_desc'] = esc_html($footer_newsletter_desc); $footer_links_json = get_theme_mod('footer_links_json', ''); if (!empty($footer_links_json)) { $links = json_decode($footer_links_json, true); if (is_array($links)) $config_overrides['footer']['quick_links'] = $links; } if (!empty($config_overrides)) { echo '<script>Object.assign(SITE_CONFIG, ' . wp_json_encode($config_overrides) . ');</script>'; } } add_action('wp_head', 'eternal_paws_inline_config', 100); // === Widget区域 === function eternal_paws_widgets() { register_sidebar(array( 'name' => __('Footer Widget Area', 'eternal-paws'), 'id' => 'footer-widgets', 'before_widget' => '<div class="footer-widget">', 'after_widget' => '</div>', 'before_title' => '<h4 class="footer-title">', 'after_title' => '</h4>', )); } add_action('widgets_init', 'eternal_paws_widgets'); // === 自定义Walker(可选) === class Paws_Memories_Nav_Walker extends Walker_Nav_Menu { function start_el(&$output, $item, $depth = 0, $args = null, $id = 0) { $output .= '<li class="nav-item"><a href="' . esc_url($item->url) . '" class="nav-link">' . esc_html($item->title) . '</a></li>'; } } // ============================================ // === WooCommerce 支持 / WooCommerce Support === // ============================================ // 添加 WooCommerce 支持 function eternal_paws_woocommerce_support() { add_theme_support('woocommerce', array( 'thumbnail_image_width' => 400, 'single_image_width' => 600, 'product_grid' => array( 'default_rows' => 3, 'min_rows' => 1, 'max_rows' => 8, 'default_columns' => 3, 'min_columns' => 1, 'max_columns' => 4, ), )); add_theme_support('wc-product-gallery-zoom'); add_theme_support('wc-product-gallery-lightbox'); add_theme_support('wc-product-gallery-slider'); } add_action('after_setup_theme', 'eternal_paws_woocommerce_support'); // 加载 WooCommerce 样式 function eternal_paws_woocommerce_scripts() { $theme_version = wp_get_theme()->get('Version'); wp_enqueue_style('paws-woocommerce-style', get_template_directory_uri() . '/css/woocommerce.css', array(), $theme_version); } add_action('wp_enqueue_scripts', 'eternal_paws_woocommerce_scripts'); // WooCommerce 内容宽度 function eternal_paws_woocommerce_wrapper_before() { echo '<div class="wc-wrapper">'; } add_action('woocommerce_before_main_content', 'eternal_paws_woocommerce_wrapper_before', 5); function eternal_paws_woocommerce_wrapper_after() { echo '</div>'; } add_action('woocommerce_after_main_content', 'eternal_paws_woocommerce_wrapper_after', 5); // 移除 WooCommerce 默认侧边栏 remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar'); // 购物车片段刷新(AJAX 更新购物车数量) add_filter('woocommerce_add_to_cart_fragments', 'eternal_paws_cart_count_fragment'); function eternal_paws_cart_count_fragment($fragments) { ob_start(); $count = WC()->cart->get_cart_contents_count(); echo '<span class="cart-count">' . esc_html($count) . '</span>'; $fragments['span.cart-count'] = ob_get_clean(); return $fragments; } // WooCommerce 自定义器设置 function eternal_paws_woo_customize($wp_customize) { // --- 商店页面 --- $wp_customize->add_section('paws_shop', array( 'title' => __('Shop Settings', 'eternal-paws'), 'priority' => 50, )); $wp_customize->add_setting('shop_hero_title', array( 'default' => 'Our Memorial Collection', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('shop_hero_title', array( 'label' => __('Shop Hero Title', 'eternal-paws'), 'section' => 'paws_shop', 'type' => 'text', )); $wp_customize->add_setting('shop_hero_subtitle', array( 'default' => 'Handcrafted with Love', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('shop_hero_subtitle', array( 'label' => __('Shop Hero Subtitle', 'eternal-paws'), 'section' => 'paws_shop', 'type' => 'text', )); $wp_customize->add_setting('shop_hero_bg', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'shop_hero_bg', array( 'label' => __('Shop Hero Background', 'eternal-paws'), 'section' => 'paws_shop', ))); $wp_customize->add_setting('shop_notice', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('shop_notice', array( 'label' => __('Shop Notice (top banner)', 'eternal-paws'), 'description' => __('Leave empty to hide', 'eternal-paws'), 'section' => 'paws_shop', 'type' => 'text', )); } add_action('customize_register', 'eternal_paws_woo_customize');
Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/pet.petwoodkeepsake.com/wp-content/themes/app_data_所有对话_主对话_EternalPaws主题_eternal-paws-v12/functions.php:1) in /www/wwwroot/pet.petwoodkeepsake.com/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/abstract-xml.php on line 66

Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/pet.petwoodkeepsake.com/wp-content/themes/app_data_所有对话_主对话_EternalPaws主题_eternal-paws-v12/functions.php:1) in /www/wwwroot/pet.petwoodkeepsake.com/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/abstract-xml.php on line 69

Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/pet.petwoodkeepsake.com/wp-content/themes/app_data_所有对话_主对话_EternalPaws主题_eternal-paws-v12/functions.php:1) in /www/wwwroot/pet.petwoodkeepsake.com/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/abstract-xml.php on line 69

Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/pet.petwoodkeepsake.com/wp-content/themes/app_data_所有对话_主对话_EternalPaws主题_eternal-paws-v12/functions.php:1) in /www/wwwroot/pet.petwoodkeepsake.com/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/abstract-xml.php on line 69

Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/pet.petwoodkeepsake.com/wp-content/themes/app_data_所有对话_主对话_EternalPaws主题_eternal-paws-v12/functions.php:1) in /www/wwwroot/pet.petwoodkeepsake.com/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/abstract-xml.php on line 69

Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/pet.petwoodkeepsake.com/wp-content/themes/app_data_所有对话_主对话_EternalPaws主题_eternal-paws-v12/functions.php:1) in /www/wwwroot/pet.petwoodkeepsake.com/wp-content/plugins/seo-by-rank-math/includes/modules/sitemap/abstract-xml.php on line 69
https://pet.petwoodkeepsake.com/post-sitemap.xml 2026-07-15T14:35:41+00:00 https://pet.petwoodkeepsake.com/page-sitemap.xml 2026-07-21T06:14:47+00:00 https://pet.petwoodkeepsake.com/product-sitemap.xml 2026-07-21T10:13:40+00:00 https://pet.petwoodkeepsake.com/category-sitemap.xml 2026-07-15T14:35:41+00:00