Hallo WP-Freunde,
ich arbeite an einem eigenen Theme in WP. Allgemein teilt sich meine Seite in zwei Bereiche - Das Content-<div> und das Sidebar-<div>, die nebeneinander her fließen.
Jetzt habe ich im Content-<div> ein Kommentarformular über die comments.php eingefügt und dabei ergibt sich folgendes Problem.
Nachdem die comments.php im Content geladen ist, rutscht das Sidebar-<div> in das Content-<div> unterhalb des Kommentarformulars.
Sobald aber ein Kommentar veröffentlicht wird, springt das Sidebar-<div> wieder an die Stelle, an die es gehört.
Ich vermute, dass ich einen Codefehler in meiner comments.php habe. Aber leider kann ich nichts ausfindig machen.
Ich habe versucht online den Code auf Fehler zu prüfen. Das blieb allerdings ohne Erfolg.
Jetzt hoffe ich auf euch und poste mal den Code der comments.php. Vielleicht seht ihr ja wo der Fehler liegt.
<div id="respond">
<h4 id="kommentar-titel">Und jetzt du! Schreib uns deine Geschichte.</h4>
<p id="kommentar-untertitel">
<small>Um uns vor Spam zu schützen, bitten wir dich die markierten Felder auszufüllen. Deine E-Mail-Adresse wird nicht veröffentlicht.</small>
</p>
<div id="cancel-comment-reply"> <!-- Kommentarformular wieder schließen (beim Antworten auf Kommentare)-->
<small><?php cancel_comment_reply_link(); ?></small>
</div>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<p class="eingabe-name">
<label for="author">Name* </label>
<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="50" />
</p>
<p class="eingabe-mail">
<label for="email">E-Mail* </label>
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="50" tabindex="2" />
</p>
<p class="eingabe-url">
<label for="url">Webseite </label>
<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="50" tabindex="3" />
</p>
<div>
<?php comment_id_fields(); ?> <!-- von JS benötigt im verschachtelte Kommentare auszugeben -->
<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER["REQUEST_URI"]); ?>" />
</div>
<p class="eingabe-kommentar">
<label>Kommentare, Anmerkungen und Anekdoten</label>
<textarea name="comment" id="comment" style="width: 76%;" rows="10" tabindex="4"></textarea>
</p>
<div class="clear"></div>
<p>
<input name="submit" type="submit" id="submit" tabindex="5" value="SENDEN" />
<?php comment_id_fields(); ?>
</p>
<?php do_action('comment_form', $post->ID); ?>
<div class="clear"></div>
</form>
<!-- KOMMENTARFORMULAR -->
<!-- ES FOLGT DER KOMMENTAR-LOOP (NOTWENDIG UM KOMMENTARE ANZUZEIGEN) -->
<div id="kommentare">
<?php foreach ($comments as $comment) : ?>
<div class="comment" id="comment-<?php comment_ID() ?>">
<div class="avatar">
<?php if(function_exists('get_avatar')) {
echo get_avatar('info@nuestra-america.de', $comment, 30 );
} ?>
</div>
<small class="comment-author"><?php comment_author_link() ?></small>
<small class="comment-date"><?php comment_date('j. F Y') ?></small>
</div>
<div class="clear"></div>
<div class="kommentar-text">
<?php comment_text() ?>
<?php comment_reply_link( array_merge( array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
<hr/>
</div>
<?php if ($comment->comment_approved == '0') : ?>
<strong>Achtung: Dein Kommentar muss moderiert werden.</strong><br />
<?php endif; /* end for each comment */ ?>
</div>
<?php endforeach; /* end for each comment */ ?>
<div class="clear"><div>
</div><!-- kommentare -->
Alles anzeigen
Ich habe schon einiges hin und her probiert, aber irgendwie gelingt es mir nicht, den Fehler zu finden.
Besten Dank für eure Hilfe.