{"id":565,"date":"2022-04-12T14:52:47","date_gmt":"2022-04-12T05:52:47","guid":{"rendered":"https:\/\/motoki-design.co.jp\/wordpress\/?p=565"},"modified":"2024-09-05T15:15:24","modified_gmt":"2024-09-05T06:15:24","slug":"swell-back-toc","status":"publish","type":"post","link":"https:\/\/motoki-design.co.jp\/wordpress\/swell-back-toc\/","title":{"rendered":"SWELL\u2502\u300c\u76ee\u6b21\u3078\u623b\u308b\u300d\u306e\u30a2\u30f3\u30ab\u30fc\u30ea\u30f3\u30af\u3092\u81ea\u52d5\u633f\u5165\u3059\u308b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba"},"content":{"rendered":"\n<p>\u6709\u540d\u30d6\u30ed\u30ac\u30fc\u3055\u3093\u306e\u30d6\u30ed\u30b0\u3067\u3001h2\u30bf\u30b0\u306b\u300c<strong>\u76ee\u6b21\u3078\u623b\u308b<\/strong>\u300d\u306e\u30a2\u30f3\u30ab\u30fc\u30ea\u30f3\u30af\u304c\u3042\u308b\u306e\u3092\u898b\u305f\u3053\u3068\u304c\u306a\u3044\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n\n\n\n<p>\u76ee\u6b21\u3068\u95b2\u89a7\u3057\u305f\u3044\u9805\u76ee\u3068\u3092\u884c\u304d\u6765\u3067\u304d\u308b\u30a2\u30f3\u30ab\u30fc\u30ea\u30f3\u30af\u306f\u30e6\u30fc\u30b6\u30fc\u30d3\u30ea\u30c6\u30a3\u3092\u5411\u4e0a\u3055\u305b\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u672c\u8a18\u4e8b\u3067\u306fSWELL\u7528\u306bh2\u30bf\u30b0\u4e0a\u306b\u300c\u76ee\u6b21\u306b\u623b\u308b\u300d\u306e\u30a2\u30f3\u30ab\u30fc\u30ea\u30f3\u30af\u3092\u81ea\u52d5\u633f\u5165\u3059\u308b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u306e\u3067\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u300c\u76ee\u6b21\u306b\u623b\u308b\u300d\u306e\u30a2\u30f3\u30ab\u30fc\u30ea\u30f3\u30af\u3092\u81ea\u52d5\u633f\u5165\u3059\u308b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba<\/h2>\n\n\n\n<p>\u300c\u76ee\u6b21\u306b\u623b\u308b\u300d\u306e\u30a2\u30f3\u30ab\u30fc\u30ea\u30f3\u30af\u3092\u81ea\u52d5\u633f\u5165\u3059\u308b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306ffunctions.php\u3092\u30b3\u30fc\u30c9\u3092\u633f\u5165\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u3001\u8a73\u3057\u304f\u89e3\u8aac\u3044\u305f\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">functions.php\u306b\u30b3\u30fc\u30c9\u3092\u633f\u5165\u3059\u308b<\/h3>\n\n\n\n<p>\u30b3\u30fc\u30c9\u3092\u8a18\u8ff0\u3059\u308b\u5834\u6240\u306f\u4e0b\u8a18\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p><code class=\"dir_name\">WordPress\u306e\u7ba1\u7406\u753b\u9762 \uff1e \u5916\u89b3 \uff1e \u30c6\u30fc\u30de\u30d5\u30a1\u30a4\u30eb\u30a8\u30c7\u30a3\u30bf\u30fc \uff1e functions.php<\/code><\/p>\n\n\n\n<p>functions.php\u306b\u4e0b\u8a18\u306e\u30b3\u30fc\u30c9\u3092\u633f\u5165\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p>\u6295\u7a3f\u30da\u30fc\u30b8\u3068\u30ab\u30c6\u30b4\u30ea\u30fc\u30da\u30fc\u30b8\u306b\u3053\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u304c\u9069\u5fdc\u3067\u304d\u308b\u3088\u3046\u306b\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-group is-style-big_icon_memo\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<p>PHP8\u4ee5\u964d\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3044\u305f\u306e\u3067\u3001\u30b3\u30fc\u30c9\u3092\u4fee\u6b63\u3044\u305f\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>Warning: Undefined variable $m in \/home\/motoki\/motoki.wpx.jp\/public_html\/wp-content\/plugins\/code-snippets\/php\/snippet-ops.php(582) : eval()&#39;d code on line 12\n\nWarning: Trying to access array offset on value of type null in \/home\/motoki\/motoki.wpx.jp\/public_html\/wp-content\/plugins\/code-snippets\/php\/snippet-ops.php(582) : eval()&#39;d code on line 12<\/code><\/pre><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"is-style-border_left\">\u4fee\u6b63\u7248\u306e\u30b3\u30fc\u30c9\uff08PHP8\u3082\u5bfe\u5fdc\uff09<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-php\" data-file=\"functions.php\" data-lang=\"PHP\"><code>function motoki_back_toc( $content ){\n    if ( is_single() || is_category() ){\n        $back_toc = &#39;&lt;div class=&quot;back-toc&quot;&gt;&lt;a href=&quot;#mokuji&quot;&gt;\u21e7 \u76ee\u6b21\u306b\u623b\u308b&lt;\/a&gt;&lt;\/div&gt;&#39;;\n        $count = 0;\n        $content = preg_replace_callback(&#39;\/&lt;h2 *[^&gt;]*&gt;\/i&#39;, function( $m ) use (&$count, $back_toc) {\n            $count++;\n            if( $count == 1 ) {\n                return $m[0]; \n            } else {\n                return $back_toc.PHP_EOL.$m[0];\n            }\n        }, $content, -1);\n    }\n    return $content;\n}\nadd_filter(&#39;the_content&#39;,&#39;motoki_back_toc&#39;,999);\n\nfunction motoki_add_toc_id() {\n\techo &lt;&lt;&lt; EOM\n\t&lt;script&gt;\n\t\tvar tmp = document.getElementsByClassName(&quot;p-toc__ttl&quot;) ;\n\t\tvar val=&quot;mokuji&quot;;\n\t\ttry {\n\t\t  tmp[0].setAttribute(&quot;id&quot;,val);\n\t\t} catch (error) {\n\t}\n\t&lt;\/script&gt;\n\tEOM;\n\t}\nadd_action( &#39;wp_footer&#39;, &#39;motoki_add_toc_id&#39; );<\/code><\/pre><\/div>\n\n\n\n<p>\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306f\u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30b3\u30fc\u30c9\u633f\u5165\u5f8c\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u30af\u30ea\u30a2\u3057\u3066\u3001h2\u4e0a\u306b\u300c\u76ee\u6b21\u306b\u623b\u308b\u300d\u306e\u30a2\u30f3\u30ab\u30fc\u30ea\u30f3\u30af\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h2>\n\n\n\n<p>\u672c\u8a18\u4e8b\u3067\u306f\u300c\u76ee\u6b21\u306b\u623b\u308b\u300d\u306e\u30a2\u30f3\u30ab\u30fc\u30ea\u30f3\u30af\u3092\u81ea\u52d5\u633f\u5165\u3059\u308b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3092\u7d39\u4ecb\u3044\u305f\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3058\u3063\u304f\u308a\u8a18\u4e8b\u3092\u898b\u6bd4\u3079\u308b\u3068\u304d\u306f\u3001\u76ee\u6b21\u3068\u306e\u5404h2\u3078\u306e\u884c\u304d\u6765\u304c\u4fbf\u5229\u306b\u306a\u3063\u3066\u304d\u307e\u3059\u306e\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u30d3\u30ea\u30c6\u30a3\u3092\u3042\u3052\u308b\u305f\u3081\u306b\u3082\u662f\u975e\u5c0e\u5165\u3092\u691c\u8a0e\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u540d\u30d6\u30ed\u30ac\u30fc\u3055\u3093\u306e\u30d6\u30ed\u30b0\u3067\u3001h2\u30bf\u30b0\u306b\u300c\u76ee\u6b21\u3078\u623b\u308b\u300d\u306e\u30a2\u30f3\u30ab\u30fc\u30ea\u30f3\u30af\u304c\u3042\u308b\u306e\u3092\u898b\u305f\u3053\u3068\u304c\u306a\u3044\u3067\u3057\u3087\u3046\u304b\uff1f \u76ee\u6b21\u3068\u95b2\u89a7\u3057\u305f\u3044\u9805\u76ee\u3068\u3092\u884c\u304d\u6765\u3067\u304d\u308b\u30a2\u30f3\u30ab\u30fc\u30ea\u30f3\u30af\u306f\u30e6\u30fc\u30b6\u30fc\u30d3\u30ea\u30c6\u30a3\u3092\u5411\u4e0a\u3055\u305b\u307e\u3059\u3002 \u672c\u8a18\u4e8b\u3067\u306fSWELL\u7528\u306bh2 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":567,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pochipp_cv_data":"","swell_btn_cv_data":"","footnotes":""},"categories":[110],"tags":[],"area":[],"class_list":["post-565","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-swell-customize"],"_links":{"self":[{"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/posts\/565","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/comments?post=565"}],"version-history":[{"count":3,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/posts\/565\/revisions"}],"predecessor-version":[{"id":24636,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/posts\/565\/revisions\/24636"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/media\/567"}],"wp:attachment":[{"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/media?parent=565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/categories?post=565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/tags?post=565"},{"taxonomy":"area","embeddable":true,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/area?post=565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}