这是我的职责:
function ec_register_sidebars() {
register_sidebars( 3,
array(
\'name\' => \'Sidebar %d\',
\'id\' => "sidebar-$i",
\'before_widget\' => \'<li id="%1$s" class="widget %2$s">\',
\'after_widget\' => \'</li>\',
\'before_title\' => \'\',
\'after_title\' => \'\'
)
);
这个does not work:<?php if ( is_active_sidebar( \'Sidebar 1\' ) ) : ?>
<?php dynamic_sidebar( \'Sidebar 1\' ); ?>
<?php else : ?>
No primary sidebar content
<?php endif; ?>
BUT 如果我将*is\\u active\\u侧边栏*更改为“侧边栏2”或“侧边栏3”,它会起作用。例如this works:<?php if ( is_active_sidebar( \'Sidebar 2\' ) ) : ?>
<?php dynamic_sidebar( \'Sidebar 1\' ); ?>
<?php else : ?>
No primary sidebar content
<?php endif; ?>
我不明白为什么会这样。有什么想法吗?