adamohern
Member
Posted 3 years ago #
Hi folks:
I'm hoping to find a way of easily "attaching" images to a given post, but without inserting them into the body of said post (I'd rather be able to call them independently of the post body). Is this possible in wp 2.6? Are media-gallery images associated with the post in any way that I can take advantage of?
Thanks!
Adam
Are media-gallery images associated with the post in any way that I can take advantage of?
Yes, images that you upload/attach to a post are children of that post, whether you insert them into the post itself or not.
WordPress makes post attachments. When you're editing a post and use the uploader, every file you upload gets its own attachment post, with the post_parent set to the original post ID.
adamohern
Member
Posted 3 years ago #
Sounds perfect! How would I access attached posts ("child" posts?) from a theme? Do I need a custom query, or is there an easier way?
Thanks again!
adamohern
Member
Posted 3 years ago #
Ah, looks like get_children is what I was after. Much obliged!!