Ticket #24390: 24390.patch
| File 24390.patch, 1.1 KB (added by , 13 years ago) |
|---|
-
wp-includes/media.php
2369 2369 } 2370 2370 2371 2371 /** 2372 * Check a specified post's content for gallery and, if present, return the first 2372 * Check a specified post's content for gallery and, if present, return the first. 2373 2373 * 2374 2374 * @since 3.6.0 2375 2375 * 2376 2376 * @param int $post_id Optional. Post ID. 2377 * @param boolean $html Whether to return HTML or data 2378 * @return array Gallery data and srcs parsed from the expanded shortcode2377 * @param boolean $html Whether to return HTML or data. 2378 * @return string|array Gallery html or data and srcs parsed from the expanded shortcode. 2379 2379 */ 2380 2380 function get_post_gallery( $post_id = 0, $html = true ) { 2381 2381 if ( ! $post = get_post( $post_id ) ) 2382 return array();2382 return $html ? '' : array(); 2383 2383 2384 2384 if ( ! has_shortcode( $post->post_content, 'gallery' ) ) 2385 return array();2385 return $html ? '' : array(); 2386 2386 2387 2387 $data = get_content_galleries( $post->post_content, $html, false, 1 ); 2388 2388 return reset( $data );