質問編集履歴

3

スペル間違ってました。。

2019/03/31 06:33

投稿

yukoneko
yukoneko

スコア18

test CHANGED
File without changes
test CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  'posts_per_page' => -1,
30
30
 
31
- 'meta_key' => 'sche-date',
31
+ 'meta_key' => 'schedule',
32
32
 
33
33
  'orderby' => 'meta_value',
34
34
 

2

ソースコード編集しました。

2019/03/31 06:32

投稿

yukoneko
yukoneko

スコア18

test CHANGED
File without changes
test CHANGED
@@ -24,25 +24,21 @@
24
24
 
25
25
  <?php
26
26
 
27
- $args = array(
28
-
29
27
  'post_type' => 'post',
30
28
 
31
29
  'posts_per_page' => -1,
30
+
31
+ 'meta_key' => 'sche-date',
32
32
 
33
33
  'orderby' => 'meta_value',
34
34
 
35
35
  'order'=> 'ASC',
36
36
 
37
- 'meta_key' => 'schedule',//カスタムフィールド名
38
-
39
- 'meta_value'=> date('Ymd'),
40
-
41
37
  'meta_compare' => '>=',
42
38
 
39
+ 'meta_value'=> date("Ymd"),
40
+
43
41
  'type' => 'DATE',
44
-
45
-
46
42
 
47
43
  );
48
44
 

1

一覧の出力部分を追記いたしました。

2019/03/31 05:18

投稿

yukoneko
yukoneko

スコア18

test CHANGED
File without changes
test CHANGED
@@ -50,4 +50,52 @@
50
50
 
51
51
  if($domestic_post) : foreach($domestic_post as $post) : setup_postdata( $post ); ?>
52
52
 
53
+
54
+
55
+ <li class="p-schedule-menu-slick__item">
56
+
57
+ <a href="#<?php $strDate = get_field('schedule');
58
+
59
+ $date = DateTime::createFromFormat('Ymd', $strDate);
60
+
61
+ echo $date->format('Ymd'); ?>" class="active">
62
+
63
+ <div class="p-schedule-menu__date">
64
+
65
+ <div class="p-schedule-mask">
66
+
67
+ <div class="p-schedule-mask__inner">
68
+
69
+ <?php $strDate = get_field('schedule');
70
+
71
+ $date = DateTime::createFromFormat('Ymd', $strDate);
72
+
73
+ $week = array ( 'SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT' );
74
+
75
+ echo $date->format('n.j').'<span>' .'('. $week[$date->format('w')].')'.'</span>'; ?></div>
76
+
77
+ </div>
78
+
79
+ </div>
80
+
81
+ <div class="p-schedule-menu__image">
82
+
83
+ <div class="p-schedule-menu-inner">
84
+
85
+ <?php if(get_field('img-thumb')): ?>
86
+
87
+ <img src="<?php the_field('img-thumb'); ?>" class="u-img-responsive"><?php endif; ?>
88
+
89
+ </div>
90
+
91
+ </div>
92
+
93
+ </a>
94
+
95
+ </li>
96
+
97
+ <?php endforeach; ?><?php else: ?><?php endif; ?>
98
+
99
+
100
+
53
101
  ```