好吧,伙计们,我只是在问,我怎样才能在wordpress的静态页面中添加分页,比如关于我们。实际上我只是在静态页面中添加帖子,但它只显示几个帖子,我想要所有的帖子,这就是为什么我需要一个分页。请记住,我只是问静态页面中的分页,而不是类别中的分页。
发布于 2012-03-20 18:07:29
我在你的帖子里没看到任何代码。我已经用我自己的方式做了,看看这个。
//grab the URL into a string variable (i.e., "yoursite.com/page/2" )
$strURL = $_SERVER['REQUEST_URI'];
//array the elements in the string btwn "/" (i.e. [page], [2] )
$arrVals = split("/",$strURL);
//boolean var used to alert when the integer page var is next
$intnextone = 0;
//integer variable for pagenumber
$intpagenum = 0;
// loop through the array
foreach ($arrVals as $value) {
if ($intnextone == 1){$intpagenum=$value;} // assign var
if ($value == "page") {$intnextone =1;} //next loop is int
}谢谢。
https://stackoverflow.com/questions/6034906
复制相似问题