{"id":897,"date":"2006-06-11T05:06:08","date_gmt":"2006-06-10T20:06:08","guid":{"rendered":"http:\/\/a-tak.com\/xoops2\/modules\/wordpress\/2006\/06\/11\/897"},"modified":"2011-08-12T12:49:18","modified_gmt":"2011-08-12T03:49:18","slug":"post-count-custom-block","status":"publish","type":"post","link":"https:\/\/a-tak.com\/blog\/2006\/06\/post-count-custom-block\/","title":{"rendered":"XOOPS\u7248WordPress\u306e\u6295\u7a3f\u6570\u3092\u8868\u793a\u3059\u308b\u30ab\u30b9\u30bf\u30e0\u30d6\u30ed\u30c3\u30af"},"content":{"rendered":"<div id=\"advads-319471367\" class=\"advads-before-content-placement advads-entity-placement\" style=\"margin-left: auto;margin-right: auto;text-align: center;\"><div class=\"advads-adlabel\">\u5e83\u544a<\/div><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-7585646298782746\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:inline-block;width:300px;height:250px;\" \ndata-ad-client=\"ca-pub-7585646298782746\" \ndata-ad-slot=\"6112122906\"><\/ins> \n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div><p>\n<img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" height=\"123\" alt=\"total-entry-count.png\" hspace=\"0\" src=\"https:\/\/i0.wp.com\/a-tak.com\/blog\/wp-content\/uploads\/attach\/W_Upload\/total-entry-count.png?resize=225%2C123&#038;ssl=1\" width=\"225\" border=\"1\" \/>\n<\/p>\n<p>\nXOOPS\u306e\u30ab\u30b9\u30bf\u30e0\u30d6\u30ed\u30c3\u30af\u3067\u30d6\u30ed\u30b0\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u6570\u3092\u8868\u793a\u3057\u3066\u307f\u307e\u3057\u305f\u3002\n<\/p>\n<p><!--more--><\/p>\n<p>\n\u6700\u521d\u3001PHP\u306e\u672c\u898b\u306a\u304c\u3089\u3053\u3093\u306a\u611f\u3058\u3067\u4f5c\u308a\u307e\u3057\u305f\u3002\n<\/p>\n<blockquote>\n<p>\n&lt;?php<br \/>\n$conn = mysql_connect(&#8220;localhost&#8221;,&#8221;user&#8221;,&#8221;password&#8221;);<br \/>\nmysql_select_db(&#8220;xoops&#8221;);<br \/>\n$sql = &#8216;SELECT count(ID) As post_count FROM `xoops_wp_posts`&#8217;;<br \/>\n$res = mysql_query($sql);\n<\/p>\n<p>\nwhile ($value = mysql_fetch_assoc($res)) {<br \/>\nprint $value[&#8220;post_count&#8221;];<br \/>\n}<br \/>\n?&gt;\n<\/p>\n<\/blockquote>\n<p>\nDB\u306b\u63a5\u7d9a\u3057\u3066\u30af\u30a8\u30ea\u6295\u3052\u3066\u307f\u305f\u306e\u3067\u3059\u304c\u3001XOOPS\u5185\u306ePHP\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u307e\u305a\u3001&lt;?php&gt;\u306f\u5fc5\u8981\u306a\u3044\u3088\u3046\u3067\u3059\u3002<br \/>\n\u305d\u3057\u3066\u3001\u3053\u3061\u3089\u3092\u898b\u308b\u3068\u3082\u3063\u3068\u826f\u3044\u65b9\u6cd5\u304c\u3042\u3063\u305f\u307f\u305f\u3044\u306a\u306e\u3067\u3001\u305d\u308c\u3067\u4fee\u6b63\u3057\u3066\u307f\u307e\u3057\u305f\u3002\n<\/p>\n<blockquote>\n<p>\nglobal $xoopsUser,$xoopsDB;<br \/>\n$sql = &#8220;SELECT count(p.ID) As post_count FROM &#8220;.$xoopsDB-&gt;prefix(&#8216;wp_posts&#8217;).&#8221; p WHERE p.post_status=&#8217;publish&#8217; AND p.post_date &lt;= NOW()&#8221;;<br \/>\nlist($count) =$xoopsDB-&gt;fetchRow($xoopsDB-&gt;queryF($sql));<br \/>\necho&#8221;&lt;b&gt;$count&lt;\/b&gt; \u4ef6&lt;br \/&gt;&#8221;;\n<\/p>\n<\/blockquote>\n<p>\n\u30e6\u30fc\u30b6\u30fc\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3001DB\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u53d6\u308c\u308b\u3093\u3067\u3059\u306d\u30fc\u3002\u306a\u3093\u304b\u3059\u3063\u304d\u308a\u3057\u3066\u826f\u304b\u3063\u305f\u3002\u30ab\u30a6\u30f3\u30c8\u3082\u672a\u6765\u306e\u5206\u306f\u542b\u3081\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u3046\u3093\u3001\u3070\u3063\u3061\u308a\u3002<br \/>\n[2006.10.9\u8ffd\u8a18]<br \/>\npublish\u306e\u8a18\u4e8b\u306e\u307f\u30ab\u30a6\u30f3\u30c8\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002private\u3084\u4e00\u6642\u4fdd\u5b58\u72b6\u614b\u306e\u8a18\u4e8b\u306f\u30ab\u30a6\u30f3\u30c8\u3057\u307e\u305b\u3093\u3002\n<\/p>\n<p>\n\u73fe\u5728\u3067\u7dcf\u30a8\u30f3\u30c8\u30ea\u30fc\u6570\u306f882\u4ef6\u3002\u3082\u3046\u5c11\u3057\u884c\u3063\u3066\u308b\u3068\u601d\u3063\u305f\u3093\u3067\u3059\u3051\u3069\u3001\u3053\u3093\u306a\u3082\u3093\u306a\u3093\u3067\u3059\u306d\u3002<br \/>\n\u4e03\u6708\u3067\u3001\u3082\u3046\u4e38\u4e09\u5e74\u3050\u3089\u3044\u30d6\u30ed\u30b0\u3092\u7d9a\u3051\u3066\u308b\u3053\u3068\u306b\u306a\u308b\u306e\u3067\u3059\u304c\u3001\u305d\u3046\u8003\u3048\u308b\u3068\u3001\u5e74\u5e73\u5747\u3067294\u4ef6\u3060\u304b\u3089\u3001\u6bce\u65e5\u3067\u306f\u306a\u3044\u3051\u3069\u5e74\u9593\u306e8\u5272\u3050\u3089\u3044\u5206\u306b\u3042\u305f\u308b\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u66f8\u3044\u3066\u3044\u308b\u3053\u3068\u306b\u306a\u308b\u306e\u3067\u3059\u306d\u3002<br \/>\n\u3057\u304b\u3057\u3001\u3053\u306e\u4e09\u5e74\u3042\u307e\u308a\u305f\u3044\u3057\u305f\u3053\u3068\u3084\u3063\u3066\u306a\u3044\u306a\u30fc\u3002\u306a\u3093\u304b\u3082\u3063\u3068\u30c9\u30e9\u30b9\u30c6\u30a3\u30c3\u30af\u306b\u30c9\u30e9\u30de\u30c6\u30a3\u30c3\u30af(\u7b11)\u306b\u306a\u3093\u304b\u5909\u5316\u304c\u306a\u3044\u3068\u3044\u304b\u3093\u3067\u3059\u308f\u3002<\/p><div id=\"advads-1091152068\" class=\"advads-content-placement-after-3rd-paragraph advads-entity-placement\" style=\"margin-left: auto;margin-right: auto;text-align: center;\"><div class=\"advads-adlabel\">\u5e83\u544a<\/div><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-7585646298782746\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:inline-block;width:300px;height:250px;\" \ndata-ad-client=\"ca-pub-7585646298782746\" \ndata-ad-slot=\"6112122906\"><\/ins> \n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>XOOPS\u306e\u30ab\u30b9\u30bf\u30e0\u30d6\u30ed\u30c3\u30af\u3067\u30d6\u30ed\u30b0\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u6570\u3092\u8868\u793a\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"author":1,"featured_media":5245,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[479],"tags":[9,44],"class_list":["post-897","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-xoops","tag-wordpress","tag-xoops"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/a-tak.com\/blog\/wp-content\/uploads\/2012\/06\/total-entry-count1.png?fit=225%2C123&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/a-tak.com\/blog\/wp-json\/wp\/v2\/posts\/897","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/a-tak.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/a-tak.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/a-tak.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/a-tak.com\/blog\/wp-json\/wp\/v2\/comments?post=897"}],"version-history":[{"count":0,"href":"https:\/\/a-tak.com\/blog\/wp-json\/wp\/v2\/posts\/897\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/a-tak.com\/blog\/wp-json\/wp\/v2\/media\/5245"}],"wp:attachment":[{"href":"https:\/\/a-tak.com\/blog\/wp-json\/wp\/v2\/media?parent=897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/a-tak.com\/blog\/wp-json\/wp\/v2\/categories?post=897"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/a-tak.com\/blog\/wp-json\/wp\/v2\/tags?post=897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}