WP_Queryでエラーになる時は、今まで問題なかったのにPHP7.2などで突然エラーが表示される
PHP7.2になると、今までエラーにならなかったものが突然エラーになることがあります! ↓これだとエラーになる!
<!-- WP_Queryでのループ --> |
<? php |
$ args = array ( |
'post_type' => 'staff', |
'paged' => $paged, |
'posts_per_page' => 30, |
'order' => 'ASC'//並び順(投稿日が古い順)の指定 DESC だと新しい順(デフォルトと同じ) |
); |
endif > |
<? php $ the_query = new WP_Query($args); ?> |
<? php if($the_query->have_posts()): ?> |
↓これだとエラーがでなくなります!「endif」や「空白(全角や半角)・・・?>の前の部分です」を削除してください!
<!-- WP_Queryでのループ --> |
<? php |
$ args = array ( |
'post_type' => 'staff', |
'paged' => $paged, |
'posts_per_page' => 30, |
'order' => 'ASC',//並び順(投稿日が古い順)の指定 DESC だと新しい順(デフォルトと同じ) |
); |
?> |
<? php $ the_query = new WP_Query($args); ?> |
<? php if($the_query-&gt;have_posts()): ?> |
関連記事はこちら!
スポンサーリンク