admin管理员组文章数量:1122846
I am new to WordPress. I would am currently using the Twenty Seventeen Theme. I would like to add multiple Footer Widgets, however WordPress is limiting me to only two. Is it possible to add a few more footer widgets? If so how to do I do that? I have spent two days searching the internet for an answer to avail.
I would prefer PHP or CSS file modification answers.
Thank you in advance...
I am new to WordPress. I would am currently using the Twenty Seventeen Theme. I would like to add multiple Footer Widgets, however WordPress is limiting me to only two. Is it possible to add a few more footer widgets? If so how to do I do that? I have spent two days searching the internet for an answer to avail.
I would prefer PHP or CSS file modification answers.
Thank you in advance...
Share Improve this question edited Jul 17, 2020 at 18:16 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Jul 17, 2020 at 17:14 DeveloperDeveloper 112 bronze badges1 Answer
Reset to default 0Footer 1 and Footer 2 are sidebars you can add your own sidebar in functions.php
or create a child theme :
function twentyseventeen_widgets_init() {
register_sidebar( array(
'name' => __( 'Blog Sidebar', 'twentyseventeen' ),
'id' => 'sidebar-1',
'description' => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'twentyseventeen' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
register_sidebar( array(
'name' => __( 'Footer 1', 'twentyseventeen' ),
'id' => 'sidebar-2',
'description' => __( 'Add widgets here to appear in your footer.', 'twentyseventeen' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
register_sidebar( array(
'name' => __( 'Footer 2', 'twentyseventeen' ),
'id' => 'sidebar-3',
'description' => __( 'Add widgets here to appear in your footer.', 'twentyseventeen' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'twentyseventeen_widgets_init' );
you can add as many widgets as you want by drag and drop widgets.
The template that displays in twentyseventeen/template-parts/footer/footer-widgets.php
<?php
if ( is_active_sidebar( 'sidebar-2' ) ||
is_active_sidebar( 'sidebar-3' ) ) :
?>
<aside class="widget-area" role="complementary" aria-label="<?php esc_attr_e( 'Footer', 'twentyseventeen' ); ?>">
<?php
if ( is_active_sidebar( 'sidebar-2' ) ) { ?>
<div class="widget-column footer-widget-1">
<?php dynamic_sidebar( 'sidebar-2' ); ?>
</div>
<?php }
if ( is_active_sidebar( 'sidebar-3' ) ) { ?>
<div class="widget-column footer-widget-2">
<?php dynamic_sidebar( 'sidebar-3' ); ?>
</div>
<?php } ?>
</aside><!-- .widget-area -->
<?php endif; ?>
本文标签: How to add multiple footer widgets
版权声明:本文标题:How to add multiple footer widgets? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736295029a1929483.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论