Title: Adding posts to wp_list_pages
Last modified: August 19, 2016

---

# Adding posts to wp_list_pages

 *  [fthomas](https://wordpress.org/support/users/fthomas/)
 * (@fthomas)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/adding-posts-to-wp_list_pages/)
 * OK, the title may be misleading, but what I want to do is list the posts right
   along the same line as the pages as you would get from wp_list_pages or the like.
 * I’d like to perform this in a plugin format, basically doing an ‘add_filter’ 
   to the wp_list_pages.
 * Why? Simple, I”m running mini-sites with no more than a combined 8-10 posts and
   pages and posts have a lot of nice options that pages don’t.
 * help! I’ve been running around the php bush for days.
 * Frank

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

 *  [PBP_Editor](https://wordpress.org/support/users/pbp_editor/)
 * (@pbp_editor)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/adding-posts-to-wp_list_pages/#post-1292479)
 *     ```
       <?php query_posts('showposts=10');
       	  while (have_posts()) : the_post();
       	?>
   
       <ul>
       <li>
       <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><strong><?php the_title(); ?></strong></a>
       </li>
       </ul>
   
       <?php endwhile; ?>
       ```
   
 *  Thread Starter [fthomas](https://wordpress.org/support/users/fthomas/)
 * (@fthomas)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/adding-posts-to-wp_list_pages/#post-1292536)
 * Thanks for that PBP,
 * But when I have the ‘showposts=10’ in the query_posts, it will also show the 
   post titles right in the content area as well. But if I remove the ‘showposts’
   section, it scrambles the menu again.
 * here’s a snippit of code from the page:
 *     ```
       <div id="centeredmenu">
   
                 <!-- You will remove or add page numbers below -->
   
       <li class="pagenav"><ul>
         <?php wp_list_pages('title_li='); ?>
       /*  <?php query_posts('showposts=10');
       	  while (have_posts()) : the_post(); ?>
                <li>
                   <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
                </li>
       <?php endwhile; ?>*/
       </ul></li>
   
             </div>
   
           </div>  <!-- end of 'top_nav' -->     
   
         </div> 
   
         <!-- end #header -->
   
         <div id="content">
   
         <div id="sidebar">
   
           <ul>
   
           <li><a href="/"><?php bloginfo('name'); ?></a></li>
   
             <li><a href="/about/">About Us</a></li>
   
             <li><a href="/contact/">Contact Us</a></li>
   
             <li><a href="/privacy-policy/">Privacy Policy</a></li>
   
           </ul>
   
           <div id="linkAds">
   
       	   <?php if (function_exists(adsense_deluxe_ads)) adsense_deluxe_ads('link_ads'); ?>
   
           </div>
   
         </div>  <!-- end #sidebar -->
   
         <div id="blogcontent">
   
           <p align="center"><img src="<?php bloginfo('url') ?>/wp-content/uploads/images-1.jpg" alt="<?php the_title(); ?>" name="<?php the_title(); ?>" width="130" height="105" title="<?php the_title(); ?>" id="Image1" /><img src="<?php bloginfo('url') ?>/wp-content/uploads/images-2.jpg" alt="<?php the_title(); ?>" name="<?php the_title(); ?>" width="130" height="105" title="<?php the_title(); ?>" id="Image2" /><img src="<?php bloginfo('url') ?>/wp-content/uploads/images-3.jpg" alt="<?php the_title(); ?>" name="<?php the_title(); ?>" width="130" height="105" title="<?php the_title(); ?>" id="Image3" /><img src="<?php bloginfo('url') ?>/wp-content/uploads/images-4.jpg" alt="<?php the_title(); ?>" name="<?php the_title(); ?>" width="130" height="105" title="<?php the_title(); ?>" id="Image4" /></p>
   
           <div id="post">
   
              <div class="entry">
   
                 <!--remove this text and replace it with the article contents-->
   
                 		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
   
       		<div class="post" id="post-<?php the_ID(); ?>">
   
       		<h2><?php the_title(); ?></h2>
   
       			<div class="entry">
   
       				<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
   
       				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
   
       			</div>
   
       		</div>
   
       		<?php endwhile; endif; ?>
   
       	<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
   
              </div> <!--End of 'entry'-->
   
           </div> <!-- End of 'post' -->
       ```
   
 *  Thread Starter [fthomas](https://wordpress.org/support/users/fthomas/)
 * (@fthomas)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/adding-posts-to-wp_list_pages/#post-1292539)
 * Oh kay!
 * I figured it out!
 * For someone else who looks this up in the future (probably me in 6 months, lol),
   here’s the solution:
 * Have to make the query temporary or every other query will use the results messing
   up the page:
 *     ```
       <li class="pagenav"><ul>
         <?php wp_list_pages('title_li='); ?>
   
       <?php $temporary = $wp_query; // set the defined new query ?>
         <?php query_posts('showposts=10');
       	  while (have_posts()) : the_post(); ?>
                <li>
                   <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
                </li>
       <?php endwhile; $wp_query = $temporary; //reset it back to normal  ?>
       </ul></li>
       ```
   
 * I found a good explanation here: [http://brassblogs.com/cms-platforms/wordpress/creating-wordpress-themes-query_posts](http://brassblogs.com/cms-platforms/wordpress/creating-wordpress-themes-query_posts)
 * Thanks!
 * Frank

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

The topic ‘Adding posts to wp_list_pages’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [fthomas](https://wordpress.org/support/users/fthomas/)
 * Last activity: [16 years, 6 months ago](https://wordpress.org/support/topic/adding-posts-to-wp_list_pages/#post-1292539)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
