views:

16

answers:

1

I'd like to create a drop down menu with all posts currently on my site using Wordpress 3.0. How can I fetch this data from the database using the wordpress API?

A: 

Just get query_posts to fetch the posts you want, then add them to the ddl in the loop.

Steven
That's pretty much it, but be careful if there's the possibility of dealing with large numbers of posts. You'll run out of memory.Depending on how it needs to be used some kind of live search or heavily filtered query will be in order.I list every post in my blog on my archives page and filter the query to only retrieve the bare necessities needed to qualify for using the built in permalink functions and it reduced ram overhead considerably. Otherwise the page would have been unusable.If you have to do the heavy query a lot consider storing the result in a transient.
Gipetto