Make WordPress Core

Changeset 24571


Ignore:
Timestamp:
07/05/2013 08:41:49 PM (11 years ago)
Author:
markjaquith
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r24570 r24571  
    882882
    883883    if ( ! $primary ) {
    884         $audios = get_attached_audio( $post_id );
     884        $audios = get_attached_media( 'audio', $post_id );
    885885        if ( empty( $audios ) )
    886886            return;
     
    10001000
    10011001    if ( ! $primary ) {
    1002         $videos = get_attached_video( $post_id );
     1002        $videos = get_attached_media( 'video', $post_id );
    10031003        if ( empty( $videos ) )
    10041004            return;
     
    18671867
    18681868/**
    1869  * Retrieve audio attached to the passed post
    1870  *
    1871  * @since 3.6.0
    1872  *
    1873  * @param int $post_id  Post ID
    1874  * @return array Found audio attachments
    1875  */
    1876 function get_attached_audio( $post_id = 0 ) {
    1877     return get_attached_media( 'audio', $post_id );
    1878 }
    1879 
    1880 /**
    1881  * Retrieve video attached to the passed post
    1882  *
    1883  * @since 3.6.0
    1884  *
    1885  * @param int $post_id  Post ID
    1886  * @return array Found video attachments
    1887  */
    1888 function get_attached_video( $post_id = 0 ) {
    1889     return get_attached_media( 'video', $post_id );
    1890 }
    1891 
    1892 /**
    18931869 * Extract and parse {media type} shortcodes or srcs from the passed content
    18941870 *
     
    20312007 * @return array Found image attachments
    20322008 */
    2033 function get_attached_images( $post_id = 0 ) {
    2034     return get_attached_media( 'image', $post_id );
    2035 }
    2036 
    2037 /**
    2038  * Retrieve images attached to the passed post
    2039  *
    2040  * @since 3.6.0
    2041  *
    2042  * @param int $post_id Optional. Post ID.
    2043  * @return array Found image attachments
    2044  */
    20452009function get_attached_image_srcs( $post_id = 0 ) {
    2046     $children = get_attached_images( $post_id );
     2010    $children = get_attached_media( 'image', $post_id );
    20472011    if ( empty( $children ) )
    20482012        return array();
Note: See TracChangeset for help on using the changeset viewer.