因此,我需要在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;
}
你是什么意思,它不起作用?什么是问题?怎么了? – sticksu
Page刚刚被冻结。白色的屏幕。我注意到,当我把这样的短代码:[testshortcode]放入函数,然后页面正常加载。 –
因为你有一个php错误,我得到了一个白色的屏幕,我在下面回答。 :) – sticksu