diff --git src/wp-includes/author-template.php src/wp-includes/author-template.php
index 5ad7059..d8df93c 100644
|
|
function the_author_link() { |
203 | 203 | * |
204 | 204 | * @uses $post The current post in the Loop's DB object. |
205 | 205 | * @uses count_user_posts() |
206 | | * @return int The number of posts by the author. |
| 206 | * @param string $post_type Optional. Post type to count the number of posts for. Defaults to "post". |
| 207 | * @return int The number of posts in the post type by the author. |
207 | 208 | */ |
208 | | function get_the_author_posts() { |
| 209 | function get_the_author_posts( $post_type = 'post' ) { |
209 | 210 | $post = get_post(); |
210 | 211 | if ( ! $post ) { |
211 | 212 | return 0; |
212 | 213 | } |
213 | | return count_user_posts( $post->post_author ); |
| 214 | return count_user_posts( $post->post_author, $post_type ); |
214 | 215 | } |
215 | 216 | |
216 | 217 | /** |
diff --git src/wp-includes/user.php src/wp-includes/user.php
index a548f5a..efb4da1 100644
|
|
function wp_validate_logged_in_cookie( $user_id ) { |
254 | 254 | * @global wpdb $wpdb WordPress database object for queries. |
255 | 255 | * |
256 | 256 | * @param int $userid User ID. |
257 | | * @return int Amount of posts user has written. |
| 257 | * @param string $post_type Optional. Post type to count the number of posts for. Defaults to "post". |
| 258 | * @return int Number of posts the user has written in this post type. |
258 | 259 | */ |
259 | | function count_user_posts($userid) { |
| 260 | function count_user_posts( $userid, $post_type = 'post' ) { |
260 | 261 | global $wpdb; |
261 | 262 | |
262 | | $where = get_posts_by_author_sql('post', true, $userid); |
| 263 | $where = get_posts_by_author_sql( $post_type, true, $userid ); |
263 | 264 | |
264 | 265 | $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" ); |
265 | 266 | |
… |
… |
function count_user_posts($userid) { |
270 | 271 | * |
271 | 272 | * @param int $count The user's post count. |
272 | 273 | * @param int $userid User ID. |
| 274 | * @param string $post_type Post type to count the number of posts for. |
273 | 275 | */ |
274 | | return apply_filters( 'get_usernumposts', $count, $userid ); |
| 276 | return apply_filters( 'get_usernumposts', $count, $userid, $post_type ); |
275 | 277 | } |
276 | 278 | |
277 | 279 | /** |