Ticket #34638: 34638.diff
File 34638.diff, 4.4 KB (added by , 5 years ago) |
---|
-
src/wp-includes/media.php
2948 2948 add_shortcode( 'video', 'wp_video_shortcode' ); 2949 2949 2950 2950 /** 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 */ 2963 function get_previous_image_link( $size = 'thumbnail', $text = false ) { 2964 return get_adjacent_image_link( true, $size, $text ); 2965 } 2966 2967 /** 2951 2968 * Displays previous image link that has the same post parent. 2952 2969 * 2953 2970 * @since 2.5.0 … … 2960 2977 * @param string $text Optional. Link text. Default false. 2961 2978 */ 2962 2979 function previous_image_link( $size = 'thumbnail', $text = false ) { 2963 adjacent_image_link( true,$size, $text );2980 echo get_previous_image_link( $size, $text ); 2964 2981 } 2965 2982 2966 2983 /** 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 */ 2996 function get_next_image_link( $size = 'thumbnail', $text = false ) { 2997 return get_adjacent_image_link( false, $size, $text ); 2998 } 2999 3000 /** 2967 3001 * Displays next image link that has the same post parent. 2968 3002 * 2969 3003 * @since 2.5.0 … … 2976 3010 * @param string $text Optional. Link text. Default false. 2977 3011 */ 2978 3012 function next_image_link( $size = 'thumbnail', $text = false ) { 2979 adjacent_image_link( false,$size, $text );3013 echo get_next_image_link( $size, $text ); 2980 3014 } 2981 3015 2982 3016 /** 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. 2984 3018 * 2985 3019 * Retrieves the current attachment object from the $post global. 2986 3020 * 2987 * @since 2.5.03021 * @since 5.4.0 2988 3022 * 2989 3023 * @param bool $prev Optional. Whether to display the next (false) or previous (true) link. Default true. 2990 3024 * @param string|array $size Optional. Image size. Accepts any valid image size, or an array of width and height 2991 3025 * values in pixels (in that order). Default 'thumbnail'. 2992 3026 * @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. 2993 3028 */ 2994 function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) {3029 function get_adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) { 2995 3030 $post = get_post(); 2996 3031 $attachments = array_values( 2997 3032 get_children( … … 3039 3074 * @param string $size Image size. 3040 3075 * @param string $text Link text. 3041 3076 */ 3042 echoapply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text );3077 return apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text ); 3043 3078 } 3044 3079 3045 3080 /** 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 */ 3092 function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) { 3093 echo get_adjacent_image_link( $prev, $size, $text ); 3094 } 3095 3096 /** 3046 3097 * Retrieves taxonomies attached to given the attachment. 3047 3098 * 3048 3099 * @since 2.5.0