我遇到与wordpress页脚小部件相关的问题。我在我的二十三个主题中创建了2个自定义侧边栏,并在所有侧边栏中添加了2-2个小部件以在页脚中显示。但是我的所有小部件都没有逐一出现,它向左走。 请帮帮我。
这里是foote和widget部分的图像: https://lh3.googleusercontent.com/-4RKEDGwsARo/WZajbTJ60BI/AAAAAAAAAsw/VTNLuIVGHwcPr5TC0qQtp6Ctp05BiZUpQCL0BGAYYCw/h1080/2017-08-18.png
这是我的代码:
Function.php
function twentythirteen_widgets_init() {
register_sidebar( array(
'name' => __( 'Main Widget Area', 'twentythirteen' ),
'id' => 'sidebar-1',
'description' => __( 'Appears in the footer section of the site.',
'twentythirteen' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Secondary Widget Area', 'twentythirteen' ),
'id' => 'sidebar-2',
'description' => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Footer 1', 'twentythirteen' ),
'id' => 'sidebar-3',
'description' => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => __( 'Footer 2', 'twentythirteen' ),
'id' => 'sidebar-4',
'description' => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'twentythirteen_widgets_init' );
边栏-主
if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<div id="secondary" class="animated fadeInUp sidebar-container" role="complementary">
<div class="widget-area">
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-6 sidebar-1">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div>
<div class="col-md-3 col-sm-6 sidebar-2">
<?php dynamic_sidebar( 'sidebar-2' ); ?>
</div>
<div class="col-md-3 col-sm-6 sidebar-3">
<?php dynamic_sidebar( 'sidebar-3' ); ?>
</div>
<div class="col-md-3 col-sm-6 sidebar-4">
<?php dynamic_sidebar( 'sidebar-4' ); ?>
</div>
</div>
</div>
</div><!-- .widget-area -->
</div><!-- #secondary -->
页脚
<div class="site-info ">
<div class="container copyright">
<div class="row">
<div class="col-md-6">
<p class="pull-left">© 2017 SHOP</p>
</div>
<div class="col-md-6">
<?php do_action( 'twentythirteen_credits' ); ?>
<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'twentythirteen' ) ); ?>" class="pull-right"><?php printf( __( 'Proudly powered by %s', 'twentythirteen' ), 'WordPress' ); ?></a>
</div>
</div>
</div>
</div><!-- .site-info -->
</footer><!-- #colophon -->