WordPress函数:get_the_author_posts_link 获取当前作者页面的链接

江河/ 2023年05月03日/ WordPress/ 浏览 701

函数原型:


get_the_author_posts_link(): string


获取当前作者也没买的链接。


函数源码:


function get_the_author_posts_link() {
	global $authordata;
	if ( ! is_object( $authordata ) ) {
		return '';
	}

	$link = sprintf(
		'<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
		esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
		/* translators: %s: Author's display name. */
		esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
		get_the_author()
	);

	return apply_filters( 'the_author_posts_link', $link );
}


包含钩子:


apply_filters( 'the_author_posts_link', string $link )


使用举例:


echo get_the_author_posts_link();


发表评论

暂无评论,抢个沙发...

客服 工单