我正在使用一些過濾器創建一個查詢并且它正在作業,但在代碼下方它不運行任何其他內容并且它不顯示頁腳
你能幫我解決我做錯了什么嗎?
我正在嘗試運行以下代碼:
頁面.php
<?php
if(is_page( 1182 )){
include_once("ConteudoFiltroParceiros.php");
include_once("FiltroParceiros.php");
include_once("FooterFiltroParceiros.php");
} ?>
FiltroParceiros.php
<div class="contentFilt">
<?php
$args = array(
'post_type' => 'parceiros',
'orderby' => 'date',
'order' => 'asc',
'paged' => get_query_var('paged') ? get_query_var('paged') : 1
);
if( isset( $_GET['segmento'] ) && isset( $_GET['loja'] ) && isset( $_GET['estado'] ) && isset( $_GET['cidade'] )){
$args['tax_query'] = array(
array(
'taxonomy' => 'segmento',
'terms' => $_GET['segmento'],
'field' => 'slug',
'include_children' => true,
'operator' => 'IN'
),
array(
'taxonomy' => 'loja',
'terms' => $_GET['loja'],
'field' => 'slug',
'include_children' => true,
'operator' => 'IN'
),
array(
'taxonomy' => 'estado',
'terms' => $_GET['estado'],
'field' => 'slug',
'include_children' => true,
'operator' => 'IN'
),
array(
'taxonomy' => 'cidade',
'terms' => $_GET['cidade'],
'field' => 'slug',
'include_children' => true,
'operator' => 'IN'
),
);
}
$query = new WP_Query( $args );
if( $query->have_posts() ) :
while( $query->have_posts() ): $query->the_post();
echo '<div >';
echo get_the_title();
echo the_content();
echo '</div>';
endwhile;
echo '<div >';
echo paginate_links( array(
'base' => str_replace( 999999999, '%#%', get_pagenum_link( 999999999 ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $query->max_num_pages,
'prev_next' => true,
'prev_text' => 'Página Anterior',
'next_text' => 'Próxima Página',
/*'before_page_number' => '-',
'after_page_number' => '>', */
'show_all' => false,
'mid_size' => 3,
'end_size' => 1
) );
echo '</div>';
wp_reset_postdata();
else :
echo 'Nenhuma loterica encontrada!';
endif;
wp_reset_postdata();
die();
wp_reset_query();
?>
</div
我嘗試使用 wp_reset_query 和 wp_reset_postdata 來嘗試修復此錯誤,但沒有成功,您能幫幫我嗎?
uj5u.com熱心網友回復:
您正在使用die();它將阻止其他任何事情的發生。
endif;
wp_reset_postdata();
die(); // Remove
wp_reset_query();
https://www.php.net/manual/en/function.die.php
die - 相當于退出
https://www.php.net/manual/en/function.exit.php
exit — 輸出一條訊息并終止當前腳本
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/414430.html
標籤:
