WooCommerce AI 可见度完整模板(2026 Pro)
把下面代码放入你主题的 functions.php 文件中即可。
<?php
/**
* WooCommerce 2026 Pro AI Visibility Template
* Full AI-readable + SEO + AEO/GEO optimized structure
*/// ——————————// 1. Product Entity
// ——————————
function wc_ai_product_entity(){
global $product;
if(!$product) return;
?>
<div class=”ai–product–entity” itemscope itemtype=”https://schema.org/Product“>
<meta itemprop=”name” content=”<?php echo esc_attr($product->get_name()); ?>”>
<meta itemprop=”sku” content=”<?php echo esc_attr($product->get_sku()); ?>”>
<meta itemprop=”url” content=”<?php echo get_permalink($product->get_id()); ?>”>
<meta itemprop=”description” content=”<?php echo esc_attr(wp_strip_all_tags($product->get_short_description())); ?>”>
</div>
<?php
}
// ——————————
// 2. Brand Entity
// ——————————
function wc_ai_brand_entity($brand){
if(empty($brand)) return;
?>
<div class=”ai–brand–entity” itemscope itemtype=”https://schema.org/Brand“>
<meta itemprop=”name” content=”<?php echo esc_attr($brand); ?>”>
</div>
<?php
}
// ——————————
// 3. Technology Tag Entities
// ——————————
function wc_ai_all_tag_entities(){
$tags = get_the_terms(get_the_ID(),‘product_tag’);
if(!$tags || is_wp_error($tags)) return;
echo ‘<div class=”ai-tech-tags”>’;
foreach($tags as $tag){
?>
<span itemscope itemtype=“https://schema.org/DefinedTerm”>
<meta itemprop=“additionalType” content=“ProductTechnology”>
<span itemprop=“name”><?php echo esc_html($tag->name); ?></span>
</span>
<?php
}
echo ‘</div>’;
}
// ——————————
// 4. Semantic Slot Block
// ——————————
function wc_ai_semantic_slot_block(){
global $product;
?>
<section class=”ai–semantic–slot” itemscope itemtype=”https://schema.org/DefinedTerm“>
<meta itemprop=”name” content=”<?php echo esc_attr($product->get_name()); ?>”>
<meta itemprop=”description” content=”Recommended for users seeking reliable performance, advanced functionality, and efficient daily use.”>
<p>Best suited for users looking for efficient cleaning performance, modern technology integration, and consistent daily usability.</p>
</section>
<?php
}
// ——————————
// 5. Answer Surface Expansion
// ——————————
function wc_ai_answer_surface(){
global $product;
$scenarios = [
“High-performance daily cleaning for busy professionals”,
“Smart cleaning for tech-savvy users”,
“Gentle care for sensitive teeth”,
“Affordable option for first-time buyers”,
“Advanced sonic technology for superior plaque removal”
];
echo ‘<div class=”ai-answer-surface” itemscope itemtype=”https://schema.org/ItemList”>’;
foreach($scenarios as $scenario){
?>
<div itemprop=“itemListElement” itemscope itemtype=“https://schema.org/DefinedTerm”>
<meta itemprop=“name” content=“<?php echo esc_attr($product->get_name()); ?>”>
<meta itemprop=“description” content=“<?php echo esc_attr($scenario); ?>”>
</div>
<?php
}
echo ‘</div>’;
}
// ——————————
// 6. Cross-Entity Block (Related Products)
// ——————————
function wc_ai_cross_entity_block(){
$related_products = wc_get_related_products(get_the_ID(), 3);
if(empty($related_products)) return;
echo ‘<section class=”ai-cross-entity” itemscope itemtype=”https://schema.org/ItemList”>’;
echo ‘<meta itemprop=”name” content=”Related Product Technologies”>’;
foreach($related_products as $product_id){
$product = wc_get_product($product_id);
if(!$product) continue;
?>
<div itemprop=“itemListElement” itemscope itemtype=“https://schema.org/Product”>
<meta itemprop=“name” content=“<?php echo esc_attr($product->get_name()); ?>”>
<link itemprop=“url” href=“<?php echo get_permalink($product_id); ?>”>
</div>
<?php
}
echo ‘</section>’;
}
// ——————————
// 7. FAQ Schema
// ——————————
function wc_ai_faq(){
?>
<div itemscope itemtype=“https://schema.org/FAQPage”>
<div itemscope itemprop=“mainEntity” itemtype=“https://schema.org/Question”>
<h3 itemprop=“name”>What makes this product different?</h3>
<div itemscope itemprop=“acceptedAnswer” itemtype=“https://schema.org/Answer”>
<p itemprop=“text”>It combines advanced engineering with optimized usability, making it suitable for both professional and everyday users.</p>
</div>
</div>
</div>
<?php
}
// ——————————
// 8. Hook all modules in proper order
// ——————————
add_action(‘woocommerce_single_product_summary’,‘wc_ai_product_entity’,5);
add_action(‘woocommerce_single_product_summary’,‘wc_ai_summary_block’,15);
add_action(‘woocommerce_single_product_summary’,‘wc_ai_brand_entity’,20);
add_action(‘woocommerce_single_product_summary’,‘wc_ai_all_tag_entities’,25);
add_action(‘woocommerce_single_product_summary’,‘wc_ai_semantic_slot_block’,30);
add_action(‘woocommerce_single_product_summary’,‘wc_ai_answer_surface’,35);
add_action(‘woocommerce_after_single_product_summary’,‘wc_ai_cross_entity_block’,15);
add_action(‘woocommerce_single_product_summary’,‘wc_ai_faq’,50);
// ——————————
// 9. Optional: Summary Block for AI
// ——————————
function wc_ai_summary_block(){
global $product;
?>
<section class=”ai–summary” itemscope itemtype=”https://schema.org/Product“>
<h2>Product Overview</h2>
<p itemprop=”description“>
<?php echo esc_html($product->get_name()); ?> is a high–performance product designed for professional and consumer applications. It integrates advanced technology, optimized usability, and reliable long–term performance.
</p>
</section>
<?php
}
✅ 使用说明
-
直接复制到
functions.php -
根据品牌名调整
wc_ai_brand_entity('Brand Name'); -
Answer Surface 可根据产品实际使用场景调整
-
页面 Hook 顺序已经按照 AI 优先认知顺序 排布
-
可结合前端 CSS 调整显示,或者完全隐藏,保证 AI 可抓取即可
? 效果
-
Product + Brand + Tags → AI 实体识别
-
Semantic Slot → 默认推荐位占据
-
Answer Surface → 多场景覆盖 → 指数级曝光
-
Cross-Entity → 多产品网络互联 → 强化认知
-
FAQ → 可直接引用答案 → 长尾问题覆盖
组合起来就是 生成式 AI 可见度最高的 WooCommerce 页面结构。