get_previous_posts_link

函数
get_previous_posts_link ( $label = null )
参数
  • (string) $label Optional. Previous page link text.
    Required:
    Default: null
返回值
  • (string|void) HTML-formatted previous page link.
定义位置
相关方法
get_previous_post_linkprevious_posts_linkget_previous_posts_page_linkprevious_post_linkget_previous_comments_link
引入
2.7.0
弃用
-

get_previous_posts_link函数是一个WordPress函数,用于检索特定查询的前一篇文章的链接: 这个函数需要一个可选的参数来表示链接文本,并返回到以前的文章的链接。

检索上一个文章的页面链接。

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>';
	}
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-14 12:36:31

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: