Thay đổi số bài viết trên 1 trang chuyên mục đối với taxonomy bất kỳ
06/09/2023
05/02/2023 - 47
<?php $postquery = new WP_Query(array('posts_per_page' => 35, 'orderby' => 'rand')); if ($postquery->have_posts()) { while ($postquery->have_posts()) : $postquery->the_post(); $do_not_duplicate = $post->ID; ?> <li> <a href="<?php the_permalink();?>"><?php the_title();?></a> </li> <?php endwhile; } wp_reset_postdata(); ?>
Đoạn code trên lấy 35 bài viết ngẫu nhiên.