get list of posts in widget admin panel? (2 posts)

  1. sporkme
    Posted 3 years ago #

    I'm trying to put together a widget that can present a user with a list posts in a particular custom post type as a dropdown. I've gone over the basic widget creation steps and I'm comfortable with that - creating the display, showing a form, saving and retrieving options. What I'm unclear on is how to run a query on the admin side of the widget. I'd like to get a list of posts matching my criteria (ie: post type, is published) which I could then spit out in a loop and put in a select dropdown.

    Any pointers? Google is showing me how to do this on the user-facing side of the widget, but nothing on the admin side.

  2. bcworkz
    Posted 3 years ago #

    The process is the same, except instead of the code to get the posts and build the dropdown being in the widget() method, it is in the form() method.

Topic Closed

This topic has been closed to new replies.

About this Topic