在我的 wordpress 网站中,我有一个包含 3 个部分的页面。每个部分都包含来自特定类别的帖子。我使用这个 wordpress 查询来获取该类别中的最新 3 个帖子并将其加载到它的部分(div)中。因此,对于“小说”部分,我使用以下查询:
<? $novels = get_option('of_novels') ?>
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts('category_name=$novels&posts_per_page=3'); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="sliderunit">
<?php the_post_thumbnail(); ?>
<div class="novelsslidertitle">
<div class="arrow-left"></div>
<a href="<?php the_permalink(); ?>"><img class="cross" src="<?php bloginfo('stylesheet_directory'); ?>/images/cross.png"/></a>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<h3>رواية</h3>
</div>
</div>
<?php endwhile;?>
这让我获得了#novels 类别中的最新 3 篇文章。现在,我有一些按钮。我想写一些 jequery 来循环这个类别并获取上一个和下一个帖子,并将新的查询内容重新加载到该#novels div,使用替换 html 中的旧查询代码
$("<div/>").replaceWith("// Replace with a function to get the code of new output");
在不使用分页和重新加载页面的情况下充当滑块?我希望我的问题得到很好的说明,我感谢任何有用的线索、链接或参考。