[wp-hackers] Access to Media Library for Theme Options?

Matt Martz matt at sivel.net
Mon Aug 31 17:39:51 UTC 2009


On Mon, Aug 31, 2009 at 1:34 PM, Mike Walsh<mike_walsh at mindspring.com> wrote:
> As part of a theme I am working on, I would like allow a couple settings on
> the Theme Options page to use content from the Media Library.  I spent some
> time today looking through the Codex trying to find functions that will let
> me reference the Media Library but everything I could find seems to be tied
> to posts which my media may or may not be.
>
> Is there a way to get all of the ids for the Media Library content without
> have to construct my own query?  As far as I can tell, once I have ids,
> getting the rest of the information about the attachments is pretty
> straightforward.
>
> Thanks,
>
> Mike

You should be able to do:

$attachments = get_posts('post_type=attachment');

-- 
Matt Martz
matt at sivel.net
http://sivel.net/


More information about the wp-hackers mailing list