I have several posts that have a [gallery]
code without any picture IDs shown in the 'text' mode of the post content. Viewing the page shows the pictures in the gallery, but trying to extract the picture IDs within a customized function does not show the pictures. (The custom function - within my own plugin - uses the loop to display content in a specific format from the database; the content is eventually exported to a file for external use.)
The post was created with Postie (plugin that imports post content via an email); the email has pictures attached. (This is not a plugin question.)
The content when viewed in text mode shows something similar to this:
Here is text before the gallery shortcode.[gallery]
I have the get_post_gallery()
function within the loop with the sample code shown in the Codex:
$gallery = get_post_gallery( get_the_ID(), false );
But $gallery
does not return anything. I need to get the images that are attached to the empty [gallery] shortcode. The do_shortcode()
function (against the post content) doesn't give me what I need: I need to create an img tag with the image information (src, href, alt, class,etc).
How do I get the information about the images that are associated with an empty [gallery]
tag?
$post
object within your loop?