WordPress.org

Make WordPress Core

Ticket #34638: 34638.diff

File 34638.diff, 4.4 KB (added by markparnell, 7 months ago)
  • src/wp-includes/media.php

     
    29482948add_shortcode( 'video', 'wp_video_shortcode' );
    29492949
    29502950/**
     2951 * Retrieves previous image link that has the same post parent.
     2952 *
     2953 * @since 5.4.0
     2954 *
     2955 * @see get_adjacent_image_link()
     2956 *
     2957 * @param string|array $size Optional. Image size. Accepts any valid image size, an array of width and
     2958 *                           height values in pixels (in that order), 0, or 'none'. 0 or 'none' will
     2959 *                           default to 'post_title' or `$text`. Default 'thumbnail'.
     2960 * @param string       $text Optional. Link text. Default false.
     2961 * @return string The link URL of the previous image that has the same post parent as the current image.
     2962 */
     2963function get_previous_image_link( $size = 'thumbnail', $text = false ) {
     2964        return get_adjacent_image_link( true, $size, $text );
     2965}
     2966
     2967/**
    29512968 * Displays previous image link that has the same post parent.
    29522969 *
    29532970 * @since 2.5.0
     
    29602977 * @param string       $text Optional. Link text. Default false.
    29612978 */
    29622979function previous_image_link( $size = 'thumbnail', $text = false ) {
    2963         adjacent_image_link( true, $size, $text );
     2980        echo get_previous_image_link( $size, $text );
    29642981}
    29652982
    29662983/**
     2984 * Retrieves next image link that has the same post parent.
     2985 *
     2986 * @since 5.4.0
     2987 *
     2988 * @see get_adjacent_image_link()
     2989 *
     2990 * @param string|array $size Optional. Image size. Accepts any valid image size, an array of width and
     2991 *                           height values in pixels (in that order), 0, or 'none'. 0 or 'none' will
     2992 *                           default to 'post_title' or `$text`. Default 'thumbnail'.
     2993 * @param string       $text Optional. Link text. Default false.
     2994 * @return string The link URL of the next image that has the same post parent as the current image.
     2995 */
     2996function get_next_image_link( $size = 'thumbnail', $text = false ) {
     2997        return get_adjacent_image_link( false, $size, $text );
     2998}
     2999
     3000/**
    29673001 * Displays next image link that has the same post parent.
    29683002 *
    29693003 * @since 2.5.0
     
    29763010 * @param string       $text Optional. Link text. Default false.
    29773011 */
    29783012function next_image_link( $size = 'thumbnail', $text = false ) {
    2979         adjacent_image_link( false, $size, $text );
     3013        echo get_next_image_link( $size, $text );
    29803014}
    29813015
    29823016/**
    2983  * Displays next or previous image link that has the same post parent.
     3017 * Retrieves next or previous image link that has the same post parent.
    29843018 *
    29853019 * Retrieves the current attachment object from the $post global.
    29863020 *
    2987  * @since 2.5.0
     3021 * @since 5.4.0
    29883022 *
    29893023 * @param bool         $prev Optional. Whether to display the next (false) or previous (true) link. Default true.
    29903024 * @param string|array $size Optional. Image size. Accepts any valid image size, or an array of width and height
    29913025 *                           values in pixels (in that order). Default 'thumbnail'.
    29923026 * @param bool         $text Optional. Link text. Default false.
     3027 * @return string The link URL of the previous or next image that has the same post parent as the current image.
    29933028 */
    2994 function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) {
     3029function get_adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) {
    29953030        $post        = get_post();
    29963031        $attachments = array_values(
    29973032                get_children(
     
    30393074         * @param string $size          Image size.
    30403075         * @param string $text          Link text.
    30413076         */
    3042         echo apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text );
     3077        return apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text );
    30433078}
    30443079
    30453080/**
     3081 * Displays next or previous image link that has the same post parent.
     3082 *
     3083 * Retrieves the current attachment object from the $post global.
     3084 *
     3085 * @since 2.5.0
     3086 *
     3087 * @param bool         $prev Optional. Whether to display the next (false) or previous (true) link. Default true.
     3088 * @param string|array $size Optional. Image size. Accepts any valid image size, or an array of width and height
     3089 *                           values in pixels (in that order). Default 'thumbnail'.
     3090 * @param bool         $text Optional. Link text. Default false.
     3091 */
     3092function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) {
     3093        echo get_adjacent_image_link( $prev, $size, $text );
     3094}
     3095
     3096/**
    30463097 * Retrieves taxonomies attached to given the attachment.
    30473098 *
    30483099 * @since 2.5.0