函数文档

next_image_link()

💡 云策文档标注

概述

next_image_link() 函数用于在附件页面显示具有相同父文章的下一张图片链接,通常用于处理系列图片的导航。

关键要点

  • 函数输出下一张图片的链接,基于相同的 post parent 关系。
  • 主要用于 attachment.php 或 image.php 模板文件,如 Twenty Eleven 和 Twenty Twelve 主题中。
  • 参数包括可选的图片尺寸和链接文本,默认尺寸为 'thumbnail',文本为 false。
  • 内部调用 get_next_image_link() 函数来获取链接。

代码示例

next_image_link( $size, $text );

📄 原文内容

Displays next image link that has the same post parent.

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

More Information

  • Whenever a series of images are linked to the attachment page, it will put a ‘next image link’ with the images when viewed in the attachment page.
  • Typically uses in attachment.php. In the WordPress default theme Twenty Eleven and Twenty Twelve, it is used in image.php.
    next_image_link( $size, $text );

Source

function next_image_link( $size = 'thumbnail', $text = false ) {
	echo get_next_image_link( $size, $text );
}

Changelog

Version Description
2.5.0 Introduced.

User Contributed Notes