WORDPRESS – EASILY LOOP THROUGH PAGE CHILDREN

The following code will let you create a custom “Wordpress Loop” that contains the post objects of the children of the current page.


Just drop this code in your theme file:


<?php
    $project_list = get_posts('numberposts=5&order=ASC&orderby=menu_order&post_type=page&post_parent='.$post->ID);
 
    foreach($project_list as $post):
    setup_postdata($post);
?>
    <div class="post" id="post-<?php the_ID(); ?>">
    </div>
 
<?php 
    endforeach; 
?>
  1. Djalma:

    Obrigado por este post…
    saberia resolver esse problema sem este post…
    valew pela força..

  2. Djalma:

    obs: Não saberia..rs

Leave a Reply