ourlifeというカスタム投稿タイプの最新の投稿の月の日付を全て取得しようと下記のように記述したのですが一部取得できず困っています。
そのようにしたら最新の投稿の月の記事のデータを取得できるでしょうか?
ご教授お願い致します。
php
1<?php 2 $today = getdate(); 3 $year = $today['year']; 4 $month = $today['mon']; 5 $first_day = date('1'); 6 $last_day = date('t'); 7 8 9 $args = array( 10 'order' => 'DESC', 11 'post_type' => 'ourlife', 12 'post_status' => 'publish', 13 'orderby' => 'date', 14 'date_query' => array( 15 array( 16 'after' => array( 17 'year' => $year, 18 'month' => $month, 19 'day' => $first_day 20 ), 21 'before' => array( 22 'year' => $year, 23 'month' => $month, 24 'day' => $last_day 25 ), 26 'inclusive' => true 27 ) 28 ) 29 ); 30 31 $myposts = get_posts($args); 32 33?> 34 35<ul> 36 <?php if($myposts): foreach($myposts as $post): setup_postdata($post); ?> 37 <li><a href="<?php the_permalink(); ?>"><?php the_date('n/d'); ?></a></li> 38 <?php the_post_thumbnail('full', array('class' => 'ourlife_image')); ?> 39 <?php endforeach; endif; ?> 40</ul>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/06/11 04:52
2016/06/11 07:25
2016/06/11 07:49