2013-05-31 1 views
0

나는 나의 테마 2 개 사이드를 만들기 위해 functions.php를 사용 :워드 프레스 Sidebar.php는 조건문

register_sidebar(array(
    'id'   => 'main_sidebar', 
    'name'  => 'Main Sidebar', 
    'description' => 'Used on most pages', 
)); 
register_sidebar(array(
    'id'   => 'blog_sidebar', 
    'name'  => 'Blog Sidebar', 
    'description' => 'Used on blog pages only', 
)); 

그리고 난에 블로그 사이드로드 할 수있는 (내가 무슨 생각) 간단한 조건문이 블로그 및 기타 주요 사이드 바 :

<?php 
    if (is_page(37)) { 

     dynamic_sidebar('blog_sidebar'); 

     } else { 

     dynamic_sidebar('main_sidebar'); 

     } 
    ?> 

그러나 메인 페이지는 표시되지만 블로그 사이드 바는 표시되지 않으므로? page_id = 37. 나는 명백한 것을 놓치고 있는가? 이 같은

답변

0

시도 뭔가 : 그것은 나를 위해 작동

<?php if(is_page('page-name')) { ?> 
Do Something 
    <?php } else { ?> 
Do Something else or nothing 
    <?php } ?> 

...