页面上有多个自定义帖子循环


Multiple custom post loops on page

在显示第一个循环后,我无法显示第二个或第三个循环。在过去的两个小时里,我一直在尝试不同的东西,但我已经没有主意了。

这就是我现在拥有的

<?php
$type = 'new_trucks';
$args=array(
 'orderby' => 'rand',
 'post_type' => $type,
 'paged' => $paged,
 'posts_per_page' => 3,
);
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query($args);
?>
<?php while (have_posts()) : the_post(); ?>
...
<?php endwhile; /* End loop */ ?>
<?php wp_reset_query(); ?>

第二个循环是这样的,就在上面显示的第一个循环下面。。。

<?php
$type = 'used_trucks';
$args=array(
 'orderby' => 'rand',
 'post_type' => $type,
 'paged' => $paged,
 'posts_per_page' => 3,
);
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query($args);
?>
<?php while (have_posts()) : the_post(); ?>
...
<?php endwhile; /* End loop */ ?>
<?php wp_reset_query(); ?>

在我尝试用不同的类型集在同一个页面中复制它时,第二个循环根本没有显示。如果我擦除第一个循环,它就工作了。我希望有人能提供一些指导。

谢谢!

<?php
$type = 'new_trucks';
$args=array(
 'orderby' => 'rand',
 'post_type' => $type,
 'paged' => $paged,
 'posts_per_page' => 3,
);
$wp_query = null;
$wp_query = new WP_Query($args);
?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
...
<?php endwhile; /* End loop */ ?>
<?php wp_reset_query(); ?>

是我在过去中的做法