teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

追記

2020/05/16 11:16

投稿

CHERRY
CHERRY

スコア25234

answer CHANGED
@@ -25,4 +25,19 @@
25
25
  - [Adding REST API Support For Custom Content Types](https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-rest-api-support-for-custom-content-types/)
26
26
  - [REST API Handbook / Reference / Posts](https://developer.wordpress.org/rest-api/reference/posts/)
27
27
 
28
- 参照
28
+ 参照
29
+
30
+ ----
31
+
32
+ (追記)
33
+
34
+ > エラーはsyntax error, unexpected '<', expecting end of file inで「変数が定義されていない」ことが原因のようですがこれも含めてわからないでおります。
35
+
36
+ エラーメッセージが省略されているので、何処で発生しているのか不明ですが...
37
+
38
+ 文法エラー部分を指摘すると
39
+
40
+ > echo "今までの記事の総数は"$all_cnt"件です";
41
+
42
+ 文字列の連結であれば、 `.` 演算子が必要です。
43
+ ( [文字列演算子](https://www.php.net/manual/ja/language.operators.string.php) 参照 )

1

日付部分の修正

2020/05/16 11:16

投稿

CHERRY
CHERRY

スコア25234

answer CHANGED
@@ -13,12 +13,12 @@
13
13
 
14
14
  WP REST API で、`WordPressのURL/wp-json/wp/v2/カスタム投稿タイプのベースURL` にパラメータを付けて、WP REST API 経由でアクセスすれば、JSON 形式で カスタム投稿を取得できます。
15
15
 
16
- たとえば、WordPress の URL が http://example.com/ で、 post_type が「custompost」 投稿日が「日付1」(after)から「日付2」(before)まで取得するのであれば、
16
+ たとえば、WordPress の URL が http://example.com/ で、 post_type が「custompost」 投稿日が「2020-04-01」(after)から「2020-04-30」(before)まで取得するのであれば、
17
17
 
18
18
  ```
19
19
  http://example.com/wp-json/wp/v2/custompost?after=2020-04-01T00:00:00&before=2020-05-01T00:00:00
20
20
  ```
21
- のようになります。
21
+ のようになります。( before は、 2020-04-30T23:59:59 でも OK )
22
22
 
23
23
  参考情報
24
24