{"id":1415,"date":"2017-03-27T22:18:26","date_gmt":"2017-03-27T13:18:26","guid":{"rendered":"http:\/\/www.clarenet.co.jp\/column\/engineer\/?p=657"},"modified":"2017-03-27T22:18:26","modified_gmt":"2017-03-27T13:18:26","slug":"wp%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e3%82%bf%e3%82%af%e3%82%bd%e3%83%8e%e3%83%9f%e3%83%bc%e3%81%94%e3%81%a8%e3%81%ae%e6%8a%95%e7%a8%bf%e3%81%a8%e3%82%bf%e3%83%bc%e3%83%a0%e3%81%ae%e4%b8%80","status":"publish","type":"post","link":"https:\/\/4koma-web.com\/coding\/wp%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e3%82%bf%e3%82%af%e3%82%bd%e3%83%8e%e3%83%9f%e3%83%bc%e3%81%94%e3%81%a8%e3%81%ae%e6%8a%95%e7%a8%bf%e3%81%a8%e3%82%bf%e3%83%bc%e3%83%a0%e3%81%ae%e4%b8%80\/","title":{"rendered":"WP:\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3054\u3068\u306e\u6295\u7a3f\u3068\u30bf\u30fc\u30e0\u306e\u4e00\u89a7\u8868\u793a"},"content":{"rendered":"<p>home.php\u306a\u3069\u306e\u6295\u7a3f\u30da\u30fc\u30b8\u306b\u3001\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306e\u30bf\u30fc\u30e0\uff08\u30ab\u30c6\u30b4\u30ea\u30fc\uff09\u3054\u3068\u306b\u6295\u7a3f\u306e\u4e00\u89a7\u307e\u305f\u306f\u5b50\u30ab\u30c6\u30b4\u30ea\u30fc\u3092\u8868\u793a\u3059\u308b\u30bd\u30fc\u30b9\u3067\u3059\u3002 <\/p>\n<pre class=\"lang:default decode:true \" >&lt;div class=\"box\"&gt;\n\n      &lt;?php\n      $args = array(\n        'parent' =&gt; 0,\n        'hierarchical' =&gt; 0,\n        'order' =&gt; 'ASC'\n      );\n      $taxonomy_name = '\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u540d';\n      $taxonomys = get_terms( $taxonomy_name, $args );\n      if ( !is_wp_error( $taxonomys ) &amp;&amp; count( $taxonomys ) ):\n        foreach ( $taxonomys as $taxonomy ):\n          $url = get_term_link( $taxonomy-&gt;slug, $taxonomy_name );\n\n      ?&gt;\n\n\n\n      &lt;div class=\"contentbox01\"&gt;\n\n        &lt;h2 id=\"&lt;?php echo esc_html($taxonomy-&gt;slug); ?&gt;\" class=\"h2_style01\"&gt;&lt;?php echo esc_html($taxonomy-&gt;name); \/\/\u30bf\u30fc\u30e0\u30bf\u30a4\u30c8\u30eb?&gt;&lt;\/h2&gt;\n\n        &lt;div class=\"contentbox01_in\"&gt;\n\n\n\n          &lt;table class=\"table_style01\"&gt;\n\n\n\n\n            &lt;?php\n            \/**\n             * \u304a\u77e5\u3089\u305b\u7b49\u306e\u4e00\u89a7\u3092\u53d6\u5f97\n             *\n             *\/\n            $args = array(\n              'post_type' =&gt; '\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u540d',\n              'posts_per_page' =&gt; 10, \/\/\u65b0\u7740\u9806\u306b10\u4ef6\u8868\u793a\n              'orderby' =&gt; 'post_date',\n              'order' =&gt; 'DESC',\n              'post_status' =&gt; 'publish',\n              'tax_query' =&gt; array(\n                'relation' =&gt; 'AND',\n                array(\n                  'taxonomy' =&gt; '\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u540d',\n                  'field' =&gt; 'slug',\n                  'terms' =&gt; $taxonomy-&gt;slug,\n                  'include_children' =&gt; true,\n                  'operator' =&gt; 'IN'\n                ),\n              )\n            );\n\n            $the_query = new WP_Query( $args );\n\n            if ( $the_query-&gt;have_posts() ):\n              ?&gt;\n\n            &lt;?php\n            $term_id = $taxonomy-&gt;term_id;\n            $children = get_term_children( $term_id, $taxonomy_name );\n            if ( $children ): \/\/\u5b50\u30bf\u30fc\u30e0\u3092\u6301\u3064\u5834\u5408\u306b\u306f\u30bf\u30fc\u30e0\u306e\u4e00\u89a7\u3092\u8868\u793a\n              ?&gt;\n\n            &lt;?php\n            $term_id = $taxonomy-&gt;term_id;\n            $taxonomy_name = '\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u540d';\n            $termchildren = get_term_children( $term_id, $taxonomy_name );\n\n\n            foreach ( $termchildren as $child ) {\n              $term = get_term_by( 'id', $child, $taxonomy_name );\n              echo '&lt;tr&gt;&lt;td&gt;&lt;a href=\"' . get_term_link( $child, $taxonomy_name ) . '\"&gt;' . $term-&gt;name . '&lt;\/a&gt;&lt;td&gt;&lt;\/th&gt;';\n            }\n\n            ?&gt;\n\n\n\n            &lt;?php else: ?&gt; \/\/\u5b50\u30bf\u30fc\u30e0\u3092\u6301\u305f\u306a\u3044\u5834\u5408\u306b\u306f\u6295\u7a3f\u306e\u4e00\u89a7\u3092\u8868\u793a\n\n\n\n            &lt;?php while ( $the_query-&gt;have_posts() ) : $the_query-&gt;the_post(); ?&gt;\n\n\n\n            &lt;tr&gt;\n              &lt;th&gt;\n                &lt;?php the_time('Y.m.d'); ?&gt;\n              &lt;\/th&gt;\n              &lt;td&gt;\n                &lt;?php\n                $cf_important = get_field( 'important' ); \/\/ACF\u3067\u4f5c\u6210\u3057\u305f\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\n                if ( $cf_important == '\u8868\u793a\u3059\u308b' ) {\n                  echo '&lt;span class=\"important01\"&gt;\u91cd\u8981&lt;\/span&gt;';\n                } else {\n                  echo ' ';\n                }\n                ?&gt;\n                &lt;?php if(get_field('important')): ?&gt;\n                &lt;span class=\"important01\"&gt;\u91cd\u8981&lt;\/span&gt;\n                &lt;?php endif ;?&gt;\n                &lt;a href=\"&lt;?php the_permalink(); ?&gt;\"&gt;\n                  &lt;?php the_title(); ?&gt;\n                &lt;\/a&gt;\n              &lt;\/td&gt;\n            &lt;\/tr&gt;\n\n            &lt;?php\n            endwhile;\n            ?&gt;\n\n            &lt;?php endif; ?&gt;\n\n            &lt;?php\n            endif;\n            wp_reset_postdata();\n            ?&gt;\n\n\n\n          &lt;\/table&gt;\n\n\n\n\n        &lt;\/div&gt;\n        &lt;div class=\"btnbox01\"&gt;\n          &lt;a href=\"&lt;?php echo esc_url( home_url( '\/' ) ); ?&gt;&lt;?php echo esc_html($taxonomy-&gt;slug); ?&gt;\/\"&gt;\u4e00\u89a7\u3078&lt;\/a&gt;\n        &lt;\/div&gt;\n      &lt;\/div&gt;\n\n      &lt;?php endforeach; endif; wp_reset_postdata(); ?&gt;\n\n\n    &lt;\/div&gt;\n    &lt;!-- box --&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>home.php\u306a\u3069\u306e\u6295\u7a3f\u30da\u30fc\u30b8\u306b\u3001\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306e\u30bf\u30fc\u30e0\uff08\u30ab\u30c6\u30b4\u30ea\u30fc\uff09\u3054\u3068\u306b\u6295\u7a3f\u306e\u4e00\u89a7\u307e\u305f\u306f\u5b50\u30ab\u30c6\u30b4\u30ea\u30fc\u3092\u8868\u793a\u3059\u308b\u30bd\u30fc\u30b9\u3067\u3059\u3002 &lt;div class=&#8221;box&#8221;&gt; &lt;?php $args = array [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":612,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"","_original_post":"","footnotes":""},"categories":[1],"tags":[],"publishpress_future_action":{"enabled":false,"date":"2026-04-21 20:35:27","action":"change-status","newStatus":"draft","terms":[],"taxonomy":"category"},"_links":{"self":[{"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/posts\/1415"}],"collection":[{"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/comments?post=1415"}],"version-history":[{"count":0,"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/posts\/1415\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/media\/612"}],"wp:attachment":[{"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/media?parent=1415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/categories?post=1415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/4koma-web.com\/coding\/wp-json\/wp\/v2\/tags?post=1415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}