{"id":11943,"date":"2023-07-18T01:14:15","date_gmt":"2023-07-17T16:14:15","guid":{"rendered":"http:\/\/tcd-manual.net\/?p=11943"},"modified":"2024-03-21T11:28:23","modified_gmt":"2024-03-21T02:28:23","slug":"tcd%e3%83%86%e3%83%bc%e3%83%9enoel%ef%bc%9a%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e6%8a%95%e7%a8%bf%e3%82%bf%e3%82%a4%e3%83%97%e3%80%8c%e3%82%af%e3%83%aa%e3%83%8b%e3%83%83%e3%82%af%e3%80%8d%e8%a9%b3-2-3","status":"publish","type":"post","link":"https:\/\/tcd-manual.net\/?p=11943","title":{"rendered":"TCD\u30c6\u30fc\u30decommon\uff1a\u8ca9\u58f2\u6570\u30bc\u30ed\u306e\u5546\u54c1\u3092\u30e9\u30f3\u30ad\u30f3\u30b0\u306b\u542b\u307e\u306a\u3044\u3088\u3046\u306b\u3057\u305f\u3044"},"content":{"rendered":"<h2 class=\"styled_h2\">Q. \u56fa\u5b9a\u30da\u30fc\u30b8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u300c\u30e9\u30f3\u30ad\u30f3\u30b0\u30da\u30fc\u30b8\u300d\u3067\u3001\u8ca9\u58f2\u6570\u304c0\u306e\u5546\u54c1\u3082\u30e9\u30f3\u30ad\u30f3\u30b0\u306b\u542b\u307e\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/h2>\n<div class=\"cardlink\"><a class=\"cardlink-thumbnail\" href=\"https:\/\/demo.tcd-theme.com\/tcd097\/ranking\/\"><img decoding=\"async\" src=\"https:\/\/demo.tcd-theme.com\/tcd097\/wp-content\/uploads\/2022\/12\/ranking-header.jpg\"><\/a><div class=\"cardlink-content\"><div class=\"cardlink-date-title\"><a class=\"cardlink-title\" href=\"https:\/\/demo.tcd-theme.com\/tcd097\/ranking\/\">\u30e9\u30f3\u30ad\u30f3\u30b0\u30da\u30fc\u30b8 \u2013 WordPress\u30c6\u30fc\u30de\u300ccommon (tcd097)\u300d<\/a><\/div><div class=\"cardlink-excerpt\">\u30af\u30ea\u30a8\u30a4\u30bf\u30fc\u5411\u3051EC\u30b5\u30a4\u30c8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8<\/div><\/div><div class=\"cardlink-footer\"><\/div><\/div>\n\n<h2 class=\"styled_h2\">A. \u300cpage__ranking.php\u300d\u300cranking-product-loop.php\u300d\u306e2\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4fee\u6b63\u3057\u3066\u8ca9\u58f2\u65700\u306e\u5546\u54c1\u3092\u9664\u5916\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/h2>\n<p>common\u30c6\u30fc\u30de\u3067\u306f\u3001\u5546\u54c1\u306e\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u300ctotal_sales\u300d\u3092\u4f7f\u7528\u3057\u3066\u8ca9\u58f2\u6570\u9806\u306e\u30e9\u30f3\u30ad\u30f3\u30b0\u306e\u5bfe\u8c61\u3068\u306a\u308b\u5546\u54c1\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u308c\u3089\u306e\u30d5\u30a1\u30a4\u30eb\u3067\u306f\u3001\u5546\u54c1\u30ea\u30b9\u30c8\u306e\u4f5c\u6210\u6642\u306b\u4f7f\u7528\u3059\u308b<strong>\u30af\u30a8\u30ea\u30fc<\/strong>\u6761\u4ef6\u3092\u6307\u5b9a\u3057\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u3068\u304d\u3001<span class=\"q_underline q_underline3\" style=\"border-bottom-color:;\">total_sales\u306e\u5024\u304c0\u3088\u308a\u5927\u304d\u3044\u3082\u306e\u3060\u3051<\/span>\u3092\u5546\u54c1\u30ea\u30b9\u30c8\u306b\u542b\u3080\u3088\u3046\u3001<strong>\u30e1\u30bf\u30af\u30a8\u30ea\u30fc<\/strong>\u3068\u3044\u3046\u4ed5\u7d44\u307f\u3092\u4f7f\u7528\u3057\u3066\u3001\u6761\u4ef6\u3092\u7d5e\u308a\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3 class=\"styled_h3\">(1) page__ranking.php\uff1a15\uff5e22\u884c\u76ee<\/h3>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$query_args = array(\r\n  'posts_per_page' =&gt; $ranking_product_num,\r\n  'post_type' =&gt; 'product',\r\n  'post_status' =&gt; 'publish',\r\n  'ignore_sticky_posts' =&gt; 1,\r\n  'meta_key' =&gt; 'total_sales',\r\n  'orderby' =&gt; array( 'meta_value_num' =&gt; 'DESC', 'ID' =&gt; 'DESC' )\r\n);\r\n<\/pre>\n<p>\u2193\u2193\u2193<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$query_args = array(\r\n  'posts_per_page' =&gt; $ranking_product_num,\r\n  'post_type' =&gt; 'product',\r\n  'post_status' =&gt; 'publish',\r\n  'ignore_sticky_posts' =&gt; 1,\r\n  'meta_key' =&gt; 'total_sales',\r\n  'meta_query' =&gt; array(\r\n    array(\r\n      'key' =&gt; 'total_sales',\r\n      'value' =&gt; 0,\r\n      'compare' =&gt; '&gt;',\r\n      'type' =&gt; 'NUMERIC'\r\n    )\r\n  ),\r\n  'orderby' =&gt; array( 'meta_value_num' =&gt; 'DESC', 'ID' =&gt; 'DESC' )\r\n);    \r\n<\/pre>\n<h3 class=\"styled_h3\">(2) wc\/ranking-product-loop.php\uff1a191\uff5e197\u884c\u76ee<\/h3>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$args = array(\r\n  'posts_per_page' =&gt; $_POST&#x5B;&quot;product_num&quot;],\r\n  'post_type' =&gt; 'product',\r\n  'ignore_sticky_posts' =&gt; 1,\r\n  'meta_key' =&gt; 'total_sales',\r\n  'orderby' =&gt; array( 'meta_value_num' =&gt; 'DESC', 'ID' =&gt; 'DESC' )\r\n);\r\n<\/pre>\n<p>\u2193\u2193\u2193<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$args = array(\r\n  'posts_per_page' =&gt; $_POST&#x5B;&quot;product_num&quot;],\r\n  'post_type' =&gt; 'product',\r\n  'ignore_sticky_posts' =&gt; 1,\r\n  'meta_key' =&gt; 'total_sales',\r\n  'meta_query' =&gt; array(\r\n    array(\r\n      'key' =&gt; 'total_sales',\r\n      'value' =&gt; 0,\r\n      'compare' =&gt; '&gt;',\r\n      'type' =&gt; 'NUMERIC'\r\n    )\r\n  ),\r\n  'orderby' =&gt; array( 'meta_value_num' =&gt; 'DESC', 'ID' =&gt; 'DESC' )\r\n);\r\n<\/pre>\n<h3 class=\"styled_h3\">\u88dc\u8db3<\/h3>\n<ul>\n<li>\u6bd4\u8f03\u6f14\u7b97\u5b50\u306e\u300c>\u300d\u3084\u6570\u5b57\u306e\u300c0\u300d\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u3067\u6761\u4ef6\u3092\u30a2\u30ec\u30f3\u30b8\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u306e\u3067\u3001\u304a\u597d\u307f\u306e\u6761\u4ef6\u306b\u5408\u308f\u305b\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/li>\n<li>\u300c\u5546\u54c1\u300d\u306e\u30a8\u30c7\u30a3\u30bf\u30fc\u753b\u9762\u3067\u300c<strong>\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9<\/strong>\u300d\u3092\u8868\u793a\u3059\u308b\u3053\u3068\u3067\u3001total_sales\u306e\u5024\u3092\u78ba\u8a8d\u307e\u305f\u306f\u7de8\u96c6\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/li>\n<\/ul>\n<h3 class=\"styled_h3\">\u53c2\u8003\u60c5\u5831<\/h3>\n<p><a href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_meta_query\/\" rel=\"noopener\" target=\"_blank\" class=\"e_link\">WP_Meta_Query<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"Q. \u56fa\u5b9a\u30da\u30fc\u30b8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u300c\u30e9\u30f3\u30ad\u30f3\u30b0\u30da\u30fc\u30b8\u300d\u3067\u3001\u8ca9\u58f2\u6570\u304c0\u306e\u5546\u54c1\u3082\u30e9\u30f3\u30ad\u30f3\u30b0\u306b\u542b\u307e\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002 A. \u300cpage__ranking.php\u300d\u300cranking-product-loop.php\u300d\u306e2\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4fee [&hellip;]","protected":false},"author":22,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[862],"tags":[127,270],"class_list":["post-11943","post","type-post","status-publish","format-standard","hentry","category-tcd097","tag-127","tag-270"],"_links":{"self":[{"href":"https:\/\/tcd-manual.net\/index.php?rest_route=\/wp\/v2\/posts\/11943","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tcd-manual.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tcd-manual.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tcd-manual.net\/index.php?rest_route=\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/tcd-manual.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11943"}],"version-history":[{"count":0,"href":"https:\/\/tcd-manual.net\/index.php?rest_route=\/wp\/v2\/posts\/11943\/revisions"}],"wp:attachment":[{"href":"https:\/\/tcd-manual.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tcd-manual.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tcd-manual.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}