2014-10-22 169 views
0

如何从页面中排除边栏?我在外观页面上放置了一些页面id - > widget - > pages - > left sidebar。但是这些网页仍然存在于侧栏中,而不是。如何从页面中排除边栏?

Link to site

这里的左侧边栏的代码

<?php 
global $post, $accesspress_ray_options; 
$accesspress_ray_settings = get_option('accesspress_ray_options', $accesspress_ray_options); 
if(is_front_page()){ 
$post_id = get_option('page_on_front'); 
}else{ 
$post_id = $post->ID; 
} 
$post_class = get_post_meta($post_id, 'accesspress_ray_sidebar_layout', true); 

if($post_class=='left-sidebar' || $post_class=='both-sidebar'){ 
?> 
<div id="secondary-left" class="widget-area left-sidebar sidebar"> 
    <?php if (is_active_sidebar('left-sidebar')) : ?> 
     <?php dynamic_sidebar('left-sidebar'); ?> 
    <?php endif; ?> 
</div><!-- #secondary --> 
<?php } ?> 
+0

appearance> widget> pages> sidebar不是Wordpress中的默认选项,表示它是由您的主题提供的。你使用什么主题? – Ohgodwhy 2014-10-22 05:39:10

+0

我使用的是accesspress ray @Ohgodwhy – User014019 2014-10-22 05:50:58

+0

通过函数名判断:http://accesspressthemes.com/accesspress-ray/ – rnevius 2014-10-22 05:50:59

回答

0

正确的方法,在此将创建自定义的页面模板。这样你就可以拥有带侧边栏和不带侧边栏的页面模板。

Read more about it here

您可以完全复制你的page.php文件和定义以下吧。

<?php 
/* 
Template Name: No Sidebar Page Template 
*/ 

并确保你没有get_sidebar()在新模板。