I’d like to create an “All Posts” page on the Ocean Bytes blog that contains an unordered list of all Titles of the posts to date, with each title hyperlinking to its blog post.
There appear to be several plugins that do something like this, but most do not list WordPress 3.0+ as supported yet, or they want to subset the blog postings by Year and then Month which is not desired.
Any suggestions for the “best way”?
Thx.
Create a new template file and do this as the loop:
Then just use that template for a page and it’ll automatically generate the page. Check out the codex page for
query_posts()
for more information on how to change the query.The “Best Way” would be with a custom page template. Just like
index.php
loops through all the posts, you can run a custom query to loop through everything and only echo the information you want (title, URL) to the browser.Here are some good tutorials for building a custom page template:
I ended up creating a page template called “allposts-page.php” in the Twenty-Ten Themes folder containing the following code:
I then created a new page using the WordPress Admin system with a title of “All Posts” and selected the “All Posts” template from the drop-down. Didn’t need to enter anything in the body.
The resulting page can be found via:
http://www.oceanbytes.org/all-posts/
The default for “wp_get_archives” is “monthly” but I chose “postbypost” as I wanted to just list all posts as on long list. More options can be found on the WordPress site via Function Reference/wp get archives