Hallo Leute,
wie kann ich einen Gravatar auf meiner Seite einbinden.
Habe das neueste WP, also Version 2.5 und wollte es eigenlich mit folgender Funktion einbinden:
PHP
<?php if(function_exists('get_avatar')) {
echo get_avatar( $id_or_email, $size = '96', $default = '' )
} ?>
aber er wirft immer nur das Default Bild raus, obwohl es nit sicheren Emailadressen verwendet wird (also sicher bei Gravatars registriert)
hier mal meine comments.php
PHP
<?php // Do not delete these lines
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?>
<p class="center"><?php _e("Dieser Eintrag ist mit einem Passwort geschützt. Schreibe das Passwort um die Einträge zu lesen."); ?><p>
<?php return; } }
/* Function for seperating comments from track- and pingbacks. */
function k2_comment_type_detection($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback') {
global $comment;
if (preg_match('|trackback|', $comment->comment_type))
return $trackbacktxt;
elseif (preg_match('|pingback|', $comment->comment_type))
return $pingbacktxt;
else
return $commenttxt;
}
$templatedir = get_bloginfo('template_directory');
$comment_number = 1;
?>
<!-- You can start editing here. -->
<?php if (($comments) or ('open' == $post-> comment_status)) { ?>
<div id="comment_form">
<h3 class="comments_headers"><?php comments_number('0 Antworten', '1 Antwort', '% Antworten' );?> bis jetzt </h3>
<ul id="comment_list">
<?php if ($comments) { ?>
<?php $count_pings = 1; foreach ($comments as $comment) { ?>
<li class="comment <?php if (k2_comment_type_detection() != "Comment") { echo('trackback'); } ?>" id="comment-<?php comment_ID() ?>">
<p class="comment_meta"><span class="comment_num"><?php if(function_exists('get_avatar')) {
echo get_avatar( $id_or_email, $size = '60', $default = '' );
} ?>
</span>
<strong><a href="#comment-<?php comment_ID() ?>" title="Permalink to this comment"><?php echo($comment_number); ?></a> .) </strong><strong><?php comment_author_link() ?> </strong>am <?php comment_date('d.m.Y') ?> um <?php comment_time() ?> Uhr
</p>
<div class="entry">
<?php comment_text() ?>
<?php if ($comment->comment_approved == '0') : ?>
<p><strong>Dein Kommentar wird von einem Moderator überprüft.</strong></p>
<?php endif; ?>
</div>
</li>
<?php $comment_number++; } /* end for each comment */ ?>
</ul>
<?php } else { // this is displayed if there are no comments so far ?>
<?php if ('open' == $post-> comment_status) { ?>
<!-- If comments are open, but there are no comments. -->
<li class="comment">
<div class="entry">
<p>Es gibt keine Kommentare bis jetzt...</p>
</div>
</li>
<?php } else { // comments are closed ?>
<!-- If comments are closed. -->
<?php if (is_single) { // To hide comments entirely on Pages without comments ?>
<li class="comment">
<div class="entry">
<p>Kommentare sind geschlossen</p>
</div>
</li>
<?php } ?>
<?php } ?>
</ul>
<?php } ?>
<!-- Comment Form -->
<?php if ('open' == $post-> comment_status) : ?>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p class="unstyled">Du musst <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">eingeloggt</a> sein um ein Kommentar zu schreiben.</p>
<?php else : ?>
<h3 id="respond" class="comments_headers">Hinterlasse einen Kommentar</h3>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="comment_form">
<?php if ( $user_ID ) { ?>
<p class="unstyled">Eingeloggt als <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Logout aus diesem Account') ?>">Logout »</a></p>
<?php } ?>
<?php if ( !$user_ID ) { ?>
<p><input class="text_input" type="text" name="author" id="author" value="<?php echo $comment_author; ?>" tabindex="1" /><label for="author"><strong>Name</strong></label></p>
<p><input class="text_input" type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" tabindex="2" /><label for="email"><strong>Mail</strong> *wird nicht veröffentlicht</label></p>
<p><input class="text_input" type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" tabindex="3" /><label for="url"><strong>Website</strong></label></p>
<?php } ?>
<!--<p><small><strong>XHTML:</strong> Du kannst diese Tags benutzen: <?php echo allowed_tags(); ?></small></p>-->
<p><textarea class="text_input text_area" name="comment" id="comment" rows="7" tabindex="4"></textarea></p>
<?php if (function_exists('show_subscription_checkbox')) { show_subscription_checkbox(); } ?>
<p>
<input name="submit" class="form_submit" type="submit" id="submit" src="<?php bloginfo('template_url') ?>/images/submit_comment.gif" tabindex="5" value="Absenden" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
</p>
<?php do_action('comment_form', $post->ID); ?>
</form><?php show_subscription_checkbox(); ?>
<?php endif; // If registration required and not logged in ?>
<?php endif; // if you delete this the sky will fall on your head ?>
</div> <!-- Kommentar Container -->
<div class="clear flat"></div>
<?php } ?>
Alles anzeigen