• Is there any plugin that can shorten the listing of pages to the top few (say 5), and show a “more” link to go to another subpage to show the complete listing?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Don’t know if there is a plugin for that but, you could do that by getting the pages, converting that to an array and then echo the first 5:

    <?php
    $howmany = 5;
    
    $pages = wp_list_pages("echo=0&title_li=");
    
    $pages_arr = explode("\n", $pages);
    
    for($i=0;$i<$howmany;$i++){
    	echo $pages_arr[$i];
    }
    
    ?>

    Then put a link to a page that lists them all… kinda like:

    <li><a href="url.to/page">More...</a></li>

    Hope that helps

    Thread Starter rocketlures

    (@rocketlures)

    Thank you, Wp_guy….most helpful ??

    Hi,

    Thank you wp_guy for this very useful tip.

    I would like to do something like:
    – list the first five child pages
    – create a new page (like nextpage quicktag do)
    – list the next five child pages
    – create a new page
    ….

    Thanks for your help

    WP-GUY you are srsly a legend. I’ve been wondering how to do this for AGES now and you just saved me from stuffing up my code so THANKYOU!:D:D:D

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘limit number of pages shown from of wp_list_pages, and a read more link’ is closed to new replies.