你好,我正在尝试为页面和帖子使用两个不同的侧边栏。
为此,我使用了以下条件来测试它是否为页面(如果是,则调用"sidebar-15"
,否则调用"blog"
)。
<?php
if (is_page()){
dynamic_sidebar( 'sidebar-15' );
}
else {
get_sidebar( 'blog' );
}
?>
但是,在页面上它仍然调用blog side bar
。我做错了什么吗?
get_sidebar function
<?php get_sidebar( $name_of_sidebar_file ); ?>
例如:文件:sidebar-right.php和sidebar-left.php要求:
get_sidebar('right');
get_sidebar('left');