I have some very long posts, some have more than 50 pages (<!--nextpage-->
) and when using wp_link_pages
, it give me 50 internal post links, clearly this isn’t usable.
How can I add a range to the wp_link_pages
function?
The output should look like this: …4 – 5 – 6 – 7 – 8…
UPDATE 10/1/2012:
I’ve got the logic for adding the range but now I need to figure out how to add it to the existing wp_link_pages
function?
Here is the example function:
function limitPagination(){
$displayPages = 5;
$firstPage = 1;
$lastPage = $numpages > 5;
while($numpages > $displayPages){
if(($pageNow > $firstPage +2) && ($pageNow < $lastPage - 2)){
echo (($pageNow - 2).($pageNow - 1).$pageNow.($pageNow + 1).($pageNow + 2));
}
}
}