0
这是我的选项卡菜单,在这里用户可以选择选项卡加载WordPress的帖子点击锚
<div id="slider-menu" class="row">
<div class="span12">
<ul class="nav nav-tabs" id="myTab">
<li class="active"><a href="#home">Latest events</a><div class="triangle"></div></li>
<li><a href="#profile">Our champions</a></li>
<li><a href="#messages">We have puppies!</a></li>
</ul>
</div>
</div>
而且有我的标签,其中内容被加载时,页面加载
<div class="tab-content">
<div class="tab-pane active" id="home">
<img src="<?php bloginfo('template_url'); ?>/img/slider.png" />
<div class="span12">
<?php
query_posts('cat=7');
if (have_posts()) : while (have_posts()) : the_post(); ?>
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title=""><?php the_title(); ?></a></h3>
<?php the_content(); ?>
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
</div>
</div>
<div class="tab-pane" id="profile">
<img src="<?php bloginfo('template_url'); ?>/img/slider.png" />
<div class="span12">
<?php
query_posts('cat=8');
if (have_posts()) : while (have_posts()) : the_post(); ?>
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title=""><?php the_title(); ?></a></h3>
<?php the_content(); ?>
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
</div>
</div>
<div class="tab-pane" id="messages">
<img src="<?php bloginfo('template_url'); ?>/img/slider.png" />
<div class="span12">
<?php
query_posts('cat=9');
if (have_posts()) : while (have_posts()) : the_post(); ?>
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title=""><?php the_title(); ?></a></h3>
<?php the_content(); ?>
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
</div>
</div>
</div>
当会有很多帖子,它会将页面加载太久,所以我的基本想法是在页面加载时将所有帖子加载到第一个标签,并在用户选择它时将帖子加载到另一个标签。
我很努力如何结合wp文章循环和ajax加载帖子时,用户点击特定标签。
非常感谢您的帮助。
[如果这有帮助](http://stackoverflow.com/questions/16127557/loading-database-content-via-xmlhttprequest-in-wordpress/16128067#16128067)。 –