Title: Adding more posts to the loop
Last modified: August 19, 2016

---

# Adding more posts to the loop

 *  Resolved [dcole07](https://wordpress.org/support/users/dcole07/)
 * (@dcole07)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/adding-more-posts-to-the-loop/)
 * When I load a particular page it has no posts, which by default is correct. However,
   I want to add a post into the loop before the loop is called by the template.
   Is there a way to do this? Something such as `add($post_id);`

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

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/adding-more-posts-to-the-loop/#post-940829)
 * Not too sure what you mean by “add a post into the loop”, but look at [Function_Reference/get_post](http://codex.wordpress.org/Function_Reference/get_post).
 *  Thread Starter [dcole07](https://wordpress.org/support/users/dcole07/)
 * (@dcole07)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/adding-more-posts-to-the-loop/#post-940838)
 * Most templates use `if(have_posts()) :` to check for posts, then use a while 
   statement to go through all the posts by checking `have_posts()` and calling `
   the_post()` each time through the loop.
 * The have_post() for the page I’m loading is empty, so no posts are displayed,
   because the query is empty. I want to insert another post into the query, so 
   there is a post… Or if 2 posts are found, there will be 3 posts (The 2 WordPress
   found and the one I added.)
 * I can’t use `get_post()`, because It’s important that it is done through the 
   normal post loading method.
 * Maybe I could add to $this->$posts and increase $this->$post_count, but I’m not
   sure how to refer to that correctly or add to it.
 *  [erigami](https://wordpress.org/support/users/erigami/)
 * (@erigami)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/adding-more-posts-to-the-loop/#post-940839)
 * I’d love a way to inject a post into the loop as well. The only alternative approach
   that I know of is to create a fake post in the database and use the where actions
   to filter it out.
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/adding-more-posts-to-the-loop/#post-940889)
 * Then you want to understand why your query has ‘nothing’.
 * Might review the [template tag](http://codex.wordpress.org/Template_Tags), [query_posts()](http://codex.wordpress.org/Template_Tags/query_posts),
   and [The Loop](http://codex.wordpress.org/The_Loop).
 *  Thread Starter [dcole07](https://wordpress.org/support/users/dcole07/)
 * (@dcole07)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/adding-more-posts-to-the-loop/#post-940933)
 * Thanks MichaelH,
 * My problem was solved by using `query_posts("cat=1&showposts=1");`.

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

The topic ‘Adding more posts to the loop’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)

 * 5 replies
 * 3 participants
 * Last reply from: [dcole07](https://wordpress.org/support/users/dcole07/)
 * Last activity: [17 years, 5 months ago](https://wordpress.org/support/topic/adding-more-posts-to-the-loop/#post-940933)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
