{"id":11669385,"date":"2021-02-09T14:54:07","date_gmt":"2021-02-09T05:54:07","guid":{"rendered":"https:\/\/ja.wordpress.org\/support\/topic\/archive-%e2%97%8f%e3%81%ae%e8%a8%98%e4%ba%8b%e4%b8%80%e8%a6%a7%e3%81%a7smart-custom-field%e7%b9%b0%e3%82%8a%e8%bf%94%e3%81%97%e3%81%8c%e3%82%a8%e3%83%a9%e3%83%bc\/"},"modified":"2021-02-09T14:54:07","modified_gmt":"2021-02-09T05:54:07","slug":"archive-%e2%97%8f%e3%81%ae%e8%a8%98%e4%ba%8b%e4%b8%80%e8%a6%a7%e3%81%a7smart-custom-field%e7%b9%b0%e3%82%8a%e8%bf%94%e3%81%97%e3%81%8c%e3%82%a8%e3%83%a9%e3%83%bc","status":"publish","type":"topic","link":"https:\/\/ja.wordpress.org\/support\/topic\/archive-%e2%97%8f%e3%81%ae%e8%a8%98%e4%ba%8b%e4%b8%80%e8%a6%a7%e3%81%a7smart-custom-field%e7%b9%b0%e3%82%8a%e8%bf%94%e3%81%97%e3%81%8c%e3%82%a8%e3%83%a9%e3%83%bc\/","title":{"rendered":"archive-\u25cf\u306e\u8a18\u4e8b\u4e00\u89a7\u3067Smart Custom Field\u7e70\u308a\u8fd4\u3057\u304c\u30a8\u30e9\u30fc"},"content":{"rendered":"<p>\u4ee5\u524d<br \/>\nhttps:\/\/ja.wordpress.org\/support\/topic\/smart-custom-field%e3%81%ae%e7%b9%b0%e3%82%8a%e8%bf%94%e3%81%97%e3%83%95%e3%82%a3%e3%83%bc%e3%83%ab%e3%83%89%e3%81%8ctaxonomy-%e2%97%8f-php%e3%81%a7%e5%8b%95%e3%81%8b%e3%81%aa%e3%81%84-2\/<br \/>\n\u3053\u3061\u3089\u3067\u4f3c\u305f\u3088\u3046\u306a\u8cea\u554f\u3057\u305f\u3053\u3068\u304c\u3042\u308a\u89e3\u6c7a\u3057\u305f\u306e\u3067\u3059\u304c\u3001<br \/>\n\u4eca\u56de\u306farchive-\u25cf.php\u3067\u540c\u69d8\u306e\u4e8b\u304c\u8d77\u304d\u3066\u3066\u5206\u304b\u3089\u306a\u3044\u306e\u3067\u8cea\u554f\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3059\u3002<\/p>\n<p>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u306b\u30bf\u30af\u30bd\u30ce\u30df\u30fc\uff08label_category\uff09\u3092\u8a2d\u5b9a\u3057\u3001\u8907\u6570\u306e\u30bf\u30fc\u30e0\uff08term\uff09\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\narchive-\u25cf.php\u4e0a\u3067\u3001\u305d\u306e\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306e\u30bf\u30fc\u30e0\u306e\u30ea\u30b9\u30c8\u3092\u751f\u6210\u306e\u3046\u3048\u3001\u305d\u306e\u30bf\u30fc\u30e0\u306b\u5c5e\u3057\u3066\u3044\u308b\u8a18\u4e8b\u3092\u4e00\u89a7\u3067\u51fa\u3057\u305f\u3044\u3001\u3068\u3044\u3046\u52d5\u304d\u3092\u4f5c\u308d\u3046\u3068\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u306e\u8a18\u4e8b\u306b\u306fSmart Custom Fields\u3067\u4f5c\u3063\u305f\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\uff08\u5358\u4f53\u306e\u30c6\u30ad\u30b9\u30c8\u30d5\u30a3\u30fc\u30eb\u30c9\u3068\u7e70\u308a\u8fd4\u3057\u306e\u30c6\u30ad\u30b9\u30c8\u30d5\u30a3\u30fc\u30eb\u30c9\uff09\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u308a\u3001\u305d\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5185\u5bb9\u3092\u3053\u306e\u4e00\u89a7\u306e\u4e2d\u306b\u8868\u793a\u3057\u305f\u3044\u3068\u8003\u3048\u3066\u307e\u3059\u3002<\/p>\n<p>\u30bf\u30a4\u30c8\u30eb\u3001\u30d1\u30fc\u30de\u30cd\u30f3\u30c8URL\u3001CF\u306e\u5358\u4f53\u306e\u30c6\u30ad\u30b9\u30c8\u30d5\u30a3\u30fc\u30eb\u30c9\u306f\u8868\u793a\u3067\u304d\u307e\u3057\u305f\u3002<br \/>\n\u7e70\u308a\u8fd4\u3057\u306eCF\u306f\u3001\u4ee5\u524d\u6559\u3048\u3066\u3044\u305f\u3060\u3044\u305f\u5185\u5bb9\u3092\u8e0f\u307e\u3048\u3066\u3001<\/p>\n<pre><code>$term_id = get_queried_object_id();\n$scf_group = SCF::get_term_meta( $term_id, &#039;product&#039;, &#039;scf_group&#039; );\nforeach ( $scf_group as $fields ) {\n\techo esc_html( $fields[&#039;scf_text&#039;] );\n}<\/code><\/pre>\n<p>\u203b\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u540d\u306fscf_group\u3001\u30b0\u30eb\u30fc\u30d7\u540d\u306fproduct\u3001\u30c6\u30ad\u30b9\u30c8\u30d5\u30a3\u30fc\u30eb\u30c9\u306fscf_text<\/p>\n<p>\u3053\u308c\u3092\u8e0f\u307e\u3048\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u305f\u3068\u3053\u308d\u3001php\u306e\u30a8\u30e9\u30fc\u304c\u5410\u304d\u51fa\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<pre><code>&lt;?php\n$taxonomy_name = &#039;label_category&#039;;\n$taxonomys = get_terms($taxonomy_name);\nif(!is_wp_error($taxonomys) &amp;&amp; count($taxonomys)):\nforeach($taxonomys as $taxonomy):\n$tax_posts = get_posts(array(&#039;post_type&#039; =&gt; get_post_type(), &#039;taxonomy&#039; =&gt; $taxonomy_name,\n&#039;term&#039; =&gt; $taxonomy-&gt;slug ) );\nif($tax_posts):\n?&gt;\n\/\/\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u4e00\u89a7\u3092\u751f\u6210\n&lt;div id=&quot;wrap&quot;&gt;\n&lt;h2&gt;&lt;?php echo esc_html($taxonomy-&gt;name); ?&gt;(&lt;?php echo esc_html($taxonomy-&gt;slug); ?&gt;)&lt;\/h2&gt;\/\/\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u540d\uff06\u30b9\u30e9\u30c3\u30b0\u8868\u793a\n&lt;ul&gt;\n&lt;?php\nforeach($tax_posts as $tax_post):\n?&gt;\/\/\u30bf\u30fc\u30e0\u306e\u8a18\u4e8b\u4e00\u89a7\u3092\u751f\u6210\n&lt;li&gt;\n&lt;h3&gt;&lt;a href=&quot;&lt;?php echo get_permalink($tax_post-&gt;ID); ?&gt;&quot;&gt;&lt;?php echo get_the_title($tax_post-&gt;ID); ?&gt;&lt;\/a&gt;&lt;\/h3&gt;\/\/\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u306e\u30bf\u30a4\u30c8\u30eb\u3068\u30ea\u30f3\u30af\n&lt;div class=&quot;text&quot;&gt;[column_copy]\u2192&lt;?php echo nl2br(get_post_meta($tax_post-&gt;ID, &#039;cf_setsumei&#039;, true)); ?&gt;&lt;\/div&gt;\/\/\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u306b\u8a2d\u5b9a\u3057\u305f\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u30c6\u30ad\u30b9\u30c8\u547c\u3073\u51fa\u3057\n\n&lt;div class=&quot;tag_area&quot;&gt;\n\/\/\u25bc\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u306b\u8a2d\u5b9a\u3057\u305f\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u30b0\u30eb\u30fc\u30d7\uff08\u30c6\u30ad\u30b9\u30c8\u30d5\u30a3\u30fc\u30eb\u30c9\uff09\u306e\u547c\u3073\u51fa\u3057\n&lt;?php\n$term_id = get_queried_object_id();\n$scf_group = SCF::get_term_meta( $term_id, &#039;product&#039;, &#039;scf_group&#039; );\nforeach ( $scf_group as $fields ) {\n\techo esc_html( $fields[&#039;scf_text&#039;] );\n}\n?&gt;\n\/\/\u25b2\n&lt;\/div&gt;\n&lt;\/li&gt;\n&lt;?php endforeach; ?&gt;\n&lt;\/ul&gt;\n&lt;\/div&gt;\n&lt;?php endif; endforeach; endif; ?&gt;<\/code><\/pre>\n<p>\u30a8\u30e9\u30fc\u306f<br \/>\nforeach ($scf_group as $fields ) {<br \/>\n\u306e\u884c\u306b<br \/>\nWarning: Invalid argument supplied for foreach() in  \uff5e<br \/>\n\u3068\u51fa\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30cd\u30c3\u30c8\u3067\u8abf\u3079\u3066\u307f\u3066\u3001<br \/>\nforeach ((array)$scf_group as $fields ) {<br \/>\n\u3068\u3057\u3066\u307f\u305f\u3089\u3001\u30a8\u30e9\u30fc\u306f\u6d88\u3048\u307e\u3057\u305f\u304c\u3001\u4f55\u3082\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u306a\u304a\u3001\u524d\u56de\u3067\u3082\u52d5\u304b\u306a\u304b\u3063\u305f<\/p>\n<pre><code>&lt;?php $repeat_group = SCF::get( &#039;scf_group&#039; );\nforeach ( $repeat_group as $fields ) { ?&gt;\n&lt;?php echo esc_html( $fields[&#039;scf_text&#039;] ); ?&gt;\n&lt;?php } ?&gt;<\/code><\/pre>\n<p>\u3092\u30c6\u30b9\u30c8\u3067\u66f8\u3044\u3066\u307f\u305f\u3068\u3053\u308d\u3001\u4e00\u3064\u76ee\u306e\u8a18\u4e8b\u306e\u30b0\u30eb\u30fc\u30d7\u304c\u3059\u3079\u3066\u306e\u8a18\u4e8b\u306b\u5165\u3063\u305f\u72b6\u614b\u3067\u51fa\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u3061\u3089\u3001\u3000foreach ($scf_group as $fields ) {\u3000\u306e\u90e8\u5206\u3092\u3069\u306e\u3088\u3046\u306b\u66f8\u3051\u3070\u89e3\u6d88\u3059\u308b\u306e\u3067\u3057\u3087\u3046\u304b\u3002<br \/>\n\u3054\u6559\u6388\u306e\u307b\u3069\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3044\u305f\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"template":"","class_list":["post-11669385","topic","type-topic","status-publish","hentry","topic-tag-14327","topic-tag-15782","topic-tag-16762","topic-tag-15018","topic-tag-smart-custom-fields"],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11669385","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\/11669385\/revisions"}],"wp:attachment":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=11669385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}