Welches Template ist für die Kommentardarstellung zuständig? In comments.php werde ich nicht fündig.
Gibt's vorlagen, die ich mir anpassen kann? Oder kann mir einer sagen, wie die Variablen heißen, die ich einfügen muss?
m.f.G.
Um schreiben oder kommentieren zu können, benötigen Sie ein Benutzerkonto.
Sie haben schon ein Benutzerkonto? Melden Sie sich hier an.
Jetzt anmeldenHier können Sie ein neues Benutzerkonto erstellen.
Neues Benutzerkonto erstellenWelches Template ist für die Kommentardarstellung zuständig? In comments.php werde ich nicht fündig.
Gibt's vorlagen, die ich mir anpassen kann? Oder kann mir einer sagen, wie die Variablen heißen, die ich einfügen muss?
m.f.G.
Hallo!
Wenn du gerade an deiner Website arbeitest oder dein aktuelles Hosting überdenkst: Wir betreiben mit NetzLiving eine Hosting-Plattform, die speziell auf Performance, Sicherheit und einfache Verwaltung ausgelegt ist.
Die comments.php regelt das Markup und in der style.css wird das Aussehen gesteuert. Was hast du denn nicht gefunden?
Ich suche die Stelle, wo steht: Autor, Nr, Uhrzeit, Avatar, Kommentar.
Hab die comments.php aus dem default-theme übernommen...
Grüße
Ach so. Das wird in der wp_list_comments() erledigt; dazu hilft dir vielleicht dieser Artikel: Kommentare formatieren in WordPress 2.7.
Genau das hab ich gesucht. Funktioniert das auch mit aktuelleren Versionen?
Ja, tut es. Du kannst auch den Aufruf dieser Funktion komplett weglassen und deine eigene Ausgabe schreiben.
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.
Kann mir vielleicht einfach einer sagen, welche Variablen ich einfügen muss?
Ich komm mit der Menge Code nicht klar -.-
Mein Template sieht jetzt so aus:
<head>
<style>
.commentbar {
display:block;
width:448px;
height:15px;
padding:18px;
}
.name {
float:left;
font:13px Verdana;
color:#000;
}
.details {
float:right;
font:13px Verdana;
color:#000;
}
.commentbody {
clear:both;
padding:15px;
padding-top:0px;
}
</style>
</head>
<body>
<div class="comments">
<div class="commentbar">
<span class="name">*nr* <cite class="fn">*username*</cite> sagt:</span><span class="details">*datum* um *zeit* Uhr</span>
</div>
<div class="commentbody">
*nachricht*
</div>
</div>
</body>
Alles anzeigen
In ** habe ich die einzusetzenden Variablen....
Kann damit niemand etwas anfangen? Wo liegt der Fehler?
Danke
Klecka
Der Fehler liegt in den Zeilen 1—23, aber die kennst nur du.
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!