get_previous_posts_link() - WordPress 函数参考中文文档

返回介绍

get_previous_posts_link()

发布于 2017-09-11 字数2443 浏览 794 评论 0

get_previous_posts_link( string $label = null )

Retrieves the previous posts page link.


描述


参数

$label

(string)
(Optional)
Previous page link text.

Default value: null


返回值

(string|void) HTML-formatted previous page link.


源代码

File: wp-includes/link-template.php

function get_previous_posts_link( $label = null ) {
	global $paged;

	if ( null === $label )
		$label = __( '« Previous Page' );

	if ( !is_single() && $paged > 1 ) {
		/**
		 * Filters 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 '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) .'</a>';
	}
}

更新日志

Version 描述
2.7.0 Introduced.

相关函数

Uses

  • wp-includes/l10n.php:
    __()
  • wp-includes/query.php:
    is_single()
  • wp-includes/link-template.php:
    previous_posts()
  • wp-includes/link-template.php:
    previous_posts_link_attributes
  • wp-includes/plugin.php:
    apply_filters()

Used By

  • wp-includes/link-template.php:
    get_the_posts_navigation()
  • wp-includes/link-template.php:
    previous_posts_link()
  • wp-includes/link-template.php:
    get_posts_nav_link()

User Contributed Notes

  1. Skip to note content

    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note

    Contributed by Codex

    Default Usage

    
    echo get_previous_posts_link();
    

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!