the_attachment_link

函数
the_attachment_link ( $post = 0, $fullsize = false, $deprecated = false, $permalink = false )
参数
  • (int|WP_Post) $post Optional. Post ID or post object.
    Required:
  • (bool) $fullsize Optional. Whether to use full size. Default false.
    Required:
    Default: false
  • (bool) $deprecated Deprecated. Not used.
    Required:
    Default: false
  • (bool) $permalink Optional. Whether to include permalink. Default false.
    Required:
    Default: false
定义位置
相关方法
the_attachment_linksget_the_attachment_linkget_attachment_linkwp_get_attachment_link_fix_attachment_links
引入
2.0.0
弃用
-

the_attachment_link: 此函数显示当前文章的附件页面的链接。

使用图像或图标显示附件页链接。

function the_attachment_link( $post = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
	if ( ! empty( $deprecated ) ) {
		_deprecated_argument( __FUNCTION__, '2.5.0' );
	}

	if ( $fullsize ) {
		echo wp_get_attachment_link( $post, 'full', $permalink );
	} else {
		echo wp_get_attachment_link( $post, 'thumbnail', $permalink );
	}
}

常见问题

FAQs
查看更多 >