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

Mike Walsh mpwalsh8 at gmail.com
Mon Aug 31 19:29:13 UTC 2009


Thanks for the pointer, I was getting hung up on the "post" aspect of
the description.  It turns out there is an example in the Codex which
does most of what I was trying to do:

http://codex.wordpress.org/Function_Reference/get_children

Mike


On Mon, Aug 31, 2009 at 1:39 PM, Matt Martz<matt at sivel.net> wrote:
> 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/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list