PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Populate dropdown with custom post type post name by author

  1. apertureboy


    I am using this code on this page to popluate a drop down with post titles from a custom post type called events. It is pulling in the 5 most recent titles ok. I need a few options though - how can it pull all the posts, not just 5. And, I have another form where logged in users can can submit that form, which creates the posts in the custom post type events. So, I need this dropdown to only show the post titles that they have created. Right now, the drop down is showing ALL events created by everyone - how can I populate it so its only showing posts that they have created?



    Posted 10 years ago on Friday July 13, 2012 | Permalink
  2. By default get_posts gets 5 posts.

    By adding numberposts = -1, you will get all.

    $posts = get_posts("post_type=$post_type&numberposts=-1");

    Posted 10 years ago on Thursday December 6, 2012 | Permalink