/** * Better display of avatars in comments * Should only be used in comment sections (may update in future) * Checks for false empty commenter URLs 'http://' w/registered users * Adds the class 'photo' to the image * Adds a call to 'images/trackback.jpg' for trackbacks * Adds a call to 'images/pingback.jpg' for pingbacks * * Filters should only return a string for an image URL for the avatar with class $avatar * They should not get the avatar as this is done after the filter * * @since 0.2 * @filter */ function comicpress_avatar() { global $comment; $url = get_comment_author_url(); $comment_type = get_comment_type(); if (get_settings('avatar_default')) { $avatar = get_settings('avatar_default'); } // $avatar = apply_filters('comicpress_avatar', $avatar); if ($comment_type != 'pingback' && $comment_type != 'trackback') { echo '<div class="comment-avatar">'; if ($url == true && $url != 'http://') { echo '<a href="' . $url . '" rel="external nofollow" title="' . wp_specialchars(get_comment_author(), 1) . '">'; } $id_or_email = get_comment_author_email(); if (empty($id_or_email)) { $id_or_email = get_comment_author(); } if (function_exists('comicpress_get_avatar') && $comment_type != 'pingback' && $comment_type != 'trackback') { echo str_replace("alt='", "alt='" . wp_specialchars(get_comment_author(), 1) . "' title='" . wp_specialchars(get_comment_author(), 1), comicpress_get_avatar($id_or_email, 64)); } else { echo '<img src="' . get_template_directory_uri() . '/' . $avatar . '" class="avatar photo" />'; } if ($url == true && $url != 'http://') { echo '</a>'; } echo '</div>'; } }
function comicpress_display_author_gravatar($is_comic = false) { global $post, $wp_query, $comicpress_options; if (is_page()) { return; } if (!$is_comic && $comicpress_options['enable_post_author_gravatar'] || $is_comic && $comicpress_options['enable_comic_post_author_gravatar']) { $author_get_gravatar = str_replace("alt='", "alt='" . get_the_author_meta('display_name') . "' title='" . get_the_author_meta('display_name'), comicpress_get_avatar(get_the_author_meta('email'), 64)); $author_gravatar = "<div class=\"post-author-gravatar\">" . $author_get_gravatar . "</div>\r\n"; echo apply_filters('comicpress_display_author_gravatar', $author_gravatar); } }
<h2><?php _e('No such author.', 'comicpress'); ?> </h2> <?php } else { ?> <div <?php post_class(); ?> > <div class="post-head"></div> <div class="post-content"> <div class="userpage-avatar"> <?php echo str_replace("alt='", "alt='" . wp_specialchars($curauth->display_name, 1) . "' title='" . wp_specialchars($curauth->display_name, 1), comicpress_get_avatar($curauth->user_email, 64)); ?> </div> <div class="userpage-info"> <div class="userpage-bio"> <?php if ($curauth->display_name) { $authorname = $curauth->display_name; } elseif ($curauth->user_nickname) { $authorname = $curauth->nickname; } elseif ($curauth->user_nicename) { $authorname = $curauth->user_nicename; } else { $authorname = $curauth->user_login; } ?>