Wordpress 使用无限滚动+;随机顺序

Wordpress 使用无限滚动+;随机顺序,wordpress,infinite-scroll,Wordpress,Infinite Scroll,我使用带有无限滚动的wp_查询在特定的cpt归档页面中显示帖子。当我将“orderby”设置为“date”时,一切正常,但当我将其更改为“rand”时,查询将返回正确数量的帖子,但其中一些帖子是重复的 这是我正在使用的代码: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $loopb = new WP_Query( array( 'post_type' => 'my_post_type',

我使用带有无限滚动的wp_查询在特定的cpt归档页面中显示帖子。当我将“orderby”设置为“date”时,一切正常,但当我将其更改为“rand”时,查询将返回正确数量的帖子,但其中一些帖子是重复的

这是我正在使用的代码:

<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$loopb = new WP_Query( array( 'post_type' => 'my_post_type', 'posts_per_page' => 10, 'paged' => $paged, 'order' => 'rand' ) ); 
$value = get_field('thumbnail_sizing');
 ?>
<?php while ( $loopb->have_posts() ) : $loopb->the_post(); 

    $thumb_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'small-size' );

$full_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full-size' );
$thumb_img_ratio = 70; 
if (isset($thumb_img[1]) && isset($thumb_img[2]) && $thumb_img[1] > 0) {
    $thumb_img_ratio = $thumb_img[2] * 100/$thumb_img[1];
} ?>


<div class="mosaic">
    <a href="#" class="grayscale">
        <div class="mosaic__image" style="padding-top: <?php echo $thumb_img_ratio;?>%;">
            <img src="<?php echo $thumb_img[0]; ?>" data-src="<?php echo $full_img[0]; ?>" alt="<?php the_title();?>">
        </div>

        <div class="meta">
            <div class="flex">
                <div class="flex_item">
                    <h2 class="meta_title"><?php the_field('name1');?> <span class="divider">&amp;</span> <?php the_field('name2');?></h2>
                    <hr class="separator">
                    <span class="cat">view image</span> 
                </div>
            </div>
        </div>

    </a>
</div>


<?php endwhile; ?>


随身携带一个随机种子,我不知道
WP\u Query
是否支持它,但它将是
random(seed)
(例如
random(1234)
)在straight
mysql
中,不幸的是我不知道怎么做:)。我确实发现这与随机性有关,但它只是再次按日期而不是随机性对帖子进行排序