0
我正在构建基于TwentyTwelve(儿童主题)的网站,并使用woocommerce。 在我的商店页面(也是网站的FrontPage)我想删除侧边栏。仅在店铺/首页上删除woocommerce侧边栏
我想出了这个代码:
if(is_front_page()){
remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar', 10);
add_action('woocommerce_before_main_content', 'twentytwelve_child_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'twentytwelve_child_wrapper_end', 10);
function twentytwelve_child_wrapper_start() {
echo '<div id="shop">';
}
function twentytwelve_child_wrapper_end() {
echo '</div>';
}
}
它的工作原理,但对所有佑页面(除车和结帐页)它消除了侧边栏 ,它应该是在店/头版(和SearchResult所对于这个问题)
底线:我不能得到我的条件声明的权利。请帮忙。 因为我是一个新手,请保持简单。提前致谢。
你需要用相关的替换frontpage&sidebar类。 – 2014-12-03 12:17:07
感谢您的回复。除非我做错了,否则这个解决方案不起作用。 WP/Woo为店面注入与单个产品页面相同的ID和div。如果我做错了什么...请咨询。 – A3O 2014-12-03 13:46:13
您是否有链接到您的网站? WordPress的通常增加一个类的主页名为“家” – 2014-12-03 13:52:56