函数文档

get_next_image_link()

💡 云策文档标注

概述

get_next_image_link() 函数用于获取具有相同文章父级的下一张图片链接,基于 get_adjacent_image_link() 实现,返回链接的 HTML 标记。

关键要点

  • 函数返回具有相同 post parent 的下一张图片的链接标记
  • 接受两个可选参数:$size(图片尺寸,默认 'thumbnail')和 $text(链接文本,默认 false)
  • 内部调用 get_adjacent_image_link() 函数,传递 false 作为方向参数
  • 自 WordPress 5.8.0 版本引入

代码示例

function get_next_image_link( $size = 'thumbnail', $text = false ) {
    return get_adjacent_image_link( false, $size, $text );
}

📄 原文内容

Gets the next image link that has the same post parent.

Description

See also

Parameters

$sizestring|int[]optional
Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default 'thumbnail'.
$textstring|falseoptional
Link text.

Default:false

Return

string Markup for next image link.

Source

function get_next_image_link( $size = 'thumbnail', $text = false ) {
	return get_adjacent_image_link( false, $size, $text );
}

Changelog

Version Description
5.8.0 Introduced.