• Is there something wrong with this code? Because i can’t get to display the latest grandchild of ‘2’.
    Also, sort_order = desc doesn’t display anything.

    Thanks very muhc

    <?php
    echo 'get pages';
    $parent = '2';
    $args=array(
      'child_of' => $parent,
    
      'post_type' => 'page',
      'sort_column'=> 'post_date',
      'sort_order' => 'desc',
    'number' => 7
    
    );
    $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
    ?>
Viewing 1 replies (of 1 total)
  • Thread Starter radiofranky

    (@radiofranky)

    I used “posts_per_page” and it works with DESC and limiting page display number.

    “number” <= doesn’t work with get_pages. At least for me.. ??

Viewing 1 replies (of 1 total)
  • The topic ‘get_pages "numbers" and sort_order "desc" doesn't work’ is closed to new replies.