引导选项卡内部的Wordpress循环

引导选项卡内部的Wordpress循环,wordpress,twitter-bootstrap,loops,tabs,Wordpress,Twitter Bootstrap,Loops,Tabs,我正在尝试在选项卡组的选项卡一侧进行循环调用。选项卡来自引导,唯一的问题是当页面第一次加载时,循环没有加载,您必须单击选项卡来加载内容。有没有办法确保在页面加载时加载循环 在上下文中,这是一个图书馆网站,内容是列出的新书/音乐/电影,左对齐图片,右对齐标题/作者 这是我正在使用的代码 <div class="span4 pull-right"> <h2 style="font-weight:200;">New At The Library</h2>

我正在尝试在选项卡组的选项卡一侧进行循环调用。选项卡来自引导,唯一的问题是当页面第一次加载时,循环没有加载,您必须单击选项卡来加载内容。有没有办法确保在页面加载时加载循环

在上下文中,这是一个图书馆网站,内容是列出的新书/音乐/电影,左对齐图片,右对齐标题/作者

这是我正在使用的代码

 <div class="span4 pull-right">
    <h2 style="font-weight:200;">New At The Library</h2>
<ul class="nav nav-tabs" id="myTab">
  <li class="active"><a href="#books" data-toggle="tab"><h5 style="margin:0;"><i class="icon-book"></i>  New Books</h5></a></li>
  <li><a href="#cds" data-toggle="tab"><h5 style="margin:0;"><i class="icon-music"></i>  New Music</h5></a></li>
  <li><a href="#movies" data-toggle="tab"><h5 style="margin:0;"><i class="icon-film"></i>  New Films</h5></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane" id="books">
<?php query_posts( array ( 'category_name' => 'new-books', 'posts_per_page' => -3 ) ); ?>

<?php while ( have_posts() ) : the_post();?>
    <ul class="unstyled">
        <li class="clearfix">
            <?php echo get_the_post_thumbnail($page->ID, $arraySIZE = array('' => 120,80 ), array('class' => 'img-polaroid')); ?>
            &nbsp;
            <h4 class="pull-right" style="margin:0;"><?php the_content();?></h4>
        </li>
            <hr>
    </ul>
<?php endwhile; ?>

</div>


<div class="tab-pane" id="cds">
<?php query_posts( array ( 'category_name' => 'new-music', 'posts_per_page' => -3 ) ); ?>

<?php while ( have_posts() ) : the_post();?>
    <ul class="unstyled">
        <li class="clearfix">
            <?php echo get_the_post_thumbnail($page->ID, $arraySIZE = array('' => 80,80 ), array('class' => 'img-polaroid')); ?>
            &nbsp;
            <h4 class="pull-right" style="margin:0;"><?php the_content();?></h4>
        </li>
            <hr>
    </ul>
<?php endwhile; ?>

</div>
<div class="tab-pane" id="movies">

<?php query_posts( array ( 'category_name' => 'new-movies', 'posts_per_page' => -3 ) ); ?>

<?php while ( have_posts() ) : the_post();?>
    <ul class="unstyled">
        <li class="clearfix">
            <?php echo get_the_post_thumbnail($page->ID, $arraySIZE = array('' => 120,80 ), array('class' => 'img-polaroid')); ?>
            &nbsp;
            <h4 class="pull-right" style="margin:0;"><?php the_content();?></h4>
        </li>
            <hr>
    </ul>
<?php endwhile; ?>

</div>
</div>

图书馆的新图书馆




我认为您可能必须声明其中一个选项卡窗格处于活动状态。我在Bootstrap3构建中做同样的事情,并且能够以这种方式加载循环

只需将“活动”添加到第一个选项卡窗格div类,如下所示:

<div class="tab-pane active" id="books">


应该这样做。

欢迎来到SO!你能在你的问题中加入你的代码吗,这将使我们能够更好地帮助你?是的,就是这样。非常感谢你!