Kann ich gleich in comments.php […]
die Variablen einfügen, die bei deinem Link in der functions.php stehen?
Naja, ein bißchen anders sieht das schon aus. Ich habe jetzt nicht die Nerven, das detailliert auseinanderzunehmen. Hier mal (verkürzt) die aktuelle comments.php von meiner Website.
<?php // Do not delete these lines
if ( 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']) )
{
die ('Bitte diese Seite nicht direkt aufrufen. Danke!');
}
if ( !empty ( $post->post_password) )
{ // if there's a password and it doesn't match the cookie
if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password )
{
?><p class="nocomments">Auch die Kommentare sind durch das Passwort geschützt.<p>
<?php
return;
}
}
if ( $comments ) {
?>
<h2 id="comments">
<?php
comments_number(
'Kein Kommentar', 'Ein Kommentar', '% Kommentare');
?></h2>
<ol class="commentlist">
<?php
foreach ($comments as $comment)
{
?>
<li class="<?php
if ( $comment->comment_author_email == get_the_author_email() )
{
echo 'author ';
}
?>" id="comment-<?php comment_ID(); ?>">
<?php
if ($comment->comment_approved == '0')
{
?>
<p class="comment_moderated">
<strong>Achtung: Der Kommentar muß erst noch freigegeben werden.</strong>
</p>
<?php
}
?>
<p class="commentmeta">
<cite class="notranslate"><?php
echo xwp_comment_author_meta(get_avatar( $comment, 32));
?>
</cite>
schrieb am
<a href="#comment-<?php comment_ID(); ?>"
title="Link auf Kommentar <?php comment_ID(); ?>">
<?php comment_date('d.m.Y H:i'); ?></a>:
</p>
<?php comment_text();
edit_comment_link('Bearbeiten','<p>','</p>');
?>
</li>
<?php
} /* end for each comment */
?></ol>
<?php
} else { // no comments
// comments open, but no comments.
if ('open' == $post->comment_status) {
// <p class="nocomment">Noch kein Kommentar.</p>
} else { // comments closed
/* <p class="nocomments">Die Kommentarfunktion ist deaktiviert.</p> */
}
}
if ('open' == $post->comment_status) {
?>
<h2 id="respond">
<?php
if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) )
{
sanitize_comment_cookies();
$xwp_comment_author_data = wp_get_current_commenter();
echo 'Hallo <strong>' . $xwp_comment_author_data['comment_author']
. '</strong>! ';
}
?>Was sagst du dazu?</h2>
<?php
if ( get_option('comment_registration') && !$user_ID ) {
?>
<p>Bitte <a href="<?php
echo get_option('siteurl') . '/wp-login.php?redirect_to=' . the_permalink();
?>">melden Sie sich an</a>, um zu kommentieren.</p>
<?php
} else { // Jeder kann kommentieren
?>
<p id="commentmetabox" class="noprint">
<?php
if ( $comments )
{
comments_rss_link('RSS-Feed für diese Kommentare');
echo ' · ';
}
?>
Nur das <label for="comment">Textfeld</label> ist Pflicht, der Rest … nicht.<?php
if ( 0 != (int) get_option('comment_max_links') )
{
?>
Kommentare mit <?php echo get_option('comment_max_links'); ?>
oder mehr Links prüfe ich erst.
<?php
}
?> SEO-Namen, Links auf Partnerprogramme (Affiliate) und ähnlichen Spuk
<strong>lösche</strong> ich.
<br>
Bitte <a href="http://labs.toscho.de/escape/">maskiere</a> <code><</code>
und <code>></code> mit <code>&lt;</code> und <code>&gt;</code>,
sonst werden sie gefressen.
</p>
<form action="<?php echo rtrim(get_option('home'), '/');
?>/wp-comments-post.php" method="POST" accept-charset="<?php
bloginfo('charset'); ?>" class="textform" id="commentform">
<fieldset>
<?php
if ( function_exists('live_preview') )
{
live_preview('<div id="liveprev">', '</div>');
}
?>
<textarea name="comment" id="comment" cols="50" rows="10" required></textarea>
<?php
if ( function_exists('show_subscription_checkbox') )
{
show_subscription_checkbox();
}
if( $user_ID )
{
?>
<p>Angemeldet als:
<a href="<?php echo rtrim(get_option('home'), '/'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>
• <a href="<?php echo rtrim(get_option('home'), '/'); ?>/wp-login.php?action=logout">Abmelden</a>
</p>
<?php
}
else
{
?>
<p>
<label for="author">Name <small>(Kein SEO bitte!<?php
echo ($req) ? ' nötig' : '';
?>)</small></label>
<input type="text" name="author" id="author" value="<?php
echo $comment_author;
?>" class="singleline">
</p>
<p>
<label for="email">E-Mail
<small><?php
echo ($req) ? "(nötig, " : "(";
?>bleibt geheim)</small>
</label>
<input type="email" name="email" id="email" value="<?php
echo $comment_author_email;
?>" class="singleline">
</p>
<p><label for="url">Webseite</label>
<input type="url" name="url" id="url" value="<?php
echo $comment_author_url;
?>" class="singleline">
</p>
<?php
} // Angemeldet oder nicht
?>
<p class="submitcell">
<input name="submit" type="submit" id="submit"
class="submitbutton" value="Absenden">
<input type="hidden" name="comment_post_ID" value="<?php
echo $id;
?>">
</p>
</fieldset>
</form>
<?php
} // If registration required and not logged in
} // if you delete this the sky will fall on your head
function xwp_comment_author_meta($prefix)
{
$url = get_comment_author_url();
$author = $prefix . get_comment_author();
if ( empty( $url ) || 'http://' == $url )
{
$return = $author;
}
else
{
$return = "<a href='$url'>$author</a>";
}
return apply_filters('get_comment_author_link', $return);
}
?>
Alles anzeigen
Damit lassen sich aber keine Bäume abbilden, sondern nur eine lineare Ausgabe der Kommentare.