次のコードを使用して、今日の日付以上の日付のイベントのリストを出力しようとしています。
$args = array('post_type' => 'event') // setup my custom post type
$todaysdate = blah blah //setup for today's date
// the wp loop
query_posts($args);
if ( (have_posts() && $eventdate >= $todaysdate) ) : while (have_posts()) : the_post();
$eventdate = blah blah // setup for the date of the event;
echo $event;
endwhile; endif;
ご覧のとおり、問題はIFがループ内の変数に依存していることです。
最初にループの外側に変数を設定するための最良の方法は何ですか?