Ilja
Ilja

Reputation: 46479

WordPress loop to include pages content instead of posts

I am developing a one page WordPress theme, there is no need to display any posts, it's just informative page, I was thinking to use static content, but it turned out that I'll need to use dynamic one in order for things like search to work. In "pages" section of WordPres I created a new page which contains all the content I need, I was trying to figure out a loop to include contents of that page, but failed. After doing a research I was only able to find loops used to display content of posts. So is there same loop, but to display contents of page? Also How would I than include those contents in a page e.g.
<?php something();?>

Upvotes: 0

Views: 2821

Answers (1)

BenM
BenM

Reputation: 53198

Just specify the post_type inside of the query_posts() parameter. For example, if you wanted to output the content of each page, you could do this:

query_posts(array('post_type' => 'page'));
while(have_posts()) 
{ 
    echo the_content();
}

For reference, you might want to check out the API Reference Docs for query_posts().

Upvotes: 4

Related Questions