Hallo Gemeinde,
ich brauche mal wieder euere Hilfe.
Seite: media-store.net
Problem:
Und zwar habe ich mir ein Theme nach Anleitung von Perun.net hier https://workshops.akademie.de/gestalten/desi…kurs/index.html selber gebastelt.
Soweit funktioniert auch alles, bis auf die Kommentarfunktion!
Ein Bekannter hat mich informiert, dass die Kommentarfunktion nicht hinhaut.
Der Kommentarbereich wird soweit auch in der Einzelansicht angezeigt, nur wenn man das Feld ausgefüllt und auf Senden klickt, kriegt man ein Fehler bzw. den Text angezeigt der in der single.php nach Endwhile: aufgeführt wird.
Wenn ich auf eines der WP eigenen Themes wechsele funktioniert das Kommentieren problemlos, also gehe ich stark davon aus dass der Fehler in meinem Theme bzw. in der comments.php steckt.
Da ich aber in der WP-Strucktur nicht sonderlich viel Ahnung habe bin ich auf euch angewiesen.
Da dieser Kurs natürlich schon etwas älter ist, kann es evtl. auch nur wegen der WP-Version sein.
Folgender Code ist in meiner comments.php
<?php if ( !empty($post->post_password) && $_COOKIE['wp-postpass_' .COOKIEHASH] != $post->post_password) : ?>
<p>Tippe dein Passwort ein um die Kommentare zu lesen.</p><?php return; endif; ?><h2 id="comments"> <?php comments_number('Keine Kommentare', 'Ein Kommentar', '% Kommentare'); ?> <?php if ( comments_open() ) : ?> <a href="#postcomment" title="Hinterlasse ein Kommentar">» »</a> <?php endif; ?></h2><?php if ( $comments ) : ?><ol id="commentlist"> <?php foreach ($comments as $comment) : ?> <li id="comment-<?php comment_ID(); ?>"> <?php comment_text(); ?> <p><cite> <?php comment_type('Kommentar', 'Trackback', 'Pingback'); ?> von <?php comment_author_link(); ?> - <?php comment_date(); ?> um <a href="#comment-<?php comment_ID(); ?>"> <?php comment_time(); ?> </a></cite> <?php edit_comment_link(); ?> </p> </li> <?php endforeach; ?></ol><?php else : // Es wurden noch keine Kommentare abgegeben ?><p>Bis jetzt noch keine Kommentare</p><?php endif; ?><p> <?php post_comments_feed_link('RSS-Feed für Kommentare dieses Beitrags'); ?> <?php if ( pings_open() ) : ?> - <a href="<?php trackback_url(); ?>" rel="trackback">Die Trackback-Adresse</a> <?php endif; ?></p><?php if ( comments_open() ) : ?><h2 id="postcomment">Einen Kommentar abgeben</h2><?php if ( get_option('comment_registration') && !$user_ID ) : ?><p><?php printf('Du musst dich <a href="%s">eingeloggen</a> umKommentare abzugeben.', get_option('siteurl')."/wp-login.php?redirect_to=".urlencode(get_permalink()));?></p><?php else : ?><form action="<?php echo get_option('siteurl'); ?>/wp-commentspost.php" method="post" id="commentform"> <?php if ( $user_ID ) : ?> <p><?php printf('Angemeldet als %s.', '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'. $user_identity.'</a>');?><a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout"title="Ausloggen bzw. Abmelden">Abmelden »</a></p> <?php else : ?> <p> <input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" /> <label for="author"><small>Name <?php if ($req) '(erforderlich)'; ?> </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>E-Mail (wird nicht veröffentlicht) <?php if ($req) '(erforderlich)'; ?> </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>Website</small></label> </p> <?php endif; ?> <p>Folgende HTML-Tags sind erlaubt: <code><?php echo allowed_tags(); ?></code>.</p> <p> <textarea name="comment" id="comment" cols="55" rows="12"tabindex="4"></textarea> </p> <p> <input name="submit" type="submit" id="submit" tabindex="5"value="<?php echo attribute_escape(__('Submit Comment')); ?>" /> <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /> </p> <?php do_action('comment_form', $post->ID); ?></form><?php endif; // Ende: wenn Registrierung erforderlich, aber man nicht eingeloggt ist ?><?php else : // Kommentare sind geschlossen ?><p>Tut mir Leid, aber die Kommentar-Funktion ist momentan deaktiviert.</p><?php endif; ?>
Das hier steht in der single.php
<?php get_header(); ?>
<div id="main"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h2> <a href="<?php the_permalink(); ?>" rel="bookmark" title="Zum Beitrag: <?php the_title(); ?>"> <?php the_title(); ?> </a> </h2> <div class="der-beitrag"> <?php the_content(); ?> </div> <!-- Ende des jeweiligen Beitrags --> <div class="beitrags-info2"> <dl> <dt>Kategorien:</dt> <dd> <?php the_category(', ') ?> </dd> <dt>Tags:</dt> <dd> <?php the_tags('', ', ', ''); ?> </dd> <dt>Kommentare:</dt> <dd> <?php comments_rss_link('Kommentare verfolgen'); ?> oder ein <a href="#respond" rel="nofollow">Kommentar abgeben</a></dd> </dl> </div> <!-- Ende .beitrags-info2 --> <p class="center"> <?php previous_post_link('%link','«« Zum vorherigen Beitrag'); ?> — <?php next_post_link('%link','Zum nächstenBeitrag »»'); ?> </p> <div id="respond"> <?php comments_template(); /* Der Kommentarbereich */ ?> </div> <?php endwhile; else: ?> <p>Tut mir leid, es wurde kein passender Inhalt gefunden. Um nach Inhalten zu suchen, versuch es mit der Suchfunktion. </p> <?php endif; ?> <p class="blaetern"> <?php posts_nav_link(' - ', '« Zurück','Weiter »'); ?> </p></div><!-- /#inhalt -->
<?php get_sidebar(); ?><?php get_footer(); ?>
Hoffe mir kann jemand auf die Spur helfen...