Php 拆分主页,每页显示5篇文章

Php 拆分主页,每页显示5篇文章,php,wordpress,Php,Wordpress,我怎样才能将显示帖子摘录的主页拆分成不同的页面,每页只显示5个摘录,并且有一个链接显示以前的帖子? 这样地: 你需要调查一下 您的脚本的工作流程与此类似 <?php $totalpost = 100; $currentpost = 0; $pagelimit = 5; $current_page = 0; $current_page_count = 0; $totalpages = $totalpost / $pagelimit; while($currentpost < $tota

我怎样才能将显示帖子摘录的主页拆分成不同的页面,每页只显示5个摘录,并且有一个链接显示以前的帖子? 这样地: 你需要调查一下 您的脚本的工作流程与此类似

<?php
$totalpost = 100;
$currentpost = 0;
$pagelimit = 5;
$current_page = 0;
$current_page_count = 0;
$totalpages = $totalpost / $pagelimit;
while($currentpost < $totalpost){
    $current_page_count = 0;
    while($current_page_count < $pagelimit){
        echo " $currentpost ";
        $currentpost++;
        $current_page_count++;
    }

    echo " <br> page $current_page <br>";
    $current_page++;
}
?>

我试图搜索谷歌,但没有找到答案,所以我在这里问。我知道这看起来很愚蠢,但我不知道怎么做。