{"id":215554,"date":"2017-03-29T18:22:23","date_gmt":"2017-03-29T09:22:23","guid":{"rendered":"https:\/\/ja.wordpress.org\/support\/topic\/%e5%9b%ba%e5%ae%9a%e3%83%9a%e3%83%bc%e3%82%b8%e3%81%a7%e7%89%b9%e5%ae%9a%e3%81%ae%e3%82%ab%e3%83%86%e3%82%b4%e3%83%aa%e3%83%bc%e3%81%ae%e6%8a%95%e7%a8%bf%e8%a8%98%e4%ba%8b%e4%b8%80%e8%a6%a7%e3%82%92\/"},"modified":"2017-03-29T18:28:26","modified_gmt":"2017-03-29T09:28:26","slug":"%e5%9b%ba%e5%ae%9a%e3%83%9a%e3%83%bc%e3%82%b8%e3%81%a7%e7%89%b9%e5%ae%9a%e3%81%ae%e3%82%ab%e3%83%86%e3%82%b4%e3%83%aa%e3%83%bc%e3%81%ae%e6%8a%95%e7%a8%bf%e8%a8%98%e4%ba%8b%e4%b8%80%e8%a6%a7%e3%82%92","status":"publish","type":"topic","link":"https:\/\/ja.wordpress.org\/support\/topic\/%e5%9b%ba%e5%ae%9a%e3%83%9a%e3%83%bc%e3%82%b8%e3%81%a7%e7%89%b9%e5%ae%9a%e3%81%ae%e3%82%ab%e3%83%86%e3%82%b4%e3%83%aa%e3%83%bc%e3%81%ae%e6%8a%95%e7%a8%bf%e8%a8%98%e4%ba%8b%e4%b8%80%e8%a6%a7%e3%82%92\/","title":{"rendered":"\u56fa\u5b9a\u30da\u30fc\u30b8\u3067\u7279\u5b9a\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u6295\u7a3f\u8a18\u4e8b\u4e00\u89a7\u3092\u8868\u793a\u3055\u305b\u308b\u306b\u306f\uff1f"},"content":{"rendered":"<p>\u521d\u5fc3\u8005\u3067\u3059\u3002<br \/>\n\u65e2\u5b58\u306e\u30c6\u30fc\u30de\u3092\u4f7f\u3063\u3066\u4e00\u90e8\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u56fa\u5b9a\u30da\u30fc\u30b8(page-lesson.php)\u3067\u3001\u3042\u308b\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u6295\u7a3f\u8a18\u4e8b\u306e\u307f\u3092\u8868\u793a\u3055\u305b\u305f\u3044\u306e\u3067\u3059\u304c\u3001WP_Query\u3067\u3082get_posts\u3067\u3082\u3046\u307e\u304f\u3044\u304d\u307e\u305b\u3093\u3002get_posts\u3067\u306f\u30a8\u30e9\u30fc\u3067\u771f\u3063\u767d\u753b\u9762\u306b\u306a\u308a\u3001WP_Query\u3067\u306f\u8a18\u4e8b\u304c\u4e00\u4ef6\u3057\u304b\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002<br \/>\n\u3069\u306e\u30b3\u30fc\u30c9\u304c\u9593\u9055\u3063\u3066\u3044\u308b\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p><strong>get_posts\u306e\u30b3\u30fc\u30c9<\/strong><\/p>\n<pre><code>&lt;div class=&quot;lesson-post&quot;&gt;\n&lt;?php\n$args = array( \n\u2018category\u2019 =&gt; 2;\n\u2018post_type\u2019 =&gt; \u2018post\u2019;\n&#039;posts_per_page&#039; =&gt; -1 ;\n$lesson_posts = get_posts( $args );\nforeach ($lesson_posts as $post ) :\n  setup_postdata( $post ); \n?&gt;\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;article id=&quot;post&quot;&gt; \n           &lt;div class=&quot;entry&quot;&gt;\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;div class=&quot;lesson-text&quot;&gt; \n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;h3&gt;&lt;?php the_title(); ?&gt;&lt;\/h3&gt; \n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;p&gt;&lt;?php the_content() ?&gt;&lt;\/p&gt; \n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  &lt;\/div&gt;\n           &lt;\/div&gt;&lt;!-- .entry --&gt; \n\u00a0 \u00a0 \u00a0 \u00a0 &lt;\/article&gt;&lt;!-- #post --&gt; \n&lt;?php\nendforeach; \nwp_reset_postdata();\n?&gt;\n&lt;\/div&gt;<\/code><\/pre>\n<p><strong>WP_Query\u306e\u30b3\u30fc\u30c9<\/strong><\/p>\n<pre><code>\n&lt;div class=&quot;span_12&quot;&gt;\n&lt;?php\n    $wp_query = new WP_Query();\n    $my_posts = array(\n        &#039;post_type&#039; =&gt; &#039;post&#039;,\n        &#039;category_name&#039; =&gt; \u2018lesson\u2019,\n        &#039;posts_per_page&#039;=&gt; \u20184\u2019,\n    );\n    $wp_query-&gt;query( $my_posts );\n    if( $wp_query-&gt;have_posts() ): while( $wp_query-&gt;have_posts() ) : $wp_query-&gt;the_post();\n?&gt;\n\n&lt;div class=&quot;col boxed lesson-post&quot;&gt;\n&lt;?php\nget_template_part(&#039;content&#039;,&#039;lesson&#039;)\n?&gt;\n&lt;\/div&gt;&lt;!-- lesson-post --&gt;\n&lt;?php\n\n     endwhile; endif;\n\nwp_reset_postdata();\n\n?&gt;\n&lt;\/div&gt;\n<\/code><\/pre>\n<p>\u3069\u306a\u305f\u304b\u3001\u304a\u6559\u3048\u9858\u3048\u308c\u3070\uff01\uff01\u3000\u3069\u3046\u305e\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3044\u305f\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"template":"","class_list":["post-215554","topic","type-topic","status-publish","hentry","topic-tag-25660"],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/215554","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":3,"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/215554\/revisions"}],"predecessor-version":[{"id":215557,"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/215554\/revisions\/215557"}],"wp:attachment":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=215554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}