get_previous_posts_link()
get_previous_posts_link( string $label = null ) 检索以前的文章…
get_previous_posts_link( string $label = null )
检索以前的文章页链接。
Retrieves the previous posts page link.
检索以前的文章页链接。
Retrieves the previous posts page link.
目录锚点:#参数#返回#源码#笔记
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $label | (string) | 可选 | 上一页链接文本。 |
返回(Return)
(string|void)HTML格式的上一页链接。
源码(Source)
/**
* Return the previous posts page link.
*
* @since 2.7.0
*
* @global int $paged
*
* @param string $label Optional. Previous page link text.
* @return string|void HTML-formatted previous page link.
*/
function get_previous_posts_link( $label = null ) {
global $paged;
if ( null === $label )
$label = __( '« Previous Page' );
if ( !is_single() && $paged > 1 ) {
/**
* Filter the anchor tag attributes for the previous posts page link.
*
* @since 2.7.0
*
* @param string $attributes Attributes for the anchor tag.
*/
$attr = apply_filters( 'previous_posts_link_attributes', '' );
return '". preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) .'';
}
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.7.0 | wp-includes/link-template.php:2453 | 3 | 5 |
笔记(Notes)
默认用法
[来自Codex]从上一个链接和下一个链接中删除尾随斜杠
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
还没有任何评论,赶紧来占个楼吧!