I’m currently working on a theme that supports image, gallery, link and quote post formats. But the problem is that whenever I try to get attachments of a post that has a post-format other than standard (like image, gallery etc.) it returns an empty array.
But when I use the same functions with standard post types, they work just fine and returns all the attachments. I have not been able to sort the problem yet.
Here is the code that I use inside the loop:
Oh yeah…!! thanks man, you are great 🙂 , the image is not showing up in “uploaded to this post”.
but I’m still wondering why the image is not being shown in the “uploaded to this post” when it’s appearing in the content as a caption image. Shouldn’t the caption image work as an attachment?
I have a similar problem.
I notice that if I upload an image into a post, this image is considered an “attachment” (and the above code works fine), but if i get an image from the media library and insert it into the post, this is not considered an attachment (So the above code returns nothing).
I’d like to catch the images in both the situation (uploaded or taken from the media library). How I can do this? I still have to use get_children() or i must use another function?
As far as I have searched about it, you can’t “attach” an image to a post unless you upload one for it. You will have to upload an image to a post in order to attach it since insertion and attachment are two different things.
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘[Resolved] get_children() and get_posts() not working’ is closed to new replies.