我已经获得了这个帖子模板,我正在尝试让帖子分页,我将如何实现这一目标?如果我以天真的方式询问这个/接近这个,我深表歉意。我试过遵循 WordPress 指南,但它们似乎与我所拥有的不符,我正在努力推断。希望这一切都有意义,非常感谢。<?php $the_query = new WP_Query( 'posts_per_page=5' ); ?><?php $postLoops = 0 ?><?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?><?php $postLoops++;if ($postLoops == 2) { echo '<div class="post-right-half">';}if ($postLoops == 1) { echo '<div class="post-left-half">';}?><div class="post-square"> <div class="post-thumbnail" style="background-image: url(<?php the_post_thumbnail_url(); ?>);"><br></div> <div class="content-half"> <h2 class="post-title"><?php the_title(); ?></h2> <p class="post-content"><?php the_excerpt(__('(more…)')); ?</p> <a class="read-more" href="<?php the_permalink() ?>">Read More <i class="fa fa-angle-right" aria-hidden="true"></i></a> </div></div><?phpif ($postLoops == 3) { echo '</div>';}if ($postLoops == 1) { echo '</div>';}?><?phpendwhile;wp_reset_postdata();?>
2 回答
- 2 回答
- 0 关注
- 141 浏览
添加回答
举报
0/150
提交
取消