{"id":1755,"date":"2023-03-04T14:39:25","date_gmt":"2023-03-04T05:39:25","guid":{"rendered":"https:\/\/ysfarm.jp\/blog\/?p=1755"},"modified":"2023-12-01T20:20:51","modified_gmt":"2023-12-01T11:20:51","slug":"wordpress%e3%81%ae%e8%a8%98%e4%ba%8b%e4%b8%80%e8%a6%a7%e3%82%92wordpress%e5%a4%96%e3%81%aephp%e3%81%a7%e8%aa%ad%e3%81%bf%e8%be%bc%e3%82%80","status":"publish","type":"post","link":"https:\/\/ysfarm.jp\/blog\/2023\/03\/04\/wordpress%e3%81%ae%e8%a8%98%e4%ba%8b%e4%b8%80%e8%a6%a7%e3%82%92wordpress%e5%a4%96%e3%81%aephp%e3%81%a7%e8%aa%ad%e3%81%bf%e8%be%bc%e3%82%80\/","title":{"rendered":"WordPress\u306e\u8a18\u4e8b\u4e00\u89a7\u3092WordPress\u5916\u306ePHP\u3067\u8aad\u307f\u8fbc\u3080"},"content":{"rendered":"<p>\u30ef\u30fc\u30c9\u30d7\u30ec\u30b9\u306e\u8a18\u4e8b\u4e00\u89a7\u3092\u81ea\u5206\u306e\u30b5\u30a4\u30c8\u306e\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u306b\u8868\u793a\u3057\u305f\u3044\u3068\u304d<\/p>\n<p>\u6700\u65b0\u8a18\u4e8b\u304b\u308910\u4ef6\u3092\u629c\u304d\u51fa\u3057<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\/\/ \u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u3000\u8a18\u4e8b\u53d6\u5f97\u3000\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\r\n\r\n\t$sql = &quot;SELECT * FROM wp_posts WHERE post_status = 'publish' AND post_title &lt;&gt; '' AND post_type='post' ORDER BY post_date DESC LIMIT 10&quot;;\r\n\t$stmt = $db-&gt;query($sql);\r\n\t\r\n\tforeach ($stmt as $cont) {\r\n\t\t$post&#x5B;] = array (\r\n\t\t\t'date' =&gt; substr( $cont&#x5B;'post_date'], 0 ,10 ),\r\n\t\t\t'title' =&gt; $cont&#x5B;'post_title'],\r\n\t\t\t'content' =&gt; $cont&#x5B;'post_content'],\r\n\t\t\t'id' =&gt; $cont&#x5B;'ID'],\r\n\t\t\t'date' =&gt; str_replace( &quot;-&quot; , &quot;\/&quot; , $cont&#x5B;'post_date'])\r\n\t\t);\r\n\t}\r\n\r\n\t$i = 0;\r\n\tforeach ($post as $val){\r\n\r\n\t\t$postid = $val&#x5B;'id'];\r\n\r\n\t\t\t\/\/ \u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u3000\u8a18\u4e8b\u4e2d\u304b\u3089\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1\u3092\u53d6\u5f97\u3000\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\r\n\t\t\t\r\n\t\t$eyeSql = &quot;SELECT meta_value FROM wp_postmeta WHERE meta_key = '_thumbnail_id' AND post_id = :postid&quot;;\r\n\t\t\t$eyeStmt = $db-&gt;prepare($eyeSql);\r\n\t\t\t$eyeStmt -&gt; bindValue(':postid' ,$postid ,PDO::ERRMODE_EXCEPTION);\r\n\t\t\t$eyeStmt -&gt; execute();\r\n \t\t\t\r\n\t\t\t$metaid = $eyeStmt-&gt;fetch();\r\n\r\n\t\t\tif (isset($metaid&#x5B;'meta_value'])) {\r\n\t\t\t\t$metaid = $metaid&#x5B;'meta_value'];\r\n\t\t\t\t\r\n\r\n\t\t\t\t$metaSql = &quot;SELECT guid FROM wp_posts WHERE ID = :metaid&quot;;\r\n\t\t\t\t$metaStmt = $db-&gt;prepare($metaSql);\r\n\t\t\t\t$metaStmt -&gt; bindValue(':metaid' ,$metaid ,PDO::ERRMODE_EXCEPTION);\r\n\t\t\t\t$metaStmt -&gt; execute();\r\n\r\n\t\t\t\t$imgURL = $metaStmt-&gt;fetch();\r\n\r\n\r\n\t\t\t\t$eyeChach = $imgURL&#x5B;'guid'];\r\n\r\n\t\t\t\t$post&#x5B;$i]&#x5B;'eyecatch'] = $eyeChach;\r\n\t\t\t\t$i++;\r\n\r\n\t\t\t} else {\r\n\t\t\t\/\/ \u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u3000\u753b\u50cf\u304c\u306a\u3044\u5834\u5408\u306fnoImg.png\u3000\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\r\n\r\n\t\t\t\t$post&#x5B;$i]&#x5B;'eyecatch'] = &quot;\/common\/images\/noImg.png&quot;;\r\n\t\t\t\t$i++;\r\n\t\t}\t\r\n\t}\r\n<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\r\n\t\t&lt;div class=&quot;contents&quot;&gt;\r\n\t\t\t&lt;?php\r\n\t\t\t\tforeach ($post as $val) {\r\n\t\t\t?&gt;\r\n\t\t\t&lt;div class=&quot;articleBoxWide&quot;&gt;\r\n\t\t\t\t&lt;a href=&quot;\/blog\/?p=&lt;?php echo $val&#x5B;'id']; ?&gt;&quot;&gt;\r\n\t\t\t\t&lt;div class=&quot;headImages&quot;&gt;\r\n\t\t\t\t\t&lt;img src=&quot;&lt;?php echo $val&#x5B;'eyecatch']; ?&gt;&quot;&gt;\r\n\t\t\t\t&lt;\/div&gt;\r\n\t\t\t\t\t&lt;dl class=&quot;headLineinBOX&quot;&gt;\r\n\t\t\t\t\t\t&lt;dd class=&quot;comment&quot;&gt;&lt;?php echo $val&#x5B;'content']; ?&gt;&lt;\/dd&gt;\r\n\t\t\t\t\t\t&lt;dd class=&quot;title&quot;&gt;&lt;?php echo $val&#x5B;'title']; ?&gt;&lt;\/dd&gt;\r\n\t\t\t\t\t\t&lt;dd class=&quot;postTime&quot;&gt;&lt;?php echo $val&#x5B;'date']; ?&gt;&lt;\/dd&gt;\r\n\t\t\t\t\t&lt;\/dl&gt;\r\n\t\t\t\t&lt;\/a&gt;\r\n\t\t\t&lt;\/div&gt;\r\n\t\t\t&lt;?php\r\n\t\t\t\t}\r\n\t\t\t?&gt;\r\n\t\t&lt;\/div&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30ef\u30fc\u30c9\u30d7\u30ec\u30b9\u306e\u8a18\u4e8b\u4e00\u89a7\u3092\u81ea\u5206\u306e\u30b5\u30a4\u30c8\u306e\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u306b\u8868\u793a\u3057\u305f\u3044\u3068\u304d \u6700\u65b0\u8a18\u4e8b\u304b\u308910\u4ef6\u3092\u629c\u304d\u51fa\u3057 \/\/ \u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u3000\u8a18\u4e8b\u53d6\u5f97\u3000\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0 $sql = &quot;SELECT * FROM wp_posts WHE [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":44,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"vkexunit_cta_each_option":"","footnotes":""},"categories":[397,5],"tags":[],"class_list":["post-1755","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","category-5"],"_links":{"self":[{"href":"https:\/\/ysfarm.jp\/blog\/wp-json\/wp\/v2\/posts\/1755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ysfarm.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ysfarm.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ysfarm.jp\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ysfarm.jp\/blog\/wp-json\/wp\/v2\/comments?post=1755"}],"version-history":[{"count":5,"href":"https:\/\/ysfarm.jp\/blog\/wp-json\/wp\/v2\/posts\/1755\/revisions"}],"predecessor-version":[{"id":1869,"href":"https:\/\/ysfarm.jp\/blog\/wp-json\/wp\/v2\/posts\/1755\/revisions\/1869"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ysfarm.jp\/blog\/wp-json\/wp\/v2\/media\/44"}],"wp:attachment":[{"href":"https:\/\/ysfarm.jp\/blog\/wp-json\/wp\/v2\/media?parent=1755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ysfarm.jp\/blog\/wp-json\/wp\/v2\/categories?post=1755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ysfarm.jp\/blog\/wp-json\/wp\/v2\/tags?post=1755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}