{"id":1406,"date":"2017-03-16T23:55:36","date_gmt":"2017-03-16T14:55:36","guid":{"rendered":"http:\/\/www.sriproot.net\/blog\/?p=1406"},"modified":"2017-03-17T00:02:04","modified_gmt":"2017-03-16T15:02:04","slug":"%e6%8a%95%e7%a8%bf%e7%94%bb%e9%9d%a2%e3%81%ae%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e3%82%bf%e3%82%af%e3%82%bd%e3%83%8e%e3%83%9f%e3%83%bc%e3%82%92%e3%82%bb%e3%83%ac%e3%82%af%e3%83%88%e3%83%9c%e3%83%83","status":"publish","type":"post","link":"https:\/\/www.sriproot.net\/blog\/%e6%8a%95%e7%a8%bf%e7%94%bb%e9%9d%a2%e3%81%ae%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e3%82%bf%e3%82%af%e3%82%bd%e3%83%8e%e3%83%9f%e3%83%bc%e3%82%92%e3%82%bb%e3%83%ac%e3%82%af%e3%83%88%e3%83%9c%e3%83%83-1406","title":{"rendered":"\u6295\u7a3f\u753b\u9762\u306e\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3092\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u5909\u66f4"},"content":{"rendered":"<p>WBC\u307f\u3066\u308b\u3068\u3001\u5c11\u5e74\u91ce\u7403\u3084\u3063\u3066\u308b\u5b50\u305f\u3061\u3082\u3057\u3063\u304b\u308a\u307f\u3066\u6b32\u3057\u3044\u3068\u3064\u304f\u3065\u304f\u601d\u3044\u307e\u3059\u3002<br \/>\n\u7279\u306b\u30d9\u30f3\u30c1\u30e1\u30f3\u30d0\u30fc\u3084\u3001\u30b9\u30bf\u30e1\u30f3\u3058\u3083\u306a\u3044\u4eba\u305f\u3061\u306e\u59ff\u3092\u3002<br \/>\n\u307e\u3041\u3001\u3042\u308c\u3060\u3051\u5927\u5dee\u3064\u3044\u3066\u3066\u3082\u3001\u5168\u304f\u51fa\u756a\u306a\u3044\u306e\u306a\u3089\u8150\u3063\u3066\u4ed5\u65b9\u306a\u3044\u3068\u306f\u601d\u3044\u307e\u3059\u3051\u3069\u306d\u3002<\/p>\n<p>\u3055\u3066\u3001\u5c11\u5e74\u91ce\u7403\u30c1\u30fc\u30e0\u306e\u975e\u30aa\u30d5\u30a3\u30b7\u30e3\u30eb\u30b5\u30a4\u30c8\u3067\u306f\u3001\u8a66\u5408\u4f1a\u5834\u3092\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3067\u4f5c\u3063\u3066\u767b\u9332\u3055\u305b\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u305f\u3060\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3063\u3066\u3001\u30ab\u30c6\u30b4\u30ea\u30fc\u3068\u4e00\u7dd2\u3067\u3001\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u304c\u30ba\u30e9\u30fc\u3063\u3068\u4e26\u3093\u3067\u3001\u5c11\u306a\u3044\u3068\u304d\u306f\u3044\u3044\u3051\u3069\u3001\u5897\u3048\u3066\u304f\u308b\u3068\u307b\u3093\u3068\u63a2\u3057\u3065\u3089\u304b\u3063\u305f\u308a\u3059\u308b\u306e\u3067\u3001\u7c21\u5358\u306b\u9078\u629e\u3067\u304d\u308b\u3088\u3046\u306b\u3001\u305d\u3057\u30661\u3064\u3057\u304b\u9078\u629e\u3067\u304d\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306b\u3001\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u5909\u66f4\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u76ee\u6b21<\/h2>\n<ol>\n<li><a href=\"#step1\">JavaScript \u3067\u5909\u63db<\/a><\/li>\n<li><a href=\"#step2\">\u7ba1\u7406\u753b\u9762\u3067\u5916\u90e8JS\u3092\u8aad\u307f\u8fbc\u3080<\/a><\/li>\n<li><a href=\"#step3\">\u307e\u3068\u3081<\/a><\/li>\n<\/ol>\n<h2 id=\"step1\">JavaScript \u3067\u5909\u63db<\/h2>\n<p>\u30d5\u30a3\u30eb\u30bf\u30fc\u306a\u3093\u304b\u3067\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u3067\u51fa\u529b\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3092\u5909\u63db\u3059\u308b\u306e\u304b\u306a\u3041\u3002\u3068\u601d\u3063\u3066\u305f\u3093\u3067\u3059\u304c\u3001\u305d\u3093\u306a\u65b9\u6cd5\u306f\u898b\u3064\u3051\u3089\u308c\u305a\u3002<br \/>\n\u7d50\u5c40\u3001Javascript\u3092\u6d78\u304b\u3063\u3066\u3001\u51fa\u529b\u306f\u3053\u308c\u307e\u3067\u3069\u304a\u308a\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u306a\u3093\u3060\u3051\u3069\u3001\u3084\u3084\u5f37\u5f15\u306b\u898b\u305f\u76ee\u3060\u3051\u3092\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u5909\u63db\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u30b3\u30fc\u30c9\u306f\u3053\u3061\u3089<\/p>\n<p>[javascript]<br \/>\n( function ( $ ) {<br \/>\n    var option_list = [];<br \/>\n    $( &#8216;#stadiumchecklist label&#8217; ).each(function(){<br \/>\n        option_list.push( &#8216;<option value=\"' + $(this).children('input').val() + '\">&#8216; + $(this).html().replace(\/&lt;input[^>]+>\/g, &#8221;) + &#8216;<\/option>&#8216;);<br \/>\n    });<br \/>\n    $( &#8216;#stadiumchecklist&#8217; ).replaceWith( &#8216;<select id=\"stadiumchecklist\" name=\"tax_input[stadium][]\" style=\"margin: 1em 0; width: 100%; \">&#8216; + option_list.join( &#8221; ) + &#8216;<\/select>&#8216; );<br \/>\n})( jQuery );<br \/>\n[\/javascript]<\/p>\n<p>\u3053\u306e\u5834\u5408\u3060\u3068\u3001\u300cstadium\u300d\u3068\u3044\u3046\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306e\u4e2d\u306e\u30bf\u30fc\u30e0\u3092\u63a2\u3057\u306a\u304c\u3089\u3001label\u30bf\u30b0\u4ee5\u4e0b\u306einput\u306evalue\u3092\u53d6\u5f97\u3057\u3066\u3001option\u306evalue\u306b\u5165\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u305d\u308c\u3092\u914d\u5217\u306b\u5165\u308c\u3066\u3044\u3063\u3066\u3001\u6700\u5f8c\u306bselect\u30bf\u30b0\u3067\u56f2\u3093\u3067\u3042\u3052\u308b\u3068\u3044\u3046\u3084\u308a\u65b9\u3067\u3059\u3002<\/p>\n<p>\u305f\u3063\u305f\u3053\u308c\u3060\u3051\u3002<br \/>\n\u4ed6\u306e\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306e\u5834\u5408\u306f\u3001\u300cstadium\u300d\u3068\u306a\u3063\u3066\u3044\u308b\u3068\u3053\u308d\u3092\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u30b9\u30e9\u30c3\u30b0\u306b\u66f8\u304d\u63db\u3048\u3066\u3042\u3052\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<h2 id=\"step2\">WordPress\u306e\u7ba1\u7406\u753b\u9762\u3067\u5916\u90e8JS\u3092\u8aad\u307f\u8fbc\u3080<\/h2>\n<p>Javascript\u306f\u66f8\u3051\u307e\u3057\u305f\u304c\u3001\u7ba1\u7406\u753b\u9762\u3067\u5229\u7528\u3059\u308b\u306e\u3067\u3001\u7ba1\u7406\u753b\u9762\u3067\u3053\u306eJS\u3092\u8aad\u307f\u8fbc\u3080\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u305d\u306e\u305f\u3081\u306b\u3001\u307e\u305a\u306f\u3053\u306e\u30b3\u30fc\u30c9\u3092\u300ccheck2select.js\u300d\u3068\u304b\u306a\u3093\u3067\u3082\u3044\u3044\u3093\u3067\u4fdd\u5b58\u3057\u3066\u3001\u30b5\u30fc\u30d0\u30fc\u306b\u30a2\u30c3\u30d7\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u50d5\u306f\u30c6\u30fc\u30de\u30d5\u30a1\u30a4\u30eb\u5185\u306b\u5165\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u8aad\u307f\u8fbc\u3080\u306b\u306ffunctions.php\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<p>[php]<br \/>\nfunction srip_check2select_script(){<br \/>\n    if( get_post_type() === &#8216;post&#8217; ){<br \/>\n        wp_enqueue_script( &#8216;srip_check2select_script&#8217;, get_template_directory_uri().&#8217;\/js\/check2select.js&#8217;);<br \/>\n    }<br \/>\n}<br \/>\nadd_action(&#8220;admin_head-post-new.php&#8221;, &#8220;srip_check2select_script&#8221;);<br \/>\nadd_action(&#8220;admin_head-post.php&#8221;, &#8220;srip_check2select_script&#8221;);<br \/>\n[\/php]<\/p>\n<p>\u3053\u308c\u3067\u3001\u5148\u307b\u3069\u306eJS\u3092\u8aad\u307f\u8fbc\u3081\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u300cadmin_head-post-new.php\u300d\u3068\u300cadmin_head-post.php\u300d\u306f\u898b\u3066\u306e\u901a\u308a\u306a\u3093\u3067\u3059\u304c\u3001\u65b0\u898f\u6295\u7a3f\u306e\u5834\u5408\u3068\u7de8\u96c6\u3084\u4e0b\u66f8\u304d\u3057\u305f\u5834\u5408\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u304c\u30bb\u30ec\u30af\u30c8\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<figure><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.sriproot.net\/blog\/wp\/wp-content\/uploads\/2017\/03\/check2select001.png\" alt=\"\" width=\"760\" height=\"269\" class=\"aligncenter size-full wp-image-1407\" \/><\/figure>\n<p>\u76ee\u7684\u9054\u6210\u3002\u3081\u3067\u305f\u3057\u3081\u3067\u305f\u3057\u3002<\/p>\n<h2 id=\"step3\">\u307e\u3068\u3081<\/h2>\n<p>\u81ea\u5206\u3060\u3051\u3067\u66f4\u65b0\u3059\u308b\u3082\u306e\u3067\u3042\u308c\u3070\u3001\u81ea\u5206\u3067\u3044\u308d\u3044\u308d\u6ce8\u610f\u3057\u305f\u308a\u5de5\u592b\u3057\u305f\u308a\u3059\u308c\u3070\u3044\u3044\u3060\u3051\u3067\u3059\u304c\u3001\u3042\u3093\u307e\u308aWordPress\u306b\u6163\u308c\u3066\u306a\u3044\u4eba\u304c\u7de8\u96c6\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u3068\u304d\u306f\u3001\u3053\u3046\u3044\u3063\u305f\u7d30\u304b\u3044\u7ba1\u7406\u753b\u9762\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u304c\u5fc5\u8981\u3067\u3059\u306d\u3002<\/p>\n<p>\u5c11\u3057\u3067\u3082\u6295\u7a3f\u306b\u95a2\u3059\u308b\u969c\u5bb3\u3092\u6e1b\u3089\u3057\u3066\u3042\u3052\u3066\u3001\u6c17\u6301\u3061\u3088\u304f\u6295\u7a3f\u3067\u304d\u308b\u74b0\u5883\u3065\u304f\u308a\u3092\u3057\u3066\u3042\u3052\u308b\u601d\u3044\u3084\u308a\u306e\u5fc3\u304c\u91cd\u8981\u3067\u3059\u3088\u306d\u3002<\/p>\n<p>\u305d\u3044\u304e\uff5e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WBC\u307f\u3066\u308b\u3068\u3001\u5c11\u5e74\u91ce\u7403\u3084\u3063\u3066\u308b\u5b50\u305f\u3061\u3082\u3057\u3063\u304b\u308a\u307f\u3066\u6b32\u3057\u3044\u3068\u3064\u304f\u3065\u304f\u601d\u3044\u307e\u3059\u3002 &#8230;<\/p>\n","protected":false},"author":2,"featured_media":1409,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[28],"tags":[224],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/posts\/1406"}],"collection":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/comments?post=1406"}],"version-history":[{"count":0,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/posts\/1406\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/media\/1409"}],"wp:attachment":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/media?parent=1406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/categories?post=1406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/tags?post=1406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}