{"id":6122,"date":"2023-12-14T17:25:35","date_gmt":"2023-12-14T08:25:35","guid":{"rendered":"https:\/\/wpmake.jp\/contents\/?post_type=customize&#038;p=6122"},"modified":"2023-12-15T09:41:19","modified_gmt":"2023-12-15T00:41:19","slug":"use-code-patterns","status":"publish","type":"customize","link":"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/","title":{"rendered":"WordPress\u306e\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u4f5c\u6210\u65b9\u6cd5\u3092\u89e3\u8aac\uff01functions.php\u3068patterns\u30d5\u30a9\u30eb\u30c0\u3067\u306e\u5ba3\u8a00"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_71 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u76ee\u6b21<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #282828;color:#282828\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #282828;color:#282828\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#%E3%81%AF%E3%81%98%E3%82%81%E3%81%AB\" title=\"\u306f\u3058\u3081\u306b\">\u306f\u3058\u3081\u306b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#register_block_pattern\" title=\"register_block_pattern\">register_block_pattern<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#%E3%82%AB%E3%83%86%E3%82%B4%E3%83%AA%E3%83%BC%E3%81%AE%E4%BD%9C%E6%88%90\" title=\"\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u4f5c\u6210\">\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u4f5c\u6210<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#function_exists\" title=\"function_exists\">function_exists<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#register_block_pattern_category\" title=\"register_block_pattern_category\">register_block_pattern_category<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#i\" title=\"__()\">__()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#add_action\" title=\"add_action\">add_action<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#%E9%9D%9E%E5%90%8C%E6%9C%9F%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3%E3%81%AE%E4%BD%9C%E6%88%90\" title=\"\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u306e\u4f5c\u6210\">\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u306e\u4f5c\u6210<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#Hi_everyone\" title=\"Hi everyone\">Hi everyone<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#register_block_pattern-2\" title=\"register_block_pattern\">register_block_pattern<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#%E5%8F%82%E8%80%83%E7%94%BB%E5%83%8F\" title=\"\u53c2\u8003\u753b\u50cf\">\u53c2\u8003\u753b\u50cf<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#patterns%E3%83%95%E3%82%A9%E3%83%AB%E3%83%80\" title=\"patterns\u30d5\u30a9\u30eb\u30c0\">patterns\u30d5\u30a9\u30eb\u30c0<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#patterns%E3%83%95%E3%82%A9%E3%83%AB%E3%83%80%E4%B8%8B%E3%81%ABPHP%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AE%E4%BD%9C%E6%88%90\" title=\"patterns\u30d5\u30a9\u30eb\u30c0\u4e0b\u306bPHP\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u6210\">patterns\u30d5\u30a9\u30eb\u30c0\u4e0b\u306bPHP\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u6210<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#PHP%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AB%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3%E3%81%AE%E8%A8%98%E8%BF%B0\" title=\"PHP\u30d5\u30a1\u30a4\u30eb\u306b\u30d1\u30bf\u30fc\u30f3\u306e\u8a18\u8ff0\">PHP\u30d5\u30a1\u30a4\u30eb\u306b\u30d1\u30bf\u30fc\u30f3\u306e\u8a18\u8ff0<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#Hi_everyone-2\" title=\"Hi everyone\">Hi everyone<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#%E3%81%BE%E3%81%A8%E3%82%81\" title=\"\u307e\u3068\u3081\">\u307e\u3068\u3081<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/wpmake.jp\/contents\/customize\/use-code-patterns\/#%E5%8F%82%E8%80%83%E8%A8%98%E4%BA%8B\" title=\"\u53c2\u8003\u8a18\u4e8b\">\u53c2\u8003\u8a18\u4e8b<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%E3%81%AF%E3%81%98%E3%82%81%E3%81%AB\"><\/span>\u306f\u3058\u3081\u306b<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\nWordPress\u3067\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u4f5c\u6210\u3059\u308b\u969b\u306b\u3001\u3042\u3089\u304b\u3058\u3081\u5229\u7528\u3059\u308b\u30d6\u30ed\u30c3\u30af\u3092\u307e\u3068\u3081\u3066\u304a\u304f\u3053\u3068\u304c\u3067\u304d\u308c\u3070\u4fbf\u5229\u3060\u3068\u601d\u3044\u307e\u305b\u3093\u304b\uff1f WordPress\u306b\u306f\u3001\u7279\u5b9a\u306e\u30d6\u30ed\u30c3\u30af\u3092\u767b\u9332\u3057\u3066\u5229\u7528\u3059\u308b\u300c\u30d1\u30bf\u30fc\u30f3\u300d\u3068\u3044\u3046\u6a5f\u80fd\u304c\u3042\u308a\u3001 \u4f5c\u6210\u65b9\u6cd5\u306f\u4ee5\u4e0b\u306e3\u7a2e\u985e\u3067\u3059\u3002\r\n\r\n<ol>\r\n    <li>\u30d6\u30ed\u30c3\u30af\u30a8\u30c7\u30a3\u30bf\u3092\u5229\u7528\u3059\u308b<\/li>\r\n    <li>register_block_pattern\u3092functions.php\u306b\u8a18\u8f09\u3059\u308b<\/li>\r\n    <li>\u30c6\u30fc\u30de\u306e\u30eb\u30fc\u30c8\u306b\u3042\u308bpatterns\u30d5\u30a9\u30eb\u30c0\u4e0b\u306bPHP\u30d5\u30a1\u30a4\u30eb\u3067\u5ba3\u8a00\u3059\u308b<\/li>\r\n<\/ol>\r\n\r\n\u524d\u7de8\u3067\u306f\u521d\u5fc3\u8005\u3067\u3082\u7c21\u5358\u306b\u3067\u304d\u308b\u30011\u756a\u306e<a href=\"https:\/\/wpmake.jp\/contents\/customize\/block-patterns\/\">\u30d6\u30ed\u30c3\u30af\u30a8\u30c7\u30a3\u30bf<\/a>\u3092\u5229\u7528\u3057\u305f\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\uff08\u65e7\uff1a\u30d6\u30ed\u30c3\u30af\u30d1\u30bf\u30fc\u30f3\uff09\u306e\u4f5c\u6210\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u307e\u3057\u305f\u3002 \u4eca\u56de\u306f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u77e5\u8b58\u3092\u5fc5\u8981\u3068\u3059\u308b\u30012,3\u756a\u306ePHP\u3092\u5229\u7528\u3057\u305f\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u306e\u4f5c\u6210\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002\r\n\r\n<h2><span class=\"ez-toc-section\" id=\"register_block_pattern\"><\/span>register_block_pattern<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n1\u3064\u76ee\u306e\u65b9\u6cd5\u3068\u3057\u3066register_block_pattern\u3092\u5229\u7528\u3057\u305f\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u5927\u307e\u304b\u306a\u65b9\u91dd\u306f\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\u3002\r\n\r\n<ol>\r\n    <li>\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u4f5c\u6210<\/li>\r\n    <li>\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u306e\u4f5c\u6210<\/li>\r\n<\/ol>\r\n\r\n\u305d\u306e\u969b\u306b<a href=\"https:\/\/wpmake.jp\/contents\/security\/white_screen\/functions\/\">functions.php<\/a>\u3092\u4fee\u6b63\u3057\u307e\u3059\u304c\u3001\u5c0f\u3055\u306a\u30df\u30b9\u304c\u6df1\u523b\u306a\u30a8\u30e9\u30fc\u306b\u7e4b\u304c\u308a\u3084\u3059\u3044\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u306e\u3067\u3001\u4f5c\u696d\u3059\u308b\u969b\u306b\u306f\u5fc5\u305a\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u308b\u3088\u3046\u5fc3\u304c\u3051\u307e\u3057\u3087\u3046\u3002\r\n\r\n<h3><span class=\"ez-toc-section\" id=\"%E3%82%AB%E3%83%86%E3%82%B4%E3%83%AA%E3%83%BC%E3%81%AE%E4%BD%9C%E6%88%90\"><\/span>\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u4f5c\u6210<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\u307e\u305a\u306fregister_block_pattern_category\u3092\u4f7f\u3063\u3066\u30ab\u30c6\u30b4\u30ea\u30fc\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u30ab\u30c6\u30b4\u30ea\u30fc\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3067\u3001\u30d1\u30bf\u30fc\u30f3\u3092\u5229\u7528\u3059\u308b\u3068\u304d\u306b\u7c21\u5358\u306b\u898b\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u306a\u304a\u3001\u30ab\u30c6\u30b4\u30ea\u3092\u767b\u9332\u3057\u306a\u3044\u5834\u5408\u306f\u300c\u672a\u5206\u985e\u300d\u3068\u3057\u3066\u767b\u9332\u3055\u308c\u307e\u3059\u3002\r\n\r\n<pre>\r\n    \/\/\u30ab\u30c6\u30b4\u30ea\u30fc\u4f5c\u6210\r\n\r\n    if ( function_exists( 'register_block_pattern_category' ) ) {\r\n        function my_register_pattern_category() {\r\n            register_block_pattern_category(\r\n                'my-pattern-category',\r\n                array(\r\n                    'label' => __( 'My Pattern Category', 'my-plugin-text-domain' ),\r\n                    'description' => __( 'Colored h2 tags and p tags' ),\r\n                )\r\n            );\r\n        }\r\n        add_action( 'init', 'my_register_pattern_category' );\r\n    }\r\n<\/pre>\r\n\r\n\u3044\u304f\u3064\u304b\u95a2\u6570\u304c\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u30011\u3064\u305a\u3064\u8aac\u660e\u3057\u307e\u3059\u3002\r\n\r\n<h4><span class=\"ez-toc-section\" id=\"function_exists\"><\/span><a href=\"https:\/\/www.php.net\/manual\/ja\/function.function-exists.php\" rel=\"noopener\" target=\"_blank\">function_exists<\/a><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n\u6307\u5b9a\u3057\u305f\u95a2\u6570\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306b true \u3092\u8fd4\u3057\u3001\u305d\u308c\u4ee5\u5916\u306e\u5834\u5408\u306bfalse\u3092\u8fd4\u3059\u95a2\u6570\u3067\u3059\u3002\u4eca\u56de\u306f\u3001register_block_pattern_category\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3059\u3002\u30d1\u30bf\u30fc\u30f3\u4f5c\u6210\u306b\u76f4\u63a5\u306e\u95a2\u4fc2\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001functinos.php\u5185\u3067\u306e\u30a8\u30e9\u30fc\u3092\u4e88\u9632\u3059\u308b\u610f\u5473\u3067\u8a18\u8ff0\u3059\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002\r\n\r\n<pre>function_exists(string $function): bool<\/pre>\r\n<h4><span class=\"ez-toc-section\" id=\"register_block_pattern_category\"><\/span><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/register_block_pattern_category\/\" rel=\"noopener\" target=\"_blank\">register_block_pattern_category<\/a><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n\u30d1\u30bf\u30fc\u30f3\u30ab\u30c6\u30b4\u30ea\u30fc\u304c\u6b63\u5e38\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306b true \u3092\u8fd4\u3057\u3001\u30a8\u30e9\u30fc\u306e\u5834\u5408\u306ffalse\u3092\u8fd4\u3059\u95a2\u6570\u3067\u3059\u3002\u7b2c1\u5f15\u6570\u3067\u767b\u9332\u3059\u308b\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u540d\u524d\u3001\u7b2c2\u5f15\u6570\u3067\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u914d\u5217\u3067\u53d7\u3051\u53d6\u308a\u307e\u3059\u3002\u4eca\u56de\u306e\u7b2c2\u5f15\u6570\u306b\u306f\u3001\u5fc5\u9808\u3067\u3042\u308blabel( \u8868\u793a\u3055\u308c\u308b\u30d1\u30bf\u30fc\u30f3\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u540d\u524d)\u3068\u3001description\u3067\u30d1\u30bf\u30fc\u30f3\u306e\u8a73\u7d30\u3092\u8a18\u8ff0\u3057\u3066\u3044\u307e\u3059\u3002\u4ed6\u306b\u3082\u5fc5\u8981\u306a\u60c5\u5831\u304c\u3042\u308c\u3070\u3001\u968f\u6642\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002\r\n\r\n<pre>register_block_pattern_category( string $category_name, array $category_properties ): bool<\/pre>\r\n\r\n<h4><span class=\"ez-toc-section\" id=\"i\"><\/span><a target=\"_blank\" rel=\"noopener\">__()<\/a><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n\u7ffb\u8a33\u304c\u306a\u3044\u5834\u5408\u3001\u307e\u305f\u306f\u30c6\u30ad\u30b9\u30c8\u30c9\u30e1\u30a4\u30f3\u304c\u8aad\u307f\u8fbc\u307e\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u7b2c1\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u30c6\u30ad\u30b9\u30c8\u304c\u8fd4\u3055\u308c\u308b\u95a2\u6570\u3067\u3059\u3002<strong>\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a22\u3064<\/strong>\u3067\u3059\u306e\u3067\u3001\u30b3\u30d4\u30da\u3059\u308b\u969b\u306f\u6c17\u3092\u4ed8\u3051\u3066\u304f\u3060\u3055\u3044\u3002\r\n\r\n<pre>__( \"\u5fc5\u9808\" string $text, string $domain = 'default' ): \u6587\u5b57\u5217<\/pre>\r\n\r\n<h4><span class=\"ez-toc-section\" id=\"add_action\"><\/span><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/add_action\/\" rel=\"noopener\" target=\"_blank\">add_action<\/a><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n4\u3064\u306e\u5f15\u6570\u3092\u53d7\u3051\u53d6\u308b\u3053\u3068\u3067\u7279\u5b9a\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3001\u5834\u6240\u3067\u4efb\u610f\u306e\u64cd\u4f5c\u3092\u5b9f\u884c\u3067\u304d\u308b\u95a2\u6570\u3067\u3059\u3002\u7b2c1\u5f15\u6570\u3067\u30d5\u30c3\u30af\u3055\u305b\u305f\u3044\u30bf\u30a4\u30df\u30f3\u30b0\u3001\u5834\u6240\u3001\u7b2c2\u5f15\u6570\u3067\u5b9f\u884c\u3055\u305b\u305f\u3044\u95a2\u6570\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u4eca\u56de\u5b9f\u884c\u3055\u305b\u305f\u3044\u95a2\u6570\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u95a2\u6570\u306eregister_pattern_category\u3067\u3059\u306e\u3067\u3001\u7b2c2\u5f15\u6570\u306b\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u7b2c3\u5f15\u6570\u306f\u512a\u5148\u9806\u4f4d\u3001\u7b2c4\u5f15\u6570\u306f\u540c\u6642\u306b\u5b9f\u884c\u3057\u305f\u3044\u95a2\u6570\u306e\u6570\u306b\u306a\u308a\u3001\u305d\u308c\u305e\u308c\u521d\u671f\u5024\u304c\u5165\u3063\u3066\u3044\u307e\u3059\u3002\u5fc5\u9808\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u306f\u306a\u3044\u306e\u3067\u4eca\u56de\u306f\u8a18\u8ff0\u3057\u3066\u3044\u307e\u305b\u3093\u3002\r\n\r\n<pre>add_action(\"\u5fc5\u9808\" string $hook_name, \"\u5fc5\u9808\" callable $callback, int $priority = 10, int $accepted_args = 1 ): true<\/pre>\r\n\r\n<h3><span class=\"ez-toc-section\" id=\"%E9%9D%9E%E5%90%8C%E6%9C%9F%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3%E3%81%AE%E4%BD%9C%E6%88%90\"><\/span>\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u306e\u4f5c\u6210<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\u6b21\u306bregister_block_pattern\u3092\u5229\u7528\u3057\u3066\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\r\n\r\n<pre>\r\n    \/\/\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u306e\u4f5c\u6210\r\n\r\n    if ( function_exists( 'register_block_pattern' ) ) {\r\n        function my_plugin_register_block_pattern() {\r\n            register_block_pattern(\r\n                'First\/my-block-pattern',\r\n                array(\r\n                    'title'\t\t\t=> __( 'First pattern', 'my-plugin-text-domain' ),\r\n                    'categories'\t=> array( 'my-pattern-category' ),\r\n                    'content'\t\t=>\r\n                    '\r\n                    <div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\r\n                    \r\n                    <h2 class=\"has-large-font-size wp-block-heading\"><span class=\"ez-toc-section\" id=\"Hi_everyone\"><\/span><span style=\"color:#ba0c49\" class=\"has-inline-color\">Hi everyone<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n                    \r\n                    \r\n                    <p class=\"has-white-color has-black-background-color has-text-color has-background\">Powered by WordPress<\/p>\r\n                    \r\n                    <\/div><\/div>',\r\n        )\r\n            );\r\n        }\r\n        add_action( 'init', 'my_plugin_register_block_pattern' );\r\n    }\r\n<\/pre>\r\n\r\n\u4e0a\u8a18\u3067\u8aac\u660e\u3057\u3066\u3044\u306a\u3044\u95a2\u6570\u3092\u8aac\u660e\u3057\u307e\u3059\u3002\r\n\r\n<h4><span class=\"ez-toc-section\" id=\"register_block_pattern-2\"><\/span><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/register_block_pattern\/\" rel=\"noopener\" target=\"_blank\">register_block_pattern<\/a><span class=\"ez-toc-section-end\"><\/span><\/h4>\r\n2\u3064\u306e\u5f15\u6570\u3092\u53d7\u3051\u53d6\u308b\u3053\u3068\u3067\u3001\u30d1\u30bf\u30fc\u30f3\u305d\u306e\u3082\u306e\u3092\u4f5c\u6210\u3059\u308b\u95a2\u6570\u3067\u3059\u3002\u7b2c1\u5f15\u6570\u306b\uff08namespace\/\u4efb\u610f\u306e\u30d1\u30bf\u30fc\u30f3\u306e\u540d\u524d\uff09\u3001\u7b2c2\u5f15\u6570\u306b\u30d1\u30bf\u30fc\u30f3\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u914d\u5217\u3067\u53d7\u3051\u53d6\u308a\u307e\u3059\u3002\u4eca\u56de\u7b2c2\u5f15\u6570\u306b\u306f3\u3064\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u6307\u5b9a\u3057\u307e\u3057\u305f\u3002\r\n\r\n<ul>\r\n    <li>\u3010\u5fc5\u9808\u3011title\uff1a\u30d1\u30bf\u30fc\u30f3\u306e\u540d\u524d\u3067\u3059\u3002\u7b2c1\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u3082\u306e\u3068\u306f\u307e\u305f\u5225\u3067\u3001\u3053\u3061\u3089\u304c\u30e6\u30fc\u30b6\u30fc\u306b\u8868\u793a\u3055\u308c\u308b\u3082\u306e\u3067\u3059\u3002<\/li>\r\n    <li>\u3010\u5fc5\u9808\u3011content\uff1a\u30d1\u30bf\u30fc\u30f3\u306e\u5185\u5bb9\u3092HTML\u5f62\u5f0f\u3067\u8a18\u8ff0\u3057\u307e\u3059\u3002\u6295\u7a3f\u753b\u9762\u304b\u3089\u30b3\u30d4\u30fc\u3057\u3066\u304f\u308b\u3068\u7c21\u5358\u306b\u30a2\u30ec\u30f3\u30b8\u3067\u304d\u307e\u3059\u3002<\/li>\r\n    <li>categories\uff1aregister_block_pattern\u3067\u4f5c\u6210\u3057\u305f\u30ab\u30c6\u30b4\u30ea\u30fc\u540d\u3092\u66f8\u304d\u307e\u3059\u3002<\/li>\r\n<\/ul>\r\n\r\n<pre>register_block_pattern( string $pattern_name, array $pattern_properties ): bool<\/pre>\r\n\r\n<h3><span class=\"ez-toc-section\" id=\"%E5%8F%82%E8%80%83%E7%94%BB%E5%83%8F\"><\/span>\u53c2\u8003\u753b\u50cf<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\u4ee5\u4e0a\u304cregister_block_pattern\u3092\u5229\u7528\u3057\u305f\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u306e\u4f5c\u6210\u306b\u306a\u308a\u307e\u3059\u3002\u5024\u3092\u5909\u66f4\u3057\u305f\u969b\u306b\u3069\u3053\u306b\u53cd\u6620\u3055\u308c\u308b\u306e\u304b\u3092\u691c\u8a3c\u3057\u3066\u9802\u3051\u308c\u3070\u3001\u4eca\u5f8c\u3082\u7c21\u5358\u306b\u30a2\u30ec\u30f3\u30b8\u304c\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u3002 \r\n\r\n\r\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/12\/reference-image1.png\" alt=\"\" width=\"4325\" height=\"2090\" class=\"aligncenter size-full wp-image-6124\" srcset=\"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/12\/reference-image1.png 2560w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/12\/reference-image1-300x145.png 300w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/12\/reference-image1-1024x495.png 1024w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/12\/reference-image1-768x371.png 768w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/12\/reference-image1-1536x742.png 1536w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/12\/reference-image1-2048x990.png 2048w\" sizes=\"(max-width: 4325px) 100vw, 4325px\" \/>\r\n\r\n<h2><span class=\"ez-toc-section\" id=\"patterns%E3%83%95%E3%82%A9%E3%83%AB%E3%83%80\"><\/span>patterns\u30d5\u30a9\u30eb\u30c0<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n2\u3064\u76ee\u306e\u65b9\u6cd5\u3068\u3057\u3066\u3001\u30c6\u30fc\u30de\u306e\u30eb\u30fc\u30c8\u306b\u3042\u308b\/patterns\u30d5\u30a9\u30eb\u30c0\u4e0b\u306bPHP\u30d5\u30a1\u30a4\u30eb\u3067\u5ba3\u8a00\u3059\u308b\u3053\u3068\u3067\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u4eca\u56de\u306f\u524d\u7ae0\u3067\u4f5c\u6210\u3057\u305f\u30d1\u30bf\u30fc\u30f3\u3068\u540c\u3058\u3082\u306e\u3092\u4f5c\u308a\u3001\u30c6\u30fc\u30de\u306fTwenty Twenty-Three\u3092\u5229\u7528\u3057\u307e\u3059\u3002\u52a0\u3048\u3066\u524d\u63d0\u6761\u4ef6\u3068\u3057\u3066\u3001\u65e2\u306b\u30ab\u30c6\u30b4\u30ea\u30fc\u306f\u4f5c\u6210\u3055\u308c\u3066\u308b\u3053\u3068\u3068\u3057\u307e\u3059\u3002\u5927\u307e\u304b\u306a\u65b9\u91dd\u306f\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\u3002\r\n\r\n<ol>\r\n    <li>patterns\u30d5\u30a9\u30eb\u30c0\u4e0b\u306bPHP\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u6210<\/li>\r\n    <li>PHP\u30d5\u30a1\u30a4\u30eb\u306b\u30d1\u30bf\u30fc\u30f3\u306e\u8a18\u8ff0<\/li>\r\n<\/ol>\r\n\r\n<h3><span class=\"ez-toc-section\" id=\"patterns%E3%83%95%E3%82%A9%E3%83%AB%E3%83%80%E4%B8%8B%E3%81%ABPHP%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AE%E4%BD%9C%E6%88%90\"><\/span>patterns\u30d5\u30a9\u30eb\u30c0\u4e0b\u306bPHP\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u6210<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\nPHP\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u6210\u306b\u3042\u305f\u3063\u3066\u3001patterns\u30d5\u30a9\u30eb\u30c0\u306e\u4f4d\u7f6e\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002patterns\u30d5\u30a9\u30eb\u30c0\u306f\u500b\u3005\u306e\u30c6\u30fc\u30de\u30d5\u30a9\u30eb\u30c0\u306e\u76f4\u4e0b\u306b\u3042\u308a\u307e\u3059\u3002patterns\u30d5\u30a9\u30eb\u30c0\u304c\u898b\u3064\u304b\u3063\u305f\u3089\u3001\u65e9\u901fPHP\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002\r\n\r\n<pre>\r\n    \/wp-content\/themes\/twentytwentythree\r\n                                \u251c\u2500\u2500 patterns\r\n                                \u251c\u2500\u2500 assets\r\n                                \u251c\u2500\u2500 parts\r\n                                \u251c\u2500\u2500 styles\r\n                                \u2514\u2500\u2500 templates\r\n<\/pre>\r\n\r\n<h3><span class=\"ez-toc-section\" id=\"PHP%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AB%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3%E3%81%AE%E8%A8%98%E8%BF%B0\"><\/span>PHP\u30d5\u30a1\u30a4\u30eb\u306b\u30d1\u30bf\u30fc\u30f3\u306e\u8a18\u8ff0<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\u6b21\u306b\u4f5c\u6210\u3057\u305fPHP\u30d5\u30a1\u30a4\u30eb\u306b\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002\r\n\r\n<pre>\r\n    \/\/PHP\u30d5\u30a1\u30a4\u30eb\r\n\r\n    <?php\r\n    \/**\r\n    * Title: First pattern\r\n    * Slug: twentytwentythree\/first_pattern\r\n    * Categories: my-pattern-category\r\n    *\/\r\n    ?>\r\n\r\n    \r\n    <div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\r\n    \r\n    <h2 class=\"has-large-font-size wp-block-heading\"><span class=\"ez-toc-section\" id=\"Hi_everyone-2\"><\/span><span style=\"color:#ba0c49\" class=\"has-inline-color\">Hi everyone<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n    \r\n    \r\n    <p class=\"has-white-color has-black-background-color has-text-color has-background\">Powered by WordPress<\/p>\r\n    \r\n    <\/div><\/div>\r\n<\/pre>\r\n\r\nHTML\u306f\u524d\u7ae0\u3068\u540c\u3058\u3067\u3059\u306e\u3067\u3001PHP\u306e\u30b3\u30fc\u30c9\u3092\u8aac\u660e\u3057\u307e\u3059\u3002\r\n\r\n<ul>\r\n    <li>\u3010\u5fc5\u9808\u3011Title\uff1a\u30d1\u30bf\u30fc\u30f3\u306e\u540d\u524d\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/li>\r\n    <li>\u3010\u5fc5\u9808\u3011Slug\uff1a\u30d1\u30bf\u30fc\u30f3\u3092\u53d6\u5f97\u3059\u308b\u969b\u306b\u5229\u7528\u3057\u307e\u3059\u3002<\/li>\r\n    <li>Categories\uff1a\u524d\u7ae0\u3067\u767b\u9332\u3057\u305f\u30ab\u30c6\u30b4\u30ea\u30fc\u540d\u3092\u767b\u9332\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u767b\u9332\u3057\u306a\u3044\u5834\u5408\u306f\u672a\u5206\u985e\u306b\u306a\u308a\u307e\u3059\u3002<\/li>\r\n<\/ul>\r\n\r\n<strong>\u203b\u305d\u3057\u3066\u6700\u3082\u91cd\u8981\u306a\u30dd\u30a4\u30f3\u30c8\u3068\u3057\u3066\u3001PHP\u306f\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u4e0b\u8a18\u306e\u30a8\u30e9\u30fc\u306e\u539f\u56e0\u306b\u306a\u308a\u307e\u3059\u3002<\/strong>\r\n\r\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/12\/error.png\" alt=\"\" width=\"1920\" height=\"925\" class=\"aligncenter size-full wp-image-6123\" srcset=\"https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/12\/error.png 1920w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/12\/error-300x145.png 300w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/12\/error-1024x493.png 1024w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/12\/error-768x370.png 768w, https:\/\/wpmake.jp\/contents\/wp-content\/uploads\/2023\/12\/error-1536x740.png 1536w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/>\r\n\r\n\u4ee5\u4e0a\u304cpatterns\u30d5\u30a9\u30eb\u30c0\u3092\u5229\u7528\u3057\u305f\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u306e\u4f5c\u6210\u306b\u306a\u308a\u307e\u3059\u3002\u304a\u8a66\u3057\u3067\u30d1\u30bf\u30fc\u30f3\u3092\u4f5c\u6210\u3059\u308b\u306e\u3067\u3042\u308c\u3070\u3001functions.php\u3092\u7de8\u96c6\u3057\u306a\u3044\u70b9\u3067\u3053\u3061\u3089\u304c\u304a\u3059\u3059\u3081\u3067\u3059\u3002\r\n\r\n<h2><span class=\"ez-toc-section\" id=\"%E3%81%BE%E3%81%A8%E3%82%81\"><\/span>\u307e\u3068\u3081<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\u672c\u8a18\u4e8b\u3067\u306ffunctions.php\u3068patterns\u30d5\u30a9\u30eb\u30c0\u3092\u5229\u7528\u3057\u3066\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002\u3069\u3061\u3089\u3082\u30b3\u30fc\u30c9\u3092\u6271\u3046\u305f\u3081\u96e3\u6613\u5ea6\u306f\u9ad8\u3044\u3067\u3059\u304c\u3001\u305d\u306e\u5206\u30a2\u30ec\u30f3\u30b8\u306e\u5e45\u304c\u5e83\u3044\u3067\u3059\u3002WordPress\u3067\u5236\u4f5c\u3059\u308b\u969b\u306b\u306f\u3001\u305c\u3072\u6d3b\u7528\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\r\n\r\n<h2><span class=\"ez-toc-section\" id=\"%E5%8F%82%E8%80%83%E8%A8%98%E4%BA%8B\"><\/span>\u53c2\u8003\u8a18\u4e8b<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<ol>\r\n    <li><a target=\"_blank\" rel=\"noopener\">register_block_pattern_category<\/a><\/li>\r\n    <li><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/register_block_pattern\/\" rel=\"noopener\" target=\"_blank\">register_block_pattern<\/a><\/li>\r\n    <li><a target=\"_blank\" rel=\"noopener\">functions.php<\/a><\/li>\r\n    <li><a target=\"_blank\" rel=\"noopener\">function_exists<\/a><\/li>\r\n    <li><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/add_action\/\" rel=\"noopener\" target=\"_blank\">add_action<\/a><\/li>\r\n    <li><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/__\/\" rel=\"noopener\" target=\"_blank\">__()<\/a><\/li>\r\n    <li><a target=\"_blank\" rel=\"noopener\">patterns-file<\/a><\/li>\r\n<\/ol>","protected":false},"excerpt":{"rendered":"<p>\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u975e\u540c\u671f\u30d1\u30bf\u30fc\u30f3\u3092\u4f5c\u6210\u3059\u308b\u8a18\u4e8b\u306e\u5f8c\u7de8\u306b\u3042\u305f\u308a\u307e\u3059\u3002register_block_pattern\u3068patterns\u30d5\u30a9\u30eb\u30c0\u3092\u4f7f\u3063\u3066\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":6128,"parent":0,"menu_order":0,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[],"class_list":["post-6122","customize","type-customize","status-publish","format-standard","has-post-thumbnail","hentry"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/customize\/6122"}],"collection":[{"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/customize"}],"about":[{"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/types\/customize"}],"author":[{"embeddable":true,"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":5,"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/customize\/6122\/revisions"}],"predecessor-version":[{"id":6130,"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/customize\/6122\/revisions\/6130"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/media\/6128"}],"wp:attachment":[{"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/media?parent=6122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmake.jp\/contents\/wp-json\/wp\/v2\/categories?post=6122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}