2014-10-22 167 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()在新模板。