予定表をwordpressで作成
今日以降のスケジュールを全て習得する場合
scheduleカスタム投稿タイプにdateというカスタムフィールドを設定しておく。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
$currnet_date = date("Y/m/d"); $the_query = new WP_Query(array( 'post_type' => 'schedule', 'posts_per_page' => 7, 'orderby' => 'meta_value', 'meta_key' => 'date', 'order' => 'DESC', 'meta_query' => array( array( 'key' => 'date', 'value' => $currnet_date, 'compare' => '>=', 'type' => 'DATE' ) ) ) ); // ループ while ( $the_query->have_posts() ) : $the_query->the_post(); echo '<li>'; the_title(); echo '</li>'; endwhile; |
ディスカッション
コメント一覧
まだ、コメントがありません