Advertisement
Guest User

Untitled

a guest
Jun 17th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name:List page
  4. */
  5. ?>
  6. <?php get_header(); ?>
  7.  
  8. <div id="left" class="eleven columns" >
  9. <?php if (have_posts()) : ?>
  10. <?php while (have_posts()) : the_post(); ?>
  11.  
  12. <div class="post" id="post-<?php the_ID(); ?>">
  13. <div class="title">
  14. <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
  15. </div>
  16.  
  17. <div class="entry">
  18. <?php the_content('Read the rest of this entry &raquo;'); ?>
  19. <div class="clear"></div>
  20. </div>
  21. </div>
  22.  
  23. <?php endwhile; endif; ?>
  24.  
  25. <!-- Output child pages -->
  26. <?
  27. // The Query
  28. $currentPageId = $post->ID; // get current page id inside loop
  29. $args = array(
  30. 'post_parent' => $currentPageId,
  31. 'post_type' => 'page',
  32. 'posts_per_page' => -1
  33. );
  34. $query = new WP_Query( $args );
  35.  
  36. // The Loop
  37. if ( $query->have_posts() ) {
  38. echo '<ul>';
  39. while ( $query->have_posts() ) {
  40. $query->the_post();
  41. echo '<li>' . get_the_title() . '</li>'; // this one outputs only title
  42. }
  43. echo '</ul>';
  44. } else {
  45. // no posts found
  46. }
  47.  
  48. /* Restore original Post Data */
  49. wp_reset_postdata();
  50. ?>
  51.  
  52. </div>
  53.  
  54. <?php get_sidebar(); ?>
  55. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement