{"id":191129,"date":"2015-10-28T19:50:17","date_gmt":"2015-10-28T10:50:17","guid":{"rendered":""},"modified":"2016-09-15T22:33:33","modified_gmt":"2016-09-15T13:33:33","slug":"%e8%a8%98%e4%ba%8b%e3%82%bf%e3%82%a4%e3%83%88%e3%83%ab%e4%b8%80%e8%a6%a7%e3%82%92%e3%82%b7%e3%83%a7%e3%83%bc%e3%83%88%e3%82%b3%e3%83%bc%e3%83%89%e3%81%a7%e8%a1%a8%e7%a4%ba%e3%81%95%e3%81%9b%e3%81%9f","status":"closed","type":"topic","link":"https:\/\/ja.wordpress.org\/support\/topic\/%e8%a8%98%e4%ba%8b%e3%82%bf%e3%82%a4%e3%83%88%e3%83%ab%e4%b8%80%e8%a6%a7%e3%82%92%e3%82%b7%e3%83%a7%e3%83%bc%e3%83%88%e3%82%b3%e3%83%bc%e3%83%89%e3%81%a7%e8%a1%a8%e7%a4%ba%e3%81%95%e3%81%9b%e3%81%9f\/","title":{"rendered":"\u8a18\u4e8b\u30bf\u30a4\u30c8\u30eb\u4e00\u89a7\u3092\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u3067\u8868\u793a\u3055\u305b\u305f\u3044"},"content":{"rendered":"<pre><code>\/\/\u3053\u3053\u304b\u3089\u6295\u7a3f\u4e00\u89a7\u306e\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9(7\u4ef6)\n\nfunction postFunc($atts) {\n        extract(shortcode_atts(array(\n              &quot;num&quot; =&gt; &#039;7&#039;,\n              &quot;cat&quot; =&gt; &#039;&#039;\n        ), $atts));\n       global $post;\n       $myposts = get_posts(&#039;numberposts=&#039;.$num.&#039;&amp;order=DESC&amp;orderby=post_date&amp;category=&#039;.$cat);\n       $retour=&#039;&lt;ul&gt;&#039;;\n       foreach($myposts as $post) :\n              setup_postdata($post);\n              $retour.=&#039;&lt;li&gt;&lt;a href=&quot;&#039;.get_permalink().&#039;&quot;&gt;&#039;.the_title(&quot;&quot;,&quot;&quot;,false).&#039;&lt;\/a&gt;&lt;\/li&gt;&#039;;\n       endforeach;\n       $retour.=&#039;&lt;\/ul&gt; &#039;;\n       wp_reset_postdata();\n       return $retour;\n}\nadd_shortcode(&quot;postlist&quot;, &quot;postFunc&quot;);\n\n\/\/\u3053\u3053\u307e\u3067<\/code><\/pre>\n<p>functions.php\u306b\u4e0a\u8a18\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3059\u308b\u3068\u6307\u5b9a\u306e\u4ef6\u6570\u5206\u3046\u307e\u304f\u8868\u793a\u3055\u308c\u308b\u306e\u306b<br \/>\n\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3059\u308b\u30681\u4ef6\u3057\u304b\u8868\u793a\u3055\u308c\u306a\u304f\u306a\u308a\u307e\u3059\u3002<br \/>\n\u306a\u305c\u3053\u3046\u306a\u308b\u306e\u304b\u6559\u3048\u3066\u9802\u3051\u308b\u3068\u3046\u308c\u3057\u3044\u3067\u3059\u3002\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3057\u307e\u3059\u3002<br \/>\nWordpress\u521d\u5fc3\u8005\u3067\u3059\u3002<\/p>\n<pre><code>\/\/\u3053\u3053\u304b\u3089\u6295\u7a3f\u4e00\u89a7\u306e\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9(7\u4ef6)\n\nfunction postFunc($atts) {\n        extract(shortcode_atts(array(\n              &quot;num&quot; =&gt; &#039;7&#039;,\n              &quot;cat&quot; =&gt; &#039;&#039;\n        ), $atts));\n       \t$args=array(\n\t\t&#039;numberposts&#039; =&gt; &#039;.$num.&#039;,\n\t\t&#039;order&#039;       =&gt; &#039;DESC&#039;,\n\t\t&#039;orderby&#039;     =&gt; &#039;post_date&#039;,\n\t\t&#039;category&#039;    =&gt; &#039;.$cat&#039;\n);\n       global $post;\n       $myposts = get_posts($args);\n       $retour=&#039;&lt;ul&gt;&#039;;\n       foreach($myposts as $post) :\n              setup_postdata($post);\n              $retour.=&#039;&lt;li&gt;&lt;a href=&quot;&#039;.get_permalink().&#039;&quot;&gt;&#039;.the_title(&quot;&quot;,&quot;&quot;,false).&#039;&lt;\/a&gt;&lt;\/li&gt;&#039;;\n       endforeach;\n       $retour.=&#039;&lt;\/ul&gt; &#039;;\n       wp_reset_postdata();\n       return $retour;\n}\nadd_shortcode(&quot;postlist&quot;, &quot;postFunc&quot;);\n\n\/\/\u3053\u3053\u307e\u3067<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-191129","topic","type-topic","status-closed","hentry","topic-tag-14366","topic-tag-get_posts"],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/191129","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\/191129\/revisions"}],"wp:attachment":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=191129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}