List WordPress posts in a page

I wanted to do something very simple:

Use a page in my blog in order to list all the posts that I have written in the blog.

After doing some attempts using the loop, that were unsuccessful (there is something when loading a page that is different than loading a post, and the loop is restricted to that page, so probably you need to work around with a new query), so I tried to use other functions:

wp_list_pages (http://codex.wordpress.org/Function_Reference/wp_list_pages) but as explained here: http://wordpress.stackexchange.com/questions/63567/wp-list-pages-refuses-to-output-posts it does not work for post_types that are not hierarchical, so it makes no sense to try to list the posts with it.

So I tried the function wp_get_archives (http://codex.wordpress.org/Function_Reference/wp_get_archives) and it works beautifuly.

Let me know your comments

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s