- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/author-template.php
r17100 r18268 204 204 205 205 global $authordata; 206 if ( !is_object( $authordata ) ) 207 return false; 206 208 $link = sprintf( 207 '<a href="%1$s" title="%2$s" >%3$s</a>',209 '<a href="%1$s" title="%2$s" rel="author">%3$s</a>', 208 210 get_author_posts_url( $authordata->ID, $authordata->user_nicename ), 209 211 esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ), … … 367 369 } 368 370 371 /** 372 * Does this site have more than one author 373 * 374 * Checks to see if more than one author has published posts. 375 * 376 * @since 3.2.0 377 * @return bool Whether or not we have more than one author 378 */ 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 * @private 395 */ 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 369 401 ?>
Note: See TracChangeset
for help on using the changeset viewer.