Drop some wrapper functions
* `get_attached_audio()` (use `get_attached_media( 'audio' )`) * `get_attached_images()` (use `get_attached_media( 'image' )`) * `get_attached_videos()` (use `get_attached_media( 'video' )`) props wonderboymusic. fixes #23843. git-svn-id: http://core.svn.wordpress.org/trunk@24571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8c9c035d94
commit
5da392a62f
|
@ -881,7 +881,7 @@ function wp_audio_shortcode( $attr ) {
|
|||
}
|
||||
|
||||
if ( ! $primary ) {
|
||||
$audios = get_attached_audio( $post_id );
|
||||
$audios = get_attached_media( 'audio', $post_id );
|
||||
if ( empty( $audios ) )
|
||||
return;
|
||||
|
||||
|
@ -999,7 +999,7 @@ function wp_video_shortcode( $attr ) {
|
|||
}
|
||||
|
||||
if ( ! $primary ) {
|
||||
$videos = get_attached_video( $post_id );
|
||||
$videos = get_attached_media( 'video', $post_id );
|
||||
if ( empty( $videos ) )
|
||||
return;
|
||||
|
||||
|
@ -1865,30 +1865,6 @@ function get_attached_media( $type, $post_id = 0 ) {
|
|||
return (array) apply_filters( 'get_attached_media', $children, $type, $post );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve audio attached to the passed post
|
||||
*
|
||||
* @since 3.6.0
|
||||
*
|
||||
* @param int $post_id Post ID
|
||||
* @return array Found audio attachments
|
||||
*/
|
||||
function get_attached_audio( $post_id = 0 ) {
|
||||
return get_attached_media( 'audio', $post_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve video attached to the passed post
|
||||
*
|
||||
* @since 3.6.0
|
||||
*
|
||||
* @param int $post_id Post ID
|
||||
* @return array Found video attachments
|
||||
*/
|
||||
function get_attached_video( $post_id = 0 ) {
|
||||
return get_attached_media( 'video', $post_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract and parse {media type} shortcodes or srcs from the passed content
|
||||
*
|
||||
|
@ -2022,18 +1998,6 @@ function get_embedded_video( $content ) {
|
|||
return get_embedded_media( 'video', $content );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve images attached to the passed post
|
||||
*
|
||||
* @since 3.6.0
|
||||
*
|
||||
* @param int $post_id Optional. Post ID.
|
||||
* @return array Found image attachments
|
||||
*/
|
||||
function get_attached_images( $post_id = 0 ) {
|
||||
return get_attached_media( 'image', $post_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve images attached to the passed post
|
||||
*
|
||||
|
@ -2043,7 +2007,7 @@ function get_attached_images( $post_id = 0 ) {
|
|||
* @return array Found image attachments
|
||||
*/
|
||||
function get_attached_image_srcs( $post_id = 0 ) {
|
||||
$children = get_attached_images( $post_id );
|
||||
$children = get_attached_media( 'image', $post_id );
|
||||
if ( empty( $children ) )
|
||||
return array();
|
||||
|
||||
|
|
Loading…
Reference in New Issue