2011-05-17 94 views
0

嗯,夥計們我只是問,我怎樣才能在WordPress關於美國靜態頁面添加分頁。其實我只是在靜態頁面中添加帖子,但它只顯示我想要的所有帖子的帖子,這就是爲什麼我需要分頁。請記住,我只是在靜態頁面中詢問分頁,而不是在分類中。如何在wordpress靜態頁面中添加分頁?

+2

你是如何查詢帖子的?你能顯示一些代碼嗎? – 2011-05-17 17:48:58

回答

3

我在您的文章中看不到任何代碼。我以自己的方式完成了它,檢查了這一點。

//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 
} 

謝謝。