WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have following code in my .php file:

$my_pages = wp_list_pages("title_li=&child_of=".$my_id."&echo=0");

Then I create an <ul>

  <?php echo $my_pages; ?>

Problem is, that I would like to list a title in <h2> tag, and excerpt of the page on the text below. It´s possible to do that using wp_list_pages?

share|improve this question
You should instead consider WP_Query(), but if you must use wp_list_pages(), you should check how to use it with a custom walker. – birgire Apr 18 '13 at 20:57
up vote 0 down vote accepted

No, it is not possible. you will want to use WP_Query()

Here is the Codex Article on that.



// Query All Pages
$my_query = new WP_Query( 'post_type=page' );

// The Loop
while ( $my_query->have_posts() ) :
    echo '<h2>' . get_the_title() . '</h2><p>' . get_the_excerpt() . '</p>';    

share|improve this answer
A call to wp_reset_postdata after the loop would be beneficial. – Johannes Pille Apr 18 '13 at 20:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.