{"id":7761,"date":"2025-03-26T14:10:05","date_gmt":"2025-03-26T05:10:05","guid":{"rendered":"https:\/\/code-plus.jp\/gp\/?p=7761"},"modified":"2026-01-08T11:16:51","modified_gmt":"2026-01-08T02:16:51","slug":"post-7761","status":"publish","type":"post","link":"https:\/\/code-plus.jp\/gp\/post-7761\/","title":{"rendered":"\u3010WP\u30d7\u30e9\u30b0\u30a4\u30f3\u3011\uff3bMTS Simple Booking\uff3d\u4e88\u7d04\u54c1\u76ee\u306e\u672c\u6587\u3092\u8868\u793a\u3055\u305b\u308b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba"},"content":{"rendered":"<h2 class=\"fz-xl\">\u306f\u3058\u3081\u306b<\/h2>\r\n<p>MTS Simple Booking\u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u4e88\u7d04\u54c1\u76ee\u306e\u672c\u6587\uff08<code>post_content<\/code>\uff09\u304c\u4e88\u7d04\u30d5\u30a9\u30fc\u30e0\u306b\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002\u4eca\u56de\u306f\u3001\u4e88\u7d04\u54c1\u76ee\u306e\u672c\u6587\u3092\u4e88\u7d04\u30d5\u30a9\u30fc\u30e0\u306b\u8868\u793a\u3055\u305b\u308b\u305f\u3081\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\r\n<h2 class=\"fz-xl\">\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306e\u624b\u9806<\/h2>\r\n<h3 class=\"fz-lg\">1. \u4e88\u7d04\u54c1\u76ee\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u90e8\u5206\u306e\u4fee\u6b63<\/h3>\r\n<p>\u307e\u305a\u3001<code>mtssb-article.php<\/code>\u30d5\u30a1\u30a4\u30eb\u5185\u306e<code>get_the_article()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u4fee\u6b63\u3057\u3066\u3001<code>post_content<\/code>\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u53d6\u5f97\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">static public function get_the_article($article_id=0) {\r\n    global $wpdb;\r\n\r\n    $sql = $wpdb-&gt;prepare(&quot;\r\n        SELECT ID AS article_id,post_title AS name,post_content,post_type,post_status,\r\n            m1.meta_value AS timetable,m2.meta_value AS restriction,m3.meta_value AS capacity,\r\n            m4.meta_value AS quantity,m5.meta_value AS minimum,m6.meta_value AS maximum,\r\n            m7.meta_value AS count,m8.meta_value AS addition\r\n        FROM {$wpdb-&gt;posts}\r\n        LEFT JOIN {$wpdb-&gt;postmeta} AS m1 ON m1.post_id=ID AND m1.meta_key=&#39;timetable&#39;\r\n        \/\/ ... \u4ee5\u4e0b\u7701\u7565 ...\r\n<\/code><\/pre>\r\n<p>\u30dd\u30a4\u30f3\u30c8\uff1a<\/p>\r\n<ul style=\"list-style-type:bullet;\">\r\n<li>SQL\u30af\u30a8\u30ea\u306eSELECT\u53e5\u306b<code>post_content<\/code>\u3092\u8ffd\u52a0<\/li>\r\n<li>\u3053\u308c\u306b\u3088\u308a\u4e88\u7d04\u54c1\u76ee\u306e\u672c\u6587\u30c7\u30fc\u30bf\u304c\u53d6\u5f97\u53ef\u80fd\u306b<\/li>\r\n<\/ul>\r\n<h3 class=\"fz-lg\">2. \u4e88\u7d04\u30d5\u30a9\u30fc\u30e0\u3067\u306e\u8868\u793a\u90e8\u5206\u306e\u8ffd\u52a0<\/h3>\r\n<p>\u6b21\u306b\u3001<code>mtssb-booking-form.php<\/code>\u30d5\u30a1\u30a4\u30eb\u5185\u306e\u4e88\u7d04\u5185\u5bb9\u78ba\u8a8d\u90e8\u5206\u306b\u672c\u6587\u3092\u8868\u793a\u3059\u308b\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">&lt;p&gt;&lt;?php echo esc_html($this-&gt;article[&#39;name&#39;]) ?&gt;&lt;br \/&gt;\r\n    &lt;?php if (!empty($this-&gt;article[&#39;post_content&#39;])) : ?&gt;\r\n        &lt;?php echo nl2br(esc_html($this-&gt;article[&#39;post_content&#39;])) ?&gt;&lt;br \/&gt;\r\n    &lt;?php endif; ?&gt;\r\n    &lt;?php echo apply_filters(&#39;booking_form_date&#39;, date(&#39;Y\u5e74n\u6708j\u65e5 H:i&#39;, $this-&gt;thetime), $this-&gt;thetime) ?&gt;\r\n&lt;\/p&gt;\r\n<\/code><\/pre>\r\n<p>\u30dd\u30a4\u30f3\u30c8\uff1a<\/p>\r\n<ul style=\"list-style-type:bullet;\">\r\n<li>\u4e88\u7d04\u54c1\u76ee\u540d\u306e\u4e0b\u306b\u672c\u6587\u3092\u8868\u793a<\/li>\r\n<li><code>nl2br()<\/code>\u95a2\u6570\u3067\u6539\u884c\u3092<code>&lt;br&gt;<\/code>\u30bf\u30b0\u306b\u5909\u63db<\/li>\r\n<li><code>esc_html()<\/code>\u3067XSS\u5bfe\u7b56<\/li>\r\n<li>\u672c\u6587\u304c\u7a7a\u306e\u5834\u5408\u306f\u8868\u793a\u3057\u306a\u3044\u6761\u4ef6\u5206\u5c90<\/li>\r\n<\/ul>\r\n<h2 class=\"fz-xl\">\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306e\u30e1\u30ea\u30c3\u30c8<\/h2>\r\n<ol style=\"list-style-type:decimal;\">\r\n<li>\u4e88\u7d04\u54c1\u76ee\u306e\u8a73\u7d30\u60c5\u5831\u3092\u4e88\u7d04\u30d5\u30a9\u30fc\u30e0\u4e0a\u3067\u76f4\u63a5\u78ba\u8a8d\u53ef\u80fd<\/li>\r\n<li>\u4e88\u7d04\u6642\u306e\u6ce8\u610f\u4e8b\u9805\u3084\u7279\u8a18\u4e8b\u9805\u3092\u52b9\u679c\u7684\u306b\u4f1d\u9054<\/li>\r\n<li>\u30e6\u30fc\u30b6\u30fc\u306e\u7406\u89e3\u5ea6\u5411\u4e0a\u306b\u3088\u308b\u4e88\u7d04\u30df\u30b9\u306e\u9632\u6b62<\/li>\r\n<\/ol>\r\n<h2 class=\"fz-xl\">\u6ce8\u610f\u70b9<\/h2>\r\n<ol style=\"list-style-type:decimal;\">\r\n<li>\u672c\u6587\u304c\u9577\u3059\u304e\u308b\u5834\u5408\u3001\u30d5\u30a9\u30fc\u30e0\u306e\u30ec\u30a4\u30a2\u30a6\u30c8\u304c\u5d29\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059<\/li>\r\n<li>HTML\u30bf\u30b0\u3092\u542b\u3080\u672c\u6587\u306f\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5bfe\u7b56\u306e\u305f\u3081\u30a8\u30b9\u30b1\u30fc\u30d7\u3055\u308c\u307e\u3059<\/li>\r\n<li>\u672c\u6587\u306e\u88c5\u98fe\u306f\u30d7\u30ec\u30fc\u30f3\u30c6\u30ad\u30b9\u30c8\u306e\u307f\u3068\u306a\u308a\u307e\u3059<\/li>\r\n<\/ol>\r\n<h2 class=\"fz-xl\">\u307e\u3068\u3081<\/h2>\r\n<p>\u3053\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306b\u3088\u308a\u3001\u4e88\u7d04\u54c1\u76ee\u306e\u672c\u6587\u3092\u4e88\u7d04\u30d5\u30a9\u30fc\u30e0\u306b\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u30e6\u30fc\u30b6\u30fc\u3078\u306e\u3088\u308a\u8a73\u7d30\u306a\u60c5\u5831\u63d0\u4f9b\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u3001CSS\u3067\u30b9\u30bf\u30a4\u30ea\u30f3\u30b0\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u3001\u3055\u3089\u306b\u898b\u3084\u3059\u3044\u8868\u793a\u306b\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\r\n<p>\u4ee5\u4e0a\u304c\u3001MTS Simple Booking\u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u4e88\u7d04\u54c1\u76ee\u306e\u672c\u6587\u3092\u8868\u793a\u3055\u305b\u308b\u305f\u3081\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u65b9\u6cd5\u3067\u3059\u3002<\/p>\r\n","protected":false},"excerpt":{"rendered":"\u306f\u3058\u3081\u306b MTS Simple Booking\u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u4e88\u7d04\u54c1\u76ee\u306e\u672c\u6587\uff08post_content\uff09\u304c\u4e88\u7d04\u30d5\u30a9\u30fc\u30e0\u306b\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002\u4eca\u56de\u306f\u3001\u4e88\u7d04\u54c1\u76ee\u306e\u672c\u6587\u3092\u4e88\u7d04\u30d5\u30a9\u30fc\u30e0\u306b\u8868\u793a\u3055\u305b\u308b\u305f\u3081\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u65b9\u6cd5[...]","protected":false},"author":1,"featured_media":7764,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[378,379,102,112,108],"class_list":{"0":"post-7761","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-wordpress","8":"tag-mts-simple-booking","9":"tag-379","10":"tag-wordpress","11":"tag-112","12":"tag-108"},"_links":{"self":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/7761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/comments?post=7761"}],"version-history":[{"count":1,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/7761\/revisions"}],"predecessor-version":[{"id":8993,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/7761\/revisions\/8993"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media\/7764"}],"wp:attachment":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media?parent=7761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/categories?post=7761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/tags?post=7761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}