1

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));
        }
    }
}
1
  • Did you ever figure this out? I'm looking for the same thing.
    – kel
    Jun 21, 2013 at 17:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.