Guten Tag ;)
Ich würde meine Kommentare gern so anzeigen lassen, daß jeder zweite Kommentar mit einem leicht grauen Hintergrund versehen ist.
Und zweitens bringen die Gravatars momentan noch das ganze Layuot durcheinander, wenn der Kommentar nicht ausreichen lang (also mindestens so viele Zeilen, daß 80px Höhe errreicht werden) ist:
http://www.kruck.biz/wordpress/?p=320
Meine comments.php sient momentan folgendermaßen aus:
<?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="nocomments"><?php _e("This post is password protected. Enter the password to view comments."); ?><p>
<?php
return;
}
}
/* This variable is for alternating comment background */
$oddcomment = "graybox";
?>
<!-- You can start editing here. -->
<?php if ($comments) : ?>
<a name="comments"></a><h2><?php comments_number('Keine Antworten','eine Antwort','% Antworten' );?></h2>
<ol class="commentlist">
<?php foreach ($comments as $comment) : ?>
<class="<?=$oddcomment;?>">
<a name="comment-<?php comment_ID() ?>"></a>
<!-- GRAVATARS -->
<?php if (function_exists('gravatar')) {
if ('' != get_comment_author_url()) {
echo "<a href='$comment->comment_author_url' title='Visit $comment->comment_author'>";
} else {
echo "<a href='http://www.gravatar.com' title='Create your own gravatar at gravatar.com!'>";
}
echo "<img src='";
if ('' == $comment->comment_type) {
echo gravatar($comment->comment_author_email);
} elseif ( ('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type) ) {
echo gravatar($comment->comment_author_url);
}
echo "' alt='' class='gravatar' width='80' height='80' /></a>";
} ?>
<!-- ENDE DER GRAVATARS -->
geschrieben von <?php comment_author_link() ?><br />
<!-- <small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title="<?php comment_date('l, F jS, Y') ?> at <?php comment_time() ?>"><?php /* $entry_datetime = abs(strtotime($post->post_date)); $comment_datetime = abs(strtotime($comment->comment_date)); echo time_since($entry_datetime, $comment_datetime) */ ?></a> after publication. <?php edit_comment_link('e','',''); ?></small> -->
<small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('d. F Y') ?> @ <?php comment_time('H:i') ?></a> <?php edit_comment_link('| edit','',''); ?></small>
<?php comment_text() ?>
<?php /* Changes every other comment to a different class */
if("graybox" == $oddcomment) {$oddcomment="";}
else { $oddcomment="graybox"; }
?>
<?php endforeach; /* end for each comment */ ?>
</ol>
<?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. -->
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p class="nocomments">Comments are closed.</p>
<?php endif; ?>
<?php endif; ?>
<?php if ('open' == $post-> comment_status) : ?>
<a name="respond"></a><h3>Schreib einen Kommentar</h3>
<form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<p><input type="text" name="author" id="author" class="styled" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER["REQUEST_URI"]); ?>" />
<label for="author"><small>Dein Name</small></label></p>
<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
<label for="email"><small>Deine E-Mail-Adresse (wird nicht weitergegeben)</small></label></p>
<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
<label for="url"><small>Deine Website</small></label></p>
<p><small><strong>XHTML:</strong> Du kannst folgende Tags verwenden: <?php echo allowed_tags(); ?></small></p>
<p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>
<?php if ('none' != get_settings("comment_moderation")) { ?>
<p><small><strong>nota bene:</strong> Wahrscheinlich muß ich Deinen Kommentar erst noch moderieren. Und wahrscheinlich dauert das eine kurze Weile. Also sei nicht verwundert, wenn Dein Kommentar hier nicht sofort erscheint; es reicht in jedem Falle aus, den Beitrag einmal abzusenden ;)</small></p>
<?php } ?>
<p><input name="submit" type="submit" id="submit" tabindex="5" value="Kommentar abschicken" /></p>
</form>
<?php // if you delete this the sky will fall on your head
endif; ?>
Alles anzeigen
Es sieht für mich so aus, als sei das Hinterlegen jedes zweiten Kommentars mit einem grauen Hintergrund bereits vorbereitet. Jedoch weiß ich leider nicht, wie ich die Option "Graybox" aktivieren kann. Ich habe bereits einige Möglichkeiten ausprobiert, bin jedoch noch nicht schlauer.
Für das Problem mit den Gravatars weiß ich überhaupt keinen Ansatz :-(
Gruß und danke
ANDY