- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/author-template.php
r18268 r17100 204 204 205 205 global $authordata; 206 if ( !is_object( $authordata ) )207 return false;208 206 $link = sprintf( 209 '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',207 '<a href="%1$s" title="%2$s">%3$s</a>', 210 208 get_author_posts_url( $authordata->ID, $authordata->user_nicename ), 211 209 esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ), … … 369 367 } 370 368 371 /**372 * Does this site have more than one author373 *374 * Checks to see if more than one author has published posts.375 *376 * @since 3.2.0377 * @return bool Whether or not we have more than one author378 */379 function is_multi_author() {380 global $wpdb;381 382 if ( false === ( $is_multi_author = wp_cache_get('is_multi_author', 'posts') ) ) {383 $rows = (array) $wpdb->get_col("SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 2");384 $is_multi_author = 1 < count( $rows ) ? 1 : 0;385 wp_cache_set('is_multi_author', $is_multi_author, 'posts');386 }387 388 return (bool) $is_multi_author;389 }390 391 /**392 * Helper function to clear the cache for number of authors.393 *394 * @private395 */396 function __clear_multi_author_cache() {397 wp_cache_delete('is_multi_author', 'posts');398 }399 add_action('transition_post_status', '__clear_multi_author_cache');400 401 369 ?>
Note: See TracChangeset
for help on using the changeset viewer.