{"id":581,"date":"2019-10-15T16:13:23","date_gmt":"2019-10-15T08:13:23","guid":{"rendered":"https:\/\/www.linuxdevops.cn\/?p=581"},"modified":"2019-10-15T16:15:37","modified_gmt":"2019-10-15T08:15:37","slug":"wordpress-new-page-paging","status":"publish","type":"post","link":"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/","title":{"rendered":"WordPress\u65b0\u5efa\u9875\u9762\uff0c\u5206\u9875"},"content":{"rendered":"\n
<?php\n\/*\nTemplate Name: test1\n*\/\n?>\n<?php\n\nget_header();\ndo_action( 'ample_blog_breadcrumb_type' );\n?>\n\n    <head>\n        <title>\u7f51\u7ad9\u6536\u85cf<\/title>\n    <\/head>\n<!--\/\/\u5185\u5bb9-->\n    <div class=\"col-md-8 content-wrap\" id=\"primary\">\n        <table class=\"table-hover \">\n            <tr class=\"active\">\n                <td class=\"td\">ID<\/td>\n                <td class=\"td\">\u7f51\u7ad9<\/td>\n                <td class=\"td\">\u7f51\u5740<\/td>\n                <td class=\"td\">\u7b80\u4ecb<\/td>\n            <\/tr>\n            <?php\n            $total = $wpdb->get_var(\"select count<\/em>(*) from wp_collection\");\n            $comments_per_page = 3;\n            $page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1;\n            $nowPage = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1;\n            $offset = ($nowPage-1)*$comments_per_page;\n            $results = $wpdb->get_results(\"select * from wp_collection  ORDER BY id limit  $offset , $comments_per_page\");\n            foreach ($results as $result) {\n             ?>\n                <tr class=\"success\">\n                    <td class=\"td\"><?php echo $result->id ?><\/td>\n                    <td class=\"td\"><?php echo $result->site_name ?><\/td>\n                    <td class=\"td\"><a href=\"<?php echo $result->url ?>\" target=\"_blank\"><?php echo $result->url ?><\/a><\/td>\n                    <td class=\"td\"><?php echo $result->jianjie ?><\/td>\n                <\/tr>\n\n            <?php } ?>\n\n        <\/table>\n        <div class=\"pager\">\n            <?php\n            echo paginate_links( array(\n                'base' => add_query_arg( 'cpage', '%#%' ),\n                'format' => '',\n                'prev_text' => __('\u4e0a\u4e00\u9875;'),\n                'next_text' => __('\u4e0b\u4e00\u9875;'),\n                'total' => ceil($total \/ $comments_per_page),\n                'current' => $page\n            ));\n            ?>\n        <\/div>\n    <\/div>\n\n<!--\/\/\u53f3\u4fa7-->\n    <div class=\"col-md-4 sidebar-wrap\" id=\"secondary\">\n        <?php get_sidebar(); ?>\n    <\/div>\n<!--\/\/\u9875\u811a-->\n<?php\nget_footer();\n?><\/pre>\n\n\n\n

\u5206\u9875\u51fd\u6570\uff1a https:\/\/www.boke8.net\/wordpress-paginate_links.html<\/a> <\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"

<?php \/* Template Name: test1 *\/ ?> <?php get_<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"yoast_head":"\nWordPress\u65b0\u5efa\u9875\u9762\uff0c\u5206\u9875 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WordPress\u65b0\u5efa\u9875\u9762\uff0c\u5206\u9875 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\" \/>\n<meta property=\"og:description\" content=\"<?php \/* Template Name: test1 *\/ ?> <?php get_\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-15T08:13:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-10-15T08:15:37+00:00\" \/>\n<meta name=\"author\" content=\"\u7ba1\u7406\u5458\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/\"},\"author\":{\"name\":\"\u7ba1\u7406\u5458\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"headline\":\"WordPress\u65b0\u5efa\u9875\u9762\uff0c\u5206\u9875\",\"datePublished\":\"2019-10-15T08:13:23+00:00\",\"dateModified\":\"2019-10-15T08:15:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/\"},\"wordCount\":8,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"articleSection\":[\"PHP+HTML\u524d\u7aef\"],\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/\",\"url\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/\",\"name\":\"WordPress\u65b0\u5efa\u9875\u9762\uff0c\u5206\u9875 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\",\"isPartOf\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#website\"},\"datePublished\":\"2019-10-15T08:13:23+00:00\",\"dateModified\":\"2019-10-15T08:15:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/#breadcrumb\"},\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.linuxdevops.cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PHP+HTML\u524d\u7aef\",\"item\":\"https:\/\/www.linuxdevops.cn\/php\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"WordPress\u65b0\u5efa\u9875\u9762\uff0c\u5206\u9875\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#website\",\"url\":\"https:\/\/www.linuxdevops.cn\/\",\"name\":\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\",\"description\":\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\u7b14\u8bb0\",\"publisher\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"alternateName\":\"linuxdevops\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.linuxdevops.cn\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-CN\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\",\"name\":\"\u7ba1\u7406\u5458\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-CN\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg\",\"contentUrl\":\"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg\",\"width\":512,\"height\":512,\"caption\":\"\u7ba1\u7406\u5458\"},\"logo\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/\"},\"description\":\"\u7ba1\u7406\u5458\",\"url\":\"https:\/\/www.linuxdevops.cn\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WordPress\u65b0\u5efa\u9875\u9762\uff0c\u5206\u9875 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/","og_locale":"zh_CN","og_type":"article","og_title":"WordPress\u65b0\u5efa\u9875\u9762\uff0c\u5206\u9875 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","og_description":"<?php \/* Template Name: test1 *\/ ?> <?php get_","og_url":"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/","og_site_name":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","article_published_time":"2019-10-15T08:13:23+00:00","article_modified_time":"2019-10-15T08:15:37+00:00","author":"\u7ba1\u7406\u5458","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/#article","isPartOf":{"@id":"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/"},"author":{"name":"\u7ba1\u7406\u5458","@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"headline":"WordPress\u65b0\u5efa\u9875\u9762\uff0c\u5206\u9875","datePublished":"2019-10-15T08:13:23+00:00","dateModified":"2019-10-15T08:15:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/"},"wordCount":8,"commentCount":0,"publisher":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"articleSection":["PHP+HTML\u524d\u7aef"],"inLanguage":"zh-CN","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/","url":"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/","name":"WordPress\u65b0\u5efa\u9875\u9762\uff0c\u5206\u9875 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","isPartOf":{"@id":"https:\/\/www.linuxdevops.cn\/#website"},"datePublished":"2019-10-15T08:13:23+00:00","dateModified":"2019-10-15T08:15:37+00:00","breadcrumb":{"@id":"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/#breadcrumb"},"inLanguage":"zh-CN","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.linuxdevops.cn\/2019\/10\/wordpress-new-page-paging\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.linuxdevops.cn\/"},{"@type":"ListItem","position":2,"name":"PHP+HTML\u524d\u7aef","item":"https:\/\/www.linuxdevops.cn\/php\/"},{"@type":"ListItem","position":3,"name":"WordPress\u65b0\u5efa\u9875\u9762\uff0c\u5206\u9875"}]},{"@type":"WebSite","@id":"https:\/\/www.linuxdevops.cn\/#website","url":"https:\/\/www.linuxdevops.cn\/","name":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","description":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\u7b14\u8bb0","publisher":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"alternateName":"linuxdevops","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.linuxdevops.cn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-CN"},{"@type":["Person","Organization"],"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1","name":"\u7ba1\u7406\u5458","image":{"@type":"ImageObject","inLanguage":"zh-CN","@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/","url":"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg","contentUrl":"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg","width":512,"height":512,"caption":"\u7ba1\u7406\u5458"},"logo":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/"},"description":"\u7ba1\u7406\u5458","url":"https:\/\/www.linuxdevops.cn\/author\/root\/"}]}},"_links":{"self":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/581"}],"collection":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/comments?post=581"}],"version-history":[{"count":3,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/581\/revisions"}],"predecessor-version":[{"id":584,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/581\/revisions\/584"}],"wp:attachment":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/media?parent=581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/categories?post=581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/tags?post=581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}