Checks a post’s content for galleries and return the image srcs for the first found gallery.
Description
See also
Parameters
Source
*
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
* @return string[] A list of a gallery's image srcs in order.
*/
Changelog
Version | Description |
---|---|
3.6.0 | Introduced. |
Example
A simple example of how to append the raw image URLs to the content of any post or page that has at least one gallery.
This does not work if the gallery type is set to ‘slideshow’. It returns nothing. Removing type=”slideshow” from the gallery shortcode allows the images to be picked up by this function.