【发布时间】:2016-10-10 09:57:06
【问题描述】:
我对 Wordpress 很陌生。我目前正在使用 FoundationPress 主题,并且正在尝试添加一个按钮,用户可以单击该按钮来加载更多帖子。
我想要的是,最初用户会看到四篇博客文章,当用户点击阅读更多按钮时,它将加载接下来的四篇文章,直到没有更多文章并且按钮消失。
我已经可以加载前四个帖子,但我很难设置一个按钮来显示接下来的四个帖子。
这是我目前所拥有的:
<section class="row blogArticleWrapper">
<?php while ( have_posts() ) : the_post(); ?>
<?php
the_post();
$blog_posts = get_posts( array(
'post_type' => 'blog',
'posts_per_page' => 4,
'offset' => 1,
'orderby' => 'date',
'order' => 'DESC'
) );
if ( $blog_posts ):
?>
<?php
foreach ( $blog_posts as $post ):
setup_postdata($post);
?>
<article class="blog-profile small-12 columns">
<a href="<?php the_field("news_url"); ?>" title="<?php the_title(); ?>"><span class="name"><?php the_field("news_title"); ?></span></a>
<p class="writtenBy">Written by: <?php the_field("news_written_by"); ?> <span class="date">Date: <?php the_field("news_date"); ?></span></p>
</article><!-- /.profile -->
<?php endforeach;
?>
<?php endif; ?>
<?php endwhile; // end of the loop. ?>
</section><!-- /.row -->
我尝试关注这个guide,但我不知道如何在我的页面上使用它。
感谢您的帮助,
谢谢。
【问题讨论】: