创建一个新页面并在其中添加以下简码[product_page id="123"]
(用有效产品ID替换123)根据需要添加额外内容,然后将页面添加到菜单中。
但是,我仍然会得到基本相同的内容(可在.../shop/product下访问)的单个产品帖子,我该如何避免这种情况?
在我与有关重定向店基地的一些代码,提供您的其他线程,则需要修改它也包括了单品页,这里的更新版本:
add_action('template_redirect', 'redirect_shop');
function redirect_Shop() {
// added is_product() conditional to stop users from accessing the single product page
if(is_shop() || is_product()) {
//replace the link below to point to your custom product page
header('HTTP/1.1 301 Moved Permanently');
header('location:http://www.example.com/page');
exit;
}
}
谢谢你的sooo多!这太棒了!这也将避免重复的内容,对不对? –
是的,它会避免重复的内容,这对SEO很有用。 –
刚刚更新了我的答案,并作出了重定向301永久移动之一,这也将有助于SEO –