get_the_author_posts

函式
get_the_author_posts ( No parameters )
返回值
  • (int) The number of posts by the author.
定義位置
相關方法
get_the_author_posts_linkthe_author_postsget_the_author_msnget_the_authorget_the_author_meta
引入
1.5.0
棄用
-

get_the_author_posts: 該函式檢索文章作者所寫的已發表文章的數量。它不接受任何引數,並返回一個整數值。

檢索當前文章的作者的文章數量。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_the_author_posts() {
$post = get_post();
if ( ! $post ) {
return 0;
}
return count_user_posts( $post->post_author, $post->post_type );
}
function get_the_author_posts() { $post = get_post(); if ( ! $post ) { return 0; } return count_user_posts( $post->post_author, $post->post_type ); }
function get_the_author_posts() {
	$post = get_post();
	if ( ! $post ) {
		return 0;
	}
	return count_user_posts( $post->post_author, $post->post_type );
}

常見問題

FAQs
檢視更多 >