Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* https://ja.wordpress.org/support/topic/今日から1ヶ月以内のカスタム投稿を表示/ */
- $meta_key = 'hogehogedate';
- $today = date_i18n('Ymd');
- $ones_month = date('Ymd', strtotime('+1 month'));
- $mydata = get_posts( array(
- 'posts_per_page' => -1,
- 'post_type' => 'member-hogehoge',
- 'orderby' => 'meta_value',
- 'order' => 'ASC',
- 'meta_query' => array(
- 'relation' => 'AND',
- array(
- 'key' => $meta_key,
- 'value' => $today,
- 'type' => 'numeric',
- 'compare' => '>=',
- ),
- array(
- 'key' => $meta_key,
- 'value' => $ones_month,
- 'type' => 'numeric',
- 'compare' => '<=',
- ),
- ),
- ) );
Advertisement
Add Comment
Please, Sign In to add comment