• I have this structure:

    Home
     sub 1
      sub sub
      sub sub
      sub sub
      sub sub
    sub 2
      sub sub
      sub sub
      sub sub
      sub sub
    sub 3
      sub sub
      sub sub
      sub sub
      sub sub

    I run this on my home template and what it does is print 3 titles sub pages and for each sub page it prints 3 of their childs contents:

    <?php $counter = 1 ?>
    <div class="row-fluid">
    <a class="loadNext" href="#">Load more</a>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php
    $pages = get_pages('child_of='.$post->ID.'&sort_order=asc&sort_column=menu_order&parent='.$post->ID);
    foreach($pages as $page) { ?>
    
    <h2><?php echo $page->post_title ?></h2>
    
    <?php $pages = get_pages('child_of='.$page->ID.'&sort_order=asc&sort_column=menu_order&parent='.$page->ID);
        foreach($pages as $page) {
            $content = $page->post_content;
            $content = apply_filters('the_content', $content); ?>
    
            <div class="span4">
                <?php echo $content ?>
            </div>

    What I would like to is to do is have a “load more” button to load the other sub pages with an ajax since I am limiting a max of 3 subpages to be displayed.

    Looking around on the net I am only finding articles in regards of “Load dmore posts” but what about more pages or sub page sin my case?

    1: This loads more posts when we scroll, but then again, it’s posts

    2: This actually has a button which is what I need but once again, it’s about loading posts and not pages

    Anyone please? Thanks

  • The topic ‘Load more subpages with ajax?’ is closed to new replies.