<h3> <?php _e('Archives For ', 'standard'); ?> <?php if (standard_is_date_archive()) { ?> <?php echo standard_get_date_archive_label(); ?> <?php } elseif (is_author()) { ?> <?php $author_data = standard_is_using_pretty_permalinks() ? get_userdata(get_query_var('author')) : get_userdata(user_trailingslashit(get_query_var('author'))); echo $author_data->display_name; ?> <?php } elseif ('' == single_tag_title('', false)) { ?> <?php echo get_cat_name(get_query_var('cat')); ?> <?php } else { ?>
/** * Returns the name of the author based on the ID in the query string. * * @return string An anchor to the name of the author. * @since 3.0 * @version 1.0 */ private static function get_author_display_name() { global $wp_rewrite; // If we're using permalinks, then we need to add user_trailingslashit; // Otherwise, we use the old way of doing it. if (standard_is_using_pretty_permalinks()) { $author_data = get_userdata(get_query_var('author')); } else { $author_data = get_userdata(user_trailingslashit(get_query_var('author'))); } // end if // If the $author_data is null, then the user must have a cusotm permalink structure if (null == $author_data) { $author_data = get_userdata(get_post(get_the_ID())->post_author); $author_data = $author_data->data; } // end if $author_link = '<a href="' . esc_html(get_author_posts_url($author_data->ID)) . '">'; $author_link .= $author_data->display_name; $author_link .= '</a>'; return $author_link; }