【发布时间】:2020-11-10 15:19:31
【问题描述】:
这是我的代码 -
<div class="gallery-posts">
<?php
$args = array(
'post_type' => 'post',
'order' => 'ASC',
'numberposts' => 4
);
$product_posts = get_posts( $args );
?>
<?php foreach ( $product_posts as $post ) : setup_postdata( $post ); ?>
<?php $videos = rwmb_meta( '_video-link' );
foreach ( $videos as $video ); ?>
<div
class="card-container video-link"
data-link="<?php echo $video['src']; ?>"
title="<?php the_title(); ?>"
description="<?php echo ( get_post_meta( get_the_ID(), '_description', true ) ); ?>"
thumbnail-link="<?php the_post_thumbnail_url() ?>">
<figure class="gallery-image">
<?php the_post_thumbnail(); ?>
<div class="gallery-image-text">
<p><?php the_title() ?></p>
<i class="fas fa-play"></i>
</div>
</figure>
</div>
<?php endforeach; wp_reset_postdata(); ?>
</div>
我想设置它,以便在帖子超过 4 个时显示 Next/Prev。
使用常规的 Word Press 循环,我知道您可以只执行 the_posts_pagination,但这在这里不起作用。
需要添加什么才能使分页与此循环一起使用?
【问题讨论】:
标签: php wordpress loops pagination