我已经尝试了一些在互联网上找到的过程。其中一些,我无法理解,其中一些正在单个容器上创建一个列。我实际看到的是将“图像 1”转换为上图中所示的“图像 2”。
样式.css
#container {
float: left;
margin: 0 -240px 0 0;
width: 100%;
}
#content {
margin: 0 280px 0 20px;
}
#primary,
#secondary {
float: right;
overflow: hidden;
width: 220px;
}
#secondary {
clear: right;
}
#footer {
clear: both;
width: 100%;
}
函数.php
function tnc_widgets_init() {register_sidebar( array(
'name' => __( 'Fourth Widget Area', 'twentyten' ),
'id' => 'fourth-widget-area',
'description' => __( 'An optional secondary widget area, ', 'twentyten' ),
'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
'after_widget' => '</li>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
}
add_action( 'widgets_init', 'tnc_widgets_init' );
sidebar.php
<div id="" class="widget-area" role="complementary">
<ul class="xoxo">
<?php dynamic_sidebar( 'fourth-widget-area' ); ?>
</ul>
</div>
我想要的是显示新的小部件区域,即使没有要显示的内容也让它显示并将其扩展到底部(到列的相同高度)。 谢谢。
最佳答案
sidebar.php 文件中没有设置 id ....此外,在使用页 footer 分清除两者时,您不需要单独清除任何 div ....希望有意义
关于php - 如何通过在上下文末尾创建一个空容器来扩展侧边栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36907928/