回答編集履歴
1
追記
test
CHANGED
@@ -1,3 +1,81 @@
|
|
1
1
|
**返り値のフォーマット**が`Y/m/d`になっていて出力方法が`the_field('メタキー')`や`get_field('メタキー')`なら`Y/m/d`になりますが`get_post_meta()`だとデータベースに保存された値を返すだけです。
|
2
2
|
|
3
3
|
`the_field`で`Y/m/d`にならないなら**返り値のフォーマット**が`Y/m/d`になっていないと思われます。
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
```
|
8
|
+
|
9
|
+
<?php
|
10
|
+
|
11
|
+
$current_date = date_i18n( 'Y/m/d' );
|
12
|
+
|
13
|
+
$args = array(
|
14
|
+
|
15
|
+
'showposts' => '2',
|
16
|
+
|
17
|
+
'orderby' => 'meta_value',
|
18
|
+
|
19
|
+
'meta_key' => 'app_end',
|
20
|
+
|
21
|
+
'order' =>'ASC',
|
22
|
+
|
23
|
+
'meta_query' => array(
|
24
|
+
|
25
|
+
array(
|
26
|
+
|
27
|
+
'key' => 'app_end',
|
28
|
+
|
29
|
+
'value' => $current_date,
|
30
|
+
|
31
|
+
'compare' => '>=',
|
32
|
+
|
33
|
+
'type' => 'DATE'
|
34
|
+
|
35
|
+
)
|
36
|
+
|
37
|
+
)
|
38
|
+
|
39
|
+
);
|
40
|
+
|
41
|
+
$the_query = new WP_Query( $args );
|
42
|
+
|
43
|
+
if ( $the_query->have_posts() ):
|
44
|
+
|
45
|
+
?>
|
46
|
+
|
47
|
+
<div class="event-area area-wrap">
|
48
|
+
|
49
|
+
<h2 class="pagettl__head">イベント・アクションに参加する</h2>
|
50
|
+
|
51
|
+
<div class="container-sm inner">
|
52
|
+
|
53
|
+
<?php while ( $the_query->have_posts() ):
|
54
|
+
|
55
|
+
$the_query->the_post();
|
56
|
+
|
57
|
+
?>
|
58
|
+
|
59
|
+
<div class="box">
|
60
|
+
|
61
|
+
<div class="date">
|
62
|
+
|
63
|
+
<span><i class="fa fa-calendar" aria-hidden="true"></i>開催日</span><span><?php the_field( 'app_end' ); ?></span>
|
64
|
+
|
65
|
+
<h3 class="ttl"><a href=<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h3>
|
66
|
+
|
67
|
+
</div>
|
68
|
+
|
69
|
+
</div>
|
70
|
+
|
71
|
+
<?php endwhile;
|
72
|
+
|
73
|
+
wp_reset_postdata();
|
74
|
+
|
75
|
+
?>
|
76
|
+
|
77
|
+
</div></div>
|
78
|
+
|
79
|
+
<?php endif; ?>
|
80
|
+
|
81
|
+
```
|