{"id":11680512,"date":"2022-09-29T17:16:18","date_gmt":"2022-09-29T08:16:18","guid":{"rendered":"https:\/\/ja.wordpress.org\/support\/topic\/%e9%9a%8e%e5%b1%a4%e8%a1%a8%e7%a4%ba%e3%81%ae%e6%95%b0%e5%ad%97%e3%81%8c%e8%a1%a8%e7%a4%ba%e3%81%95%e3%82%8c%e3%81%aa%e3%81%84%ef%bc%88%e3%82%b7%e3%83%a7%e3%83%bc%e3%83%88%e3%82%b3%e3%83%bc%e3%83%89\/"},"modified":"2022-09-29T17:16:49","modified_gmt":"2022-09-29T08:16:49","slug":"%e9%9a%8e%e5%b1%a4%e8%a1%a8%e7%a4%ba%e3%81%ae%e6%95%b0%e5%ad%97%e3%81%8c%e8%a1%a8%e7%a4%ba%e3%81%95%e3%82%8c%e3%81%aa%e3%81%84%ef%bc%88%e3%82%b7%e3%83%a7%e3%83%bc%e3%83%88%e3%82%b3%e3%83%bc%e3%83%89","status":"publish","type":"topic","link":"https:\/\/ja.wordpress.org\/support\/topic\/%e9%9a%8e%e5%b1%a4%e8%a1%a8%e7%a4%ba%e3%81%ae%e6%95%b0%e5%ad%97%e3%81%8c%e8%a1%a8%e7%a4%ba%e3%81%95%e3%82%8c%e3%81%aa%e3%81%84%ef%bc%88%e3%82%b7%e3%83%a7%e3%83%bc%e3%83%88%e3%82%b3%e3%83%bc%e3%83%89\/","title":{"rendered":"\u968e\u5c64\u8868\u793a\u306e\u6570\u5b57\u304c\u8868\u793a\u3055\u308c\u306a\u3044\uff08\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\uff09"},"content":{"rendered":"<p>\u73fe\u5728\u3001\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u3092\u7528\u3044\u3066\u5927\u4e2d\u5c0f\u306e\u968e\u5c64\u304c\u3042\u308b\u898b\u51fa\u3057\u3092\u4f5c\u6210\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u5927\u4e2d\u5c0f\u306e\u533a\u5225\u306f\u3001h3~h5\u3092\u7528\u3044\u3066\u5dee\u5225\u5316\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u5404\u968e\u5c64\u8981\u7d20\u306e\u5de6\u5074\u306b\u306f\u3001\u968e\u5c64\u3092\u793a\u3059\u6570\u5b57\u3092\u8868\u793a\u3055\u305b\u305f\u3044\u3068\u8003\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><strong>\u3010\u7406\u60f3\u5f62\u30a4\u30e1\u30fc\u30b8\u3011<br \/>\n1.\u5927\u898b\u51fa\u3057\uff11<br \/>\n\u3000\u3000\u30001-1\u4e2d\u898b\u51fa\u3057\uff11<br \/>\n\u3000\u3000\u30001-2\u4e2d\u898b\u51fa\u3057\uff12<br \/>\n\u3000\u3000\u3000\u3000\u3000\u30001-2-1\u5c0f\u898b\u51fa\u3057\uff11<\/strong><\/p>\n<p>\u305d\u3053\u3067\u3001\u4e0b\u8a18\u306e\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066\u308b\u306e\u3067\u3059\u304c\u3001\u5927\u898b\u51fa\u3057\u3057\u304b\u968e\u5c64\u3092\u793a\u3059\u6570\u5b57\u304c\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002\uff08<a href=\"https:\/\/d.kuku.lu\/02f196dd7\">\u73fe\u72b6\u306e\u5199\u771f<\/a>\uff09<\/p>\n<pre><code>\/\/\u4ee5\u4e0b\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\nfunction mokuji_contents() {\n    $sr_data = get_post_meta(get_the_ID(), &#039;custom_mokuji&#039;);\n    $custom_mokuji_data = unserialize($sr_data[0]);\n    $comment = $_POST[&quot;title&quot;];\n    \/\/var_dump($comment);\n\nif($custom_mokuji_data[&#039;mokuji_ck&#039;]) {\n    $script = &#039;&lt;script&gt;&#039; . PHP_EOL .&#039;jQuery(window).on(&quot;load&quot;, function(){&#039; . PHP_EOL;\n    $script .= &#039;var contents_html = jQuery(&quot;div#contents&quot;).contents();&#039; . PHP_EOL;\n    $script .= &#039;var loop_content = contents_html.find(&quot;article div.subpagecontents&quot;).children();&#039; . PHP_EOL;\n    $script .= &#039;var new_list_html = &quot;&quot;, main_html = &quot;&quot;, id_text = &quot;h&quot;, h3id = 0, h4id = 0, h5id = 1, h3ul = 0, h4ul = 0, h5ul = 0;&#039; . PHP_EOL;\n    $script .= &#039;jQuery.each(loop_content, function(index, elem) {&#039; . PHP_EOL;\n    $script .= &#039;if(jQuery(elem).is(&quot;h3&quot;) || jQuery(elem).is(&quot;h4&quot;) || jQuery(elem).is(&quot;h5&quot;)) { jQuery(elem).removeAttr(&quot;id&quot;); }&#039; . PHP_EOL;\n\/\/\u5927\u898b\u51fa\u3057\n    if($custom_mokuji_data[&#039;mokuji_o&#039;]) {\n    $script .= &#039;if(jQuery(elem).is(&quot;h3&quot;)){&#039; . PHP_EOL;\n    $script .= &#039;if (h5ul == 1) { new_list_html = new_list_html + &quot;&lt;\/ul&gt;\\n&quot;;&#039; . PHP_EOL;\/\/\u76f4\u524d\u304ch5\u30bf\u30b0\n    $script .= &#039;h5ul = 0};&#039; . PHP_EOL;\n    $script .= &#039;if (h4ul == 1) { new_list_html = new_list_html + &quot;&lt;\/li&gt;\\n&lt;\/ul&gt;\\n&quot;;&#039; . PHP_EOL;\/\/\u76f4\u524d\u304ch4\u30bf\u30b0\n    $script .= &#039;h4ul = 0};&#039; . PHP_EOL;\n    $script .= &#039;h3id++;&#039; . PHP_EOL;\n    $script .= &#039;jQuery(elem).attr(&quot;id&quot;, id_text + h3id);&#039; . PHP_EOL;\/\/\u5927\u898b\u51fa\u3057\u306bid\u4ed8\u4e0e\n    $script .= &#039;if (h3id == 1) { new_list_html = new_list_html + &quot;&lt;ul&gt;\\n&quot;;&#039; . PHP_EOL;\n    $script .= &#039;h3ul = 1}else { new_list_html = new_list_html + &quot;&lt;\/li&gt;\\n&quot;}&#039; . PHP_EOL;\n    $script .= &#039;new_list_html = new_list_html + &quot;&lt;li&gt;&lt;a href=\\&quot;#&quot;+id_text+h3id+&quot;\\&quot;&gt;&quot; + jQuery(elem).text() + &quot;&lt;\/a&gt;&quot;&#039; . PHP_EOL;\n    $script .= &#039;h4id = 0, h5id = 1;&#039; . PHP_EOL;\n    $script .= &#039;};&#039; . PHP_EOL;\n    }\n\n\/\/\u4e2d\u898b\u51fa\u3057\n    if($custom_mokuji_data[&#039;mokuji_tyu&#039;]) {\n    $script .= &#039;if(jQuery(elem).is(&quot;h4&quot;)){&#039; . PHP_EOL;\n    $script .= &#039;if (h5ul == 1) { new_list_html = new_list_html + &quot;&lt;\/ul&gt;\\n&quot;;&#039; . PHP_EOL;\/\/\u76f4\u524d\u304ch5\u30bf\u30b0\n    $script .= &#039;h5ul = 0};&#039; . PHP_EOL;\n    $script .= &#039;h4id++;&#039; . PHP_EOL;\n    $script .= &#039;jQuery(elem).attr(&quot;id&quot;, id_text + h3id + &quot;-&quot; + h4id);&#039; . PHP_EOL;\/\/\u4e2d\u898b\u51fa\u3057\u306bid\u4ed8\u4e0e\n    $script .= &#039;if (h4id == 1) { new_list_html = new_list_html + &quot;&lt;ul&gt;\\n&quot;;&#039; . PHP_EOL;\n    $script .= &#039;h4ul = 1}else { new_list_html = new_list_html + &quot;&lt;\/li&gt;\\n&quot;}&#039; . PHP_EOL;\n    $script .= &#039;new_list_html = new_list_html + &quot;&lt;li&gt;&lt;a href=\\&quot;#&quot;+id_text+h3id+&quot;-&quot;+h4id+&quot;\\&quot;&gt;&quot; + jQuery(elem).text() + &quot;&lt;\/a&gt;&quot;&#039; . PHP_EOL;\n    $script .= &#039;h5id = 1;&#039; . PHP_EOL;\n    $script .= &#039;};&#039; . PHP_EOL;\n    }\n\n\/\/\u5c0f\u898b\u51fa\u3057\n    if($custom_mokuji_data[&#039;mokuji_sho&#039;]) {\n    $script .= &#039;if(jQuery(elem).is(&quot;h5&quot;)){&#039; . PHP_EOL;\n    $script .= &#039;jQuery(elem).attr(&quot;id&quot;, id_text + h3id + &quot;-&quot; + h4id + &quot;-&quot; + h5id);&#039; . PHP_EOL;\/\/\u5c0f\u898b\u51fa\u3057\u306bid\u4ed8\u4e0e\n    $script .= &#039;if (h5id == 1) { new_list_html = new_list_html + &quot;&lt;ul&gt;\\n&quot;;&#039; . PHP_EOL;\n    $script .= &#039;h5ul = 1};&#039; . PHP_EOL;\n    $script .= &#039;new_list_html = new_list_html + &quot;&lt;li&gt;&lt;a href=\\&quot;#&quot;+id_text+h3id+&quot;-&quot;+h4id+&quot;-&quot;+h5id+&quot;\\&quot;&gt;&quot; + jQuery(elem).text() + &quot;&lt;\/a&gt;&lt;\/li&gt;\\n&quot;&#039; . PHP_EOL;\n    $script .= &#039;h5id++;&#039; . PHP_EOL;\n    $script .= &#039;};&#039; . PHP_EOL;\n    }\n    $script .= &#039;});&#039; . PHP_EOL;\/\/\u30eb\u30fc\u30d7\u7d42\u4e86\n\/\/\u8db3\u308a\u306a\u3044\u9589\u3058\u30bf\u30b0\u8ffd\u52a0\n    $script .= &#039;if (h5ul == 1) { new_list_html = new_list_html + &quot;&lt;\/ul&gt;\\n&quot;; }&#039; . PHP_EOL;\n    $script .= &#039;if (h4ul == 1) { new_list_html = new_list_html + &quot;&lt;\/li&gt;\\n&lt;\/ul&gt;\\n&quot;; }&#039; . PHP_EOL;\n    $script .= &#039;if (h3ul == 1) { new_list_html = new_list_html + &quot;&lt;\/li&gt;\\n&lt;\/ul&gt;\\n&quot;; }&#039; . PHP_EOL;\n    $script .= &#039;if( new_list_html != &quot;&quot; ){&#039; . PHP_EOL;\n    $script .= &#039;new_list_html = &quot;&lt;div id=\\&quot;index_list\\&quot;&gt;\\n&quot; + new_list_html + &quot;&lt;\/div&gt;\\n&quot;;&#039; . PHP_EOL;\n    $script .= &#039;};&#039; . PHP_EOL;\n\/\/\u6570\u5b57\u5f62\u5f0f\u306b\u7f6e\u304d\u63db\u3048\n    if($custom_mokuji_data[&#039;list_type&#039;] == &quot;\u6570\u5b57\u5f62\u5f0f&quot;){\n    $script .= &#039;new_list_html = new_list_html.replace( \/ul\/g, &quot;ol&quot; );&#039; . PHP_EOL;\n    }\n\/\/\u76ee\u6b21\u8ffd\u52a0\n    $script .= &#039;if( new_list_html != &quot;&quot; ){&#039; . PHP_EOL;\n    $script .= &#039;var subpagecontents = contents_html.find(&quot;article div.subpagecontents&quot;).html();&#039; . PHP_EOL;\n    $script .= &#039;subpagecontents = new_list_html + &quot;\\n&quot; + subpagecontents;&#039; . PHP_EOL;\n    $script .= &#039;contents_html.find(&quot;article div.subpagecontents&quot;).html( subpagecontents );&#039; . PHP_EOL;\n    $script .= &#039;};&#039; . PHP_EOL;\n    if($custom_mokuji_data[&#039;list_type&#039;] == &quot;\u6570\u5b57\u5f62\u5f0f&quot;){\n    $script .= &#039;var style = &quot;&quot;;&#039; . PHP_EOL;\n    $script .= &#039;style += &quot;&lt;style type=\\&quot;text\/css\\&quot; id=\\&quot;StyleId\\&quot;&gt;&quot;;&#039; . PHP_EOL;\n    $script .= &#039;style += &quot;ol { counter-reset: item; }&quot;;&#039; . PHP_EOL;\n    $script .= &#039;style += &quot;li { display: block; }&quot;;&#039; . PHP_EOL;\n    $script .= &#039;style += &quot;ol&gt;li:before { counter-increment : item; content: counters(item, \\&quot;-\\&quot;) \\&quot;. \\&quot;; }&quot;;&#039; . PHP_EOL;\n    $script .= &#039;style += &quot;&lt;\/style&gt;&quot;;&#039; . PHP_EOL;\n    $script .= &#039;jQuery(&quot;head&quot;).append(style);&#039; . PHP_EOL;\n    }\n\n    $script .= &#039;})&#039; . PHP_EOL;\n    $script .= &#039;&lt;\/script&gt;&#039; . PHP_EOL;\n}\n\treturn $script;\n}\nadd_shortcode(&#039;mokuji&#039;, &#039;mokuji_contents&#039;);<\/code><\/pre>\n<p>li\u30bf\u30b0\u3001ol\u30bf\u30b0\u306e\u4f4d\u7f6e\u304c\u304a\u304b\u3057\u3044\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<br \/>\n\u81ea\u5206\u3067\u4f5c\u6210\u3057\u305f\u30b3\u30fc\u30c9\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u539f\u56e0\u304c\u308f\u304b\u3089\u305a\u884c\u304d\u8a70\u3063\u3066\u304a\u308a\u307e\u3059\u3002<br \/>\n\u305d\u306e\u305f\u3081\u3001\u3053\u306e\u554f\u984c\u306b\u3064\u3044\u3066\u306e\u89e3\u6c7a\u65b9\u6cd5\u3092\u3054\u6559\u793a\u9802\u304d\u305f\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"template":"","class_list":["post-11680512","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11680512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11680512\/revisions"}],"predecessor-version":[{"id":11680513,"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11680512\/revisions\/11680513"}],"wp:attachment":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=11680512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}