Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • I modified the following part of the code to get the pages to come up randomly, and set the number of pages to show up:

    $args=array('child_of' => $parent, 'number' => 19); $pages = get_pages($args); shuffle($pages);

    The no. of pages output is rather weird though. If I put 12, I get 6. I put 19 as the number and I get 12 which is the number of pages I need. Weird!

    There is a workaround: make the multiple parents children of one parent if they’re not already, then use that parent to list just the grandchildren, almost like a ‘post_grandparent’.

    Found this code elsewhere on the support forums, seems to work for me:

    <?php
    echo 'get pages';
    $parent = 93;
    $args=array(
      'child_of' => $parent
    );
    $pages = get_pages($args);
    if ($pages) {
      foreach($pages as $post) {
        setup_postdata($post);
        if ($post->post_parent != $parent ) { ?>
          <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
          <?php
        }
      } // foreach($pages
    } // if ($pages
    ?>

    I would also like to know if there is any way of doing multiple post_parent, or any kind of work around. It would be darn useful!

    Anyone?

Viewing 3 replies - 1 through 3 (of 3 total)