2013-12-09 23 views
0

我正在尝试在选项卡组中选项卡的一侧进行循环调用。这些选项卡来自引导程序,唯一的一点是当页面首次加载时,循环不会,您必须单击选项卡才能加载内容。有什么方法可以确保循环在页面加载时加载吗?引导程序选项卡内的Wordpress循环

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

这是我正在使用的代码。

<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> 
+0

欢迎来到SO!你能否在你的问题中包含你的代码,这将使我们能够更好地帮助你? – Derek

回答

0

我想你可能必须声明其中一个选项卡窗格为活动状态。我在引导3构建这样做同样的事情,我能够加载循环这样...

,只需加上“积极”到第一个选项卡窗格的div类,像这样:

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

应该做的伎俩。

+0

是的。那就是它。非常感谢! –

相关问题