• I am using this code to generate contents from the child of that parent Page:

    <?php $posts = @$wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status='static' AND post_parent='$pageID' ORDER BY post_title ASC"); if($posts) : foreach($posts as $post) : start_wp(); ?>

    As the number of children Pages are growing, is there a way such that I can create pages of that list after X number of child Pages are listed?

    thanks

Viewing 1 replies (of 1 total)
  • Hmm, it might take a little trial-and-error, but here’s what I would do:

    LIMIT the query to X number of posts:

    <?php switch ($_GET['pagenum']) {
    case 1: default: $limit = "10"; break;
    case 2: $limit = "10,20"; break;
    case 3: $limit = "20,30"; break;

    }

    $posts = @$wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status='static' AND post_parent='$pageID' ORDER BY post_title ASC LIMIT ".$limit);

    And add links to each page by making the URL https://example.com/parent/?pagenum=2

    And that will return a page with the 10th to 20th children.

    … That’s the best I can think of. There may be a more elegant way. Good luck.

Viewing 1 replies (of 1 total)
  • The topic ‘Looping of child Pages’ is closed to new replies.