因此,基本上我正在尝试在分类法归档中添加多个自定义帖子类型。这是我的代码:
<?php
$args_trip = array (
\'post_type\' => \'trip\' ,
\'post_status\' => \'publish\',
\'tax_query\' => array (
array (
\'taxonomy\' => \'destination\',
\'field\' => \'slug\',
\'terms\' => $term
)
)
);
$trips = new WP_Query( $args_trip );
?>
<?php
if ( $trips->have_posts() ) : ?>
<div class="archive-grid">
<?php
/* Start the Loop */
while ( $trips->have_posts() ) : $trips->the_post();
get_template_part( \'template-parts/content\', \'trip\' );
endwhile;
wp_reset_postdata();
?>
</div>
<hr>
<?php
$args_wisata = array (
\'post_type\' => \'wisata\' ,
\'post_status\' => \'publish\',
\'tax_query\' => array (
array (
\'taxonomy\' => \'destination\',
\'field\' => \'slug\',
\'terms\' => $term
)
)
);
$wisatas = new WP_Query( $args_wisata );
if ( $wisatas->have_posts() ) :
?>
<div class="archive-grid">
<?php
/* Start the Loop */
while ( $wisatas->have_posts() ) : $wisatas->the_post();
get_template_part( \'template-parts/content\', \'wisata\' );
endwhile;
?>
</div>
上述代码旨在输出两种不同的自定义post类型TRIP&;分类法归档中的WISATA。
但它总是导致白屏,但当它只循环一个自定义帖子类型时,它工作得很好。以下是一种自定义帖子类型的代码:
<?php
$args_trip = array (
\'post_type\' => \'trip\' ,
\'post_status\' => \'publish\',
\'tax_query\' => array (
array (
\'taxonomy\' => \'destination\',
\'field\' => \'slug\',
\'terms\' => $term
)
)
);
$trips = new WP_Query( $args_trip );
?>
<?php
if ( $trips->have_posts() ) : ?>
<div class="archive-grid">
<?php
/* Start the Loop */
while ( $trips->have_posts() ) : $trips->the_post();
get_template_part( \'template-parts/content\', \'trip\' );
endwhile;
wp_reset_postdata();
?>
</div>
<hr>
我不知道是什么原因造成的?真让我沮丧。。。请有人帮帮我!英雄联盟
注:我的wp-config.php
已经有了define(\'WP_DEBUG\', true);
但并没有显示错误,只有空白的白色页面。