Checks a specified post’s content for gallery and, if present, return the first
Parameters
Source
}
continue;
}
// New Gallery block format as HTML.
if ( $has_inner_blocks && $html ) {
$block_html = wp_list_pluck( $block['innerBlocks'], 'innerHTML' );
$galleries[] = '<figure>' . implode( ' ', $block_html ) . '</figure>';
continue;
}
$srcs = array();
// New Gallery block format as an array.
if ( $has_inner_blocks ) {
Changelog
Version | Description |
---|---|
3.6.0 | Introduced. |
If there is no gallery present in the page, the function will return
false
(boolean).Example
Output each image in a gallery with our own custom image class when using data output and not HTML:
Example data output