Hallo,
als Laien dachte ich mir, dass ich eine normale Seite verwenden kann und einfach die Kommentare über dem Eingabefeld anzeigen lassen kann. Und so hätte ich ein einfaches Gästebuch.
Nur stelle ich fest, dass es nicht so einfach ist, wenn man keine Ahnung hat. Eingabefeld funktioniert, aber Kommentare werden nicht dargestellt. Hat jemand eine Idee wo der Fehler liegt?
PHP
<?php get_header(); ?>
<?php get_sidebar(); ?>
<div id="main">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<div class="post">
<div class="storycontent">
<?php the_content(__('(more...)')); ?>
<?php if ( $comments ) : ?>
[list=1]
<?php foreach ($comments as $comment) : ?>
<li id="comment-<?php comment_ID() ?>">
<?php comment_text() ?>
<cite><?php comment_type(__('Kommentiert'), __('Trackback'), __('Pingback')); ?> <?php _e('by'); ?> <?php comment_author_link() ?> am <?php comment_date() ?> um [url="#comment-<?php comment_ID() ?>"]<?php comment_time() ?>[/url] <?php edit_comment_link(__("Edit This"), ' |'); ?></cite>
<?php endforeach;?>
[/list]
<?php else : // If there are no comments yet ?>
<?php _e('No comments yet.'); ?></p>
<?php endif; ?>
</div>
<?php endwhile;?>
<?php endif; ?>
</div>
<?php if ( comments_open() ) : ?>
<h2 id="postcomment"><?php _e('Leave a comment'); ?></h2>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
You must be [url="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>"]logged in[/url] to post a comment.</p>
<?php else : ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if ( $user_ID ) : ?>
Logged in as [url="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"]<?php echo $user_identity; ?>[/url]. [url="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout"]">Logout »[/url]</p>
<?php else : ?>
<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
<label for="author">[size="1"]Name <?php if ($req) _e('(required)'); ?>[/size]</label></p>
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
<label for="email">[size="1"]E-mail (wird nicht veröffentlicht) <?php if ($req) _e('(required)'); ?>[/size]</label></p>
<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
<label for="url">[size="1"]Website[/size]</label></p>
<?php endif; ?>
<!--
[size="1"][b]XHTML:[/b] You can use these tags: <?php // echo allowed_tags(); ?>[/size]</p>-->
<textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>
<input name="submit" type="submit" id="submit" tabindex="5" value="Senden" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
</p>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php endif; // If registration required and not logged in ?>
<?php else : // Comments are closed ?>
<?php _e('Sorry, the comment form is closed at this time.'); ?></p>
<?php endif; ?>
</div>
<?php get_footer(); ?>
Alles anzeigen