【发布时间】:2017-04-24 01:05:33
【问题描述】:
所以我需要在 Woocommerce 的每个产品页面中添加一个简码 [stag_sidebar id='product']。特别是简短的描述。这是我尝试过的,但这不起作用:
add_filter( 'woocommerce_short_description', 'custom_woocommerce_short_description' );
function custom_woocommerce_short_description( $description ) {
global $post;
$description = $description . do_shortcode('[stag_sidebar id='product']') ;
return $description;
}
【问题讨论】:
-
它不起作用是什么意思?问题是什么?会发生什么?
-
页面刚被冻结。白屏。我注意到当我将这样的简码: [testshortcode] 放入函数中时,页面正在正常加载。
-
你得到一个白屏,因为你有一个 php 错误,我在下面回答。 :)
标签: php wordpress woocommerce hook-woocommerce