wpseek.com
WordPress开发者和主题制作者的搜索引擎



get_post_gallery › WordPress Function

Since3.6.0
已弃用n/a
get_post_gallery ( $post = 0, $html = true )
参数: (2)
  • (int|WP_Post) $post Optional. Post ID or WP_Post object. Default is global $post.
    Required: No
    默认:
  • (bool) $html Optional. Whether to return HTML or data. Default is true.
    Required: No
    默认: true
返回:
  • (string|array) Gallery data and srcs parsed from the expanded shortcode.
定义在:
文档:

Checks a specified post's content for gallery and, if present, return the first



源码

function get_post_gallery( $post = 0, $html = true ) {
	$galleries = get_post_galleries( $post, $html );
	$gallery   = reset( $galleries );

	/**
	 * Filters the first-found post gallery.
	 *
	 * @since 3.6.0
	 *
	 * @param array       $gallery   The first-found post gallery.
	 * @param int|WP_Post $post      Post ID or object.
	 * @param array       $galleries Associative array of all found post galleries.
	 */
	return apply_filters( 'get_post_gallery', $gallery, $post, $galleries );
}