[英]how to integrate bootstrap template to wordpress
如何将引导程序底部集成到wordpress主题中。 当我使用小部件时,它无法正确显示,因为它具有一些未包含在小部件中的样式。 我的意思是我实现了这样的功能,但显示不正确。 下面是静态html。
<section id="bottom">
<div class="container wow fadeInDown" data-wow-duration="1000ms" data-wow-delay="600ms">
<div class="row">
<div class="col-md-3 col-sm-6">
<div class="widget">
<h3>Company</h3>
<ul>
<li><a href="#">About us</a></li>
<li><a href="#">We are hiring</a></li>
<li><a href="#">Meet the team</a></li>
<li><a href="#">Copyright</a></li>
<li><a href="#">Terms of use</a></li>
<li><a href="#">Privacy policy</a></li>
<li><a href="#">Contact us</a></li>
</ul>
</div>
</div><!--/.col-md-3-->
</div>
</div>
</section><!--/#bottom-->
这是在function.php中
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'bottom',
'before_widget' => '<h3>',
'after_widget' => '</h3>',
'before_title' => '<ul>',
'after_title' => '</ul>',
));
?>
终于在我的页面里面了
<?php
<section id="bottom">
<div class="container wow fadeInDown" data-wow-duration="1000ms" data-wow-delay="600ms">
<div class="row">
<div class="col-md-3 col-sm-6">
<div class="widget">
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('bottom')) : ?><?php endif; ?>
</div>
</div><!--/.col-md-3-->
</div>
</div>
</section><!--/#bottom-->
?>
好吧,让我们看看这是如何工作的:
要在WordPress上注册新的边栏,建议为该边栏添加一个ID。
如果未设置id参数值,则将从4.2版开始以调试模式获取E_USER_NOTICE消息。
有关此链接的更多详细信息: 功能参考/注册侧边栏 。
同时,我们将使用该ID来调用我们已注册的侧边栏。 这里我举一个例子。
// Register Sidebars
function custom_sidebars() {
$args = array(
'id' => 'bottom',
'name' => __( 'Bottom Sidebar', 'text_domain' ),
'description' => __( 'My bottom sidebar', 'text_domain' ),
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
);
register_sidebar( $args );
}
add_action( 'widgets_init', 'custom_sidebars' );
通常插入活动主题的functions.php
文件中。 如果需要,可以使用主题设计自定义标题并列出HTML标签。
然后,当我们要调用它时,在您的情况下,我认为该文件是footer.php
,我们最好在if语句中进行操作,如下所示:
<?php if ( is_active_sidebar( 'bottom' ) ) : ?>
<div id="secondary" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'bottom' ); ?>
</div><!-- #secondary -->
<?php endif; ?>
在您的模板中,它应类似于:
<section id="bottom">
<div class="container wow fadeInDown" data-wow-duration="1000ms" data-wow-delay="600ms">
<div class="row">
<div class="col-md-3 col-sm-6">
<?php if ( is_active_sidebar( 'bottom' ) ) : ?>
<div class="widget">
<?php dynamic_sidebar( 'bottom' ); ?>
</div>
<?php endif; ?>
</div><!--/.col-md-3-->
</div>
</div>
</section><!--/#bottom-->
我们可以通过ID或名称或什至号码来调用边栏进行检查。
希望这可以帮助您了解并解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.