{"id":145142,"date":"2012-02-07T12:01:04","date_gmt":"2012-02-07T03:01:04","guid":{"rendered":"https:\/\/ja.wordpress.org\/support\/2012\/02\/07\/%e8%a4%87%e6%95%b0%e3%81%ae%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e6%8a%95%e7%a8%bf%e3%82%bf%e3%82%a4%e3%83%97\/"},"modified":"2012-02-07T12:01:04","modified_gmt":"2012-02-07T03:01:04","slug":"%e8%a4%87%e6%95%b0%e3%81%ae%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e6%8a%95%e7%a8%bf%e3%82%bf%e3%82%a4%e3%83%97","status":"closed","type":"topic","link":"https:\/\/ja.wordpress.org\/support\/topic\/%e8%a4%87%e6%95%b0%e3%81%ae%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e6%8a%95%e7%a8%bf%e3%82%bf%e3%82%a4%e3%83%97\/","title":{"rendered":"\u8907\u6570\u306e\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7"},"content":{"rendered":"<p>\u30c6\u30fc\u30de\u5185\u306efunctions.php\u306b\u3053\u306e\u3088\u3046\u306b\u66f8\u304d\u3001\u52d5\u4f5c\u306f\u6b63\u5e38\u306a\u306e\u3067\u3059\u304c\u540c\u3058\u69d8\u306b<br \/>\n\u30ea\u30f3\u30af\u7528\u306e\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092\u8ffd\u52a0\u3057\u305f\u304f\u3001\u4e0b\u8a18\u306e\u300cinfo\u300d\u3092\u300clink\u300d\u306b<br \/>\n\u5909\u3048\u3066\u66f8\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u65b0\u7740\u60c5\u5831\u306e\u4e00\u89a7\u3092\u307f\u308b\u3068\u30ab\u30c6\u30b4\u30ea\u30fc\u304c\u304a\u304b\u3057\u3044\u3067\u3059\u3002<\/p>\n<p>\u65b0\u7740\u60c5\u5831\u306e\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u5834\u5408\u3001\u30ab\u30c6\u30b4\u30ea\u30fc\u306f\u3053\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002<br \/>\n\u304a\u77e5\u3089\u305b<\/p>\n<p>\u3057\u304b\u3057\u3001\u30ea\u30f3\u30af\u7528\u306e\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092\u8ffd\u52a0\u3059\u308b\u3068\u3053\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002<br \/>\n\u304a\u77e5\u3089\u305b\u306a\u3057<\/p>\n<p>\u660e\u3089\u304b\u306b\u30ea\u30f3\u30af\u7528\u306e\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3067\u3001\u30ab\u30c6\u30b4\u30ea\u30fc\u540d\u3092\u53d6\u5f97\u3059\u308b\u95a2\u6570\u3082<br \/>\n\u540c\u6642\u306b\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u306a\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u5834\u5408\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<pre><code>\/\/ \u65b0\u7740\u60c5\u5831\u6295\u7a3f\u30bf\u30a4\u30d7\nfunction info_custom_post_type()\n{\n    $labels = array(\n        &#039;name&#039;               =&gt; _x(&#039;\u65b0\u7740\u60c5\u5831&#039;, &#039;post type general name&#039;),\n        &#039;singular_name&#039;      =&gt; _x(&#039;\u65b0\u7740\u60c5\u5831&#039;, &#039;post type singular name&#039;),\n        &#039;add_new&#039;            =&gt; _x(&#039;\u65b0\u7740\u60c5\u5831\u3092\u8ffd\u52a0&#039;, &#039;info&#039;),\n        &#039;add_new_item&#039;       =&gt; __(&#039;\u65b0\u3057\u3044\u65b0\u7740\u60c5\u5831\u3092\u8ffd\u52a0&#039;),\n        &#039;edit_item&#039;          =&gt; __(&#039;\u65b0\u7740\u60c5\u5831\u3092\u7de8\u96c6&#039;),\n        &#039;new_item&#039;           =&gt; __(&#039;\u65b0\u3057\u3044\u65b0\u7740\u60c5\u5831&#039;),\n        &#039;view_item&#039;          =&gt; __(&#039;\u65b0\u7740\u60c5\u5831\u3092\u7de8\u96c6&#039;),\n        &#039;search_items&#039;       =&gt; __(&#039;\u65b0\u7740\u60c5\u5831\u3092\u63a2\u3059&#039;),\n        &#039;not_found&#039;          =&gt; __(&#039;\u65b0\u7740\u60c5\u5831\u306f\u3042\u308a\u307e\u305b\u3093&#039;),\n        &#039;not_found_in_trash&#039; =&gt; __(&#039;\u30b4\u30df\u7bb1\u306b\u65b0\u7740\u60c5\u5831\u306f\u3042\u308a\u307e\u305b\u3093&#039;),\n        &#039;parent_item_colon&#039;  =&gt; &#039;&#039;,\n    );\n\n    $args = array(\n        &#039;labels&#039;             =&gt; $labels,\n        &#039;public&#039;             =&gt; true,\n        &#039;publicly_queryable&#039; =&gt; true,\n        &#039;show_ui&#039;            =&gt; true,\n        &#039;query_var&#039;          =&gt; true,\n        &#039;rewrite&#039;            =&gt; true,\n        &#039;rewrite&#039;            =&gt; array(true, &#039;with_front&#039; =&gt; false),\n        &#039;capability_type&#039;    =&gt; &#039;post&#039;,\n        &#039;hierarchical&#039;       =&gt; false,\n        &#039;menu_position&#039;      =&gt; 5,\n        &#039;has_archive&#039;        =&gt; true,\n        &#039;supports&#039;           =&gt; array(&#039;title&#039;, &#039;editor&#039;),\n        &#039;taxonomies&#039;         =&gt; array(&#039;info_category&#039;),\n    );\n\n    register_post_type(&#039;info&#039;, $args);\n\n    $args = array(\n        &#039;label&#039;        =&gt; &#039;\u60c5\u5831\u30ab\u30c6\u30b4\u30ea\u30fc&#039;,\n        &#039;public&#039;       =&gt; true,\n        &#039;show_ui&#039;      =&gt; true,\n        &#039;hierarchical&#039; =&gt; true,\n    );\n\n    flush_rewrite_rules(false);\n\n    register_taxonomy(&#039;info_category&#039;, &#039;info&#039;, $args);\n}\nadd_action(&#039;init&#039;, &#039;info_custom_post_type&#039;);\n\nfunction manage_posts_info_columns($columns)\n{\n    $columns[&#039;fcategory&#039;] = &quot;\u30ab\u30c6\u30b4\u30ea\u30fc&quot;;\n    return $columns;\n}\n\nfunction add_info_column($column_name, $post_id)\n{\n    if( &#039;fcategory&#039; == $column_name ) {\n        $fcategory = get_the_term_list($post_id, &#039;info_category&#039;);\n    }\n\n    if ( isset($fcategory) &amp;&amp; $fcategory ) {\n        echo $fcategory;\n    } else {\n        echo __(&#039;None&#039;);\n    }\n}\nadd_filter(&#039;manage_edit-info_columns&#039;, &#039;manage_posts_info_columns&#039;);\nadd_action(&#039;manage_posts_custom_column&#039;, &#039;add_info_column&#039;, 10, 2);\n\n\/\/ \u30ea\u30f3\u30af\u6295\u7a3f\u30bf\u30a4\u30d7\nfunction link_custom_post_type()\n{\n    $labels = array(\n        &#039;name&#039;               =&gt; _x(&#039;\u30ea\u30f3\u30af&#039;, &#039;post type general name&#039;),\n        &#039;singular_name&#039;      =&gt; _x(&#039;\u30ea\u30f3\u30af&#039;, &#039;post type singular name&#039;),\n        &#039;add_new&#039;            =&gt; _x(&#039;\u30ea\u30f3\u30af\u3092\u8ffd\u52a0&#039;, &#039;link&#039;),\n        &#039;add_new_item&#039;       =&gt; __(&#039;\u65b0\u3057\u3044\u30ea\u30f3\u30af\u3092\u8ffd\u52a0&#039;),\n        &#039;edit_item&#039;          =&gt; __(&#039;\u30ea\u30f3\u30af\u3092\u7de8\u96c6&#039;),\n        &#039;new_item&#039;           =&gt; __(&#039;\u65b0\u3057\u3044\u30ea\u30f3\u30af&#039;),\n        &#039;view_item&#039;          =&gt; __(&#039;\u30ea\u30f3\u30af\u3092\u7de8\u96c6&#039;),\n        &#039;search_items&#039;       =&gt; __(&#039;\u30ea\u30f3\u30af\u3092\u63a2\u3059&#039;),\n        &#039;not_found&#039;          =&gt; __(&#039;\u30ea\u30f3\u30af\u306f\u3042\u308a\u307e\u305b\u3093&#039;),\n        &#039;not_found_in_trash&#039; =&gt; __(&#039;\u30b4\u30df\u7bb1\u306b\u30ea\u30f3\u30af\u306f\u3042\u308a\u307e\u305b\u3093&#039;),\n        &#039;parent_item_colon&#039;  =&gt; &#039;&#039;,\n    );\n\n    $args = array(\n        &#039;labels&#039;             =&gt; $labels,\n        &#039;public&#039;             =&gt; true,\n        &#039;publicly_queryable&#039; =&gt; true,\n        &#039;show_ui&#039;            =&gt; true,\n        &#039;query_var&#039;          =&gt; true,\n        &#039;rewrite&#039;            =&gt; true,\n        &#039;rewrite&#039;            =&gt; array(true, &#039;with_front&#039; =&gt; false),\n        &#039;capability_type&#039;    =&gt; &#039;post&#039;,\n        &#039;hierarchical&#039;       =&gt; false,\n        &#039;menu_position&#039;      =&gt; 5,\n        &#039;has_archive&#039;        =&gt; true,\n        &#039;supports&#039;           =&gt; array(&#039;title&#039;, &#039;editor&#039;),\n        &#039;taxonomies&#039;         =&gt; array(&#039;link_category&#039;),\n    );\n\n    register_post_type(&#039;link&#039;, $args);\n\n    $args = array(\n        &#039;label&#039;        =&gt; &#039;\u30ab\u30c6\u30b4\u30ea\u30fc&#039;,\n        &#039;public&#039;       =&gt; true,\n        &#039;show_ui&#039;      =&gt; true,\n        &#039;hierarchical&#039; =&gt; true,\n    );\n\n    flush_rewrite_rules(false);\n\n    register_taxonomy(&#039;link_category&#039;, &#039;link&#039;, $args);\n}\nadd_action(&#039;init&#039;, &#039;link_custom_post_type&#039;);\n\nfunction manage_posts_link_columns($columns)\n{\n    $columns[&#039;dcategory&#039;] = &quot;\u30ab\u30c6\u30b4\u30ea\u30fc&quot;;\n    return $columns;\n}\n\nfunction add_link_column($column_name, $post_id)\n{\n    if( &#039;dcategory&#039; == $column_name ) {\n        $dcategory = get_the_term_list($post_id, &#039;link_category&#039;);\n    }\n\n    if ( isset($dcategory) &amp;&amp; $dcategory ) {\n        echo $dcategory;\n    } else {\n        echo __(&#039;None&#039;);\n    }\n}\nadd_filter(&#039;manage_edit-link_columns&#039;, &#039;manage_posts_link_columns&#039;);\nadd_action(&#039;manage_posts_custom_column&#039;,  &#039;add_link_column&#039;, 10, 2);<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-145142","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/145142","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":0,"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/145142\/revisions"}],"wp:attachment":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=145142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}