分类档案中的多个自定义帖子类型导致白屏

时间:2018-11-08 12:21:20

标签: wordpress

所以基本上我想在我的分类档案中添加多个自定义帖子类型。这是我的代码:

this.setState({ tempUnits: "F" }); 

上面的代码旨在在分类档案中输出两个不同的自定义帖子类型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>

<?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>

我不知道是什么原因引起的?真的让我感到沮丧...请有人帮助我!大声笑。

1 个答案:

答案 0 :(得分:0)

我忘了关闭if-在这两个<?php endif; ?>之后添加</div>(存档网格DIV的结束标记)

瞧,它在起作用!抱歉,我一直都瞎了。