我正在尝试显示自定义小部件,但没有成功。
功能。php
// Footer Widget options
function footer_widgets() {
register_sidebar( array(
\'name\' => \'Footer Options "Kontakt" \',
\'id\' => \'footer_options\',
\'before_widget\' => \'<div>\',
\'after_widget\' => \'</div>\',
\'before_title\' => \'<h2 class="rounded">\',
\'after_title\' => \'</h2>\',
) );
}
add_action( \'widgets_init\', \'footer_widgets\' );
在仪表板内部,我用文本填充了它,现在我想在页脚中显示:我尝试过此解决方案,但无法显示:
<div class="widgets"> <?php if ( is_active_sidebar( \'footer_widgets\' ) ) : ?> <ul id="sidebar"> <?php dynamic_sidebar( \'footer_widgets\' ); ?> </ul> <?php endif; ?> </div>
<div class="widgets"> <?php dynamic_sidebar( \'footer_widgets\' ); ?> </div>
<div class="widgets"> <?php the_widget(\'footer_widgets\'); ?> </div>