我正在尝试添加“课程”帖子类型,以填充wp查询以及预先存在的帖子类型“模块”。最好我希望他们被合并成一个查询,显示最近的6篇文章。到目前为止,我只能在两个不同的查询中显示它们。
<?php
//Template Name: Last 6 Modules
remove_action( \'genesis_loop\', \'genesis_do_loop\' );
add_action( \'genesis_loop\', \'ca_show_last_six_modules\' );
function ca_show_last_six_modules(){
$modules = new WP_Query(array(
\'post_type\' => \'module\',
\'orderby\' => \'menu_order\',
\'order\' => \'ASC\',
\'status\' => \'publish\',
\'posts_per_page\' => 6
));
if ( $modules->have_posts() ) : ?>
<div class="row">
<?php while ( $modules->have_posts() ) : $modules->the_post(); ?>
<?php get_template_part( \'template-parts/modules\', \'loop\' ); ?>
<?php endwhile; ?>
</div>
<?php endif;
}
genesis(); ?>