您必须注册多个区域:
function new_sidebar_widget_init() {
register_sidebar( array(
\'name\' => \'new-sidebar\',
\'id\' => \'new-sidebar\',
\'before_widget\' => \'<div id="new-sidebar">\',
\'after_widget\' => \'</div>\',
\'before_title\' => \'\',
\'after_title\' => \'\',
) );
register_sidebar( array(
\'name\' => \'new-sidebar-1\',
\'id\' => \'new-sidebar-1\',
\'before_widget\' => \'<div id="new-sidebar">\',
\'after_widget\' => \'</div>\',
\'before_title\' => \'\',
\'after_title\' => \'\',
) );
}
add_action( \'widgets_init\', \'new_sidebar_widget_init\' );
然后您可以根据其ID使用它们:
<?php dynamic_sidebar( \'new-sidebar\' ); ?>
<?php dynamic_sidebar( \'new-sidebar-1\' ); ?>