Anoop K S
comments.php
0 Answer(s)      3 years ago
Posted in : Java Beginners

<?php
/**
* @package WordPress
* @subpackage Default_Theme
*/

// Do not delete these lines
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');

if ( post_password_required() ) { ?>
<p class="nocomments">This post is password protected. Enter the password to view comments.</p>
<?php
return;
}
?>

<!-- You can start editing here. -->
<?php if ( comments_open() ) : ?>

<div id="respond">
<h3>Ajouter un Commentaire</h3>
<div class="cancel-comment-reply">
<small><?php cancel_comment_reply_link(); ?></small>
</div>

<?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
You must be <a href="<?php echo wp_login_url( get_permalink() ); ?>">logged in</a> to post a comment.
<?php else : ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<textarea name="comment" id="comment" cols="58" rows="10" tabindex="4" ></textarea>
<?php if ( is_user_logged_in() ) : ?>
Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out &raquo;</a>
<?php else : ?>
<input type="text" name="author" id="author" value="<?php if(esc_attr($comment_author) != '') { echo esc_attr($comment_author); } else { echo "Name"; } ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> onclick="if(this.value=='Name') { this.value = ''}" />
<input type="text" name="email" id="email" value="<?php if(esc_attr($comment_author_email) != '') { echo esc_attr($comment_author_email); } else { echo "Email"; } ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> onclick="if(this.value=='Email') { this.value = ''}" />
<?php endif; ?>
<input name="submit" type="image" id="submit" tabindex="5" value="Post Comment" src="<?php bloginfo('template_url'); ?>/images/button.png" width="5" height="18"/>
<?php comment_id_fields(); ?>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php endif; // If registration required and not logged in ?>
</div>

<?php if ( have_comments() ) : ?>
<h3><?php comments_number('Comments', 'Comments', 'Commentaires' );?></h3>

<?php $i = 0; ?>
<?php foreach ($comments as $comment) : ?>
<div id="comment-<?php comment_ID(); ?>" class="comment" <?php if($i > 0) { echo " style='border-top: 1px solid #2B2B2B;'"; } ?>>
<div class="comment-author vcard">
<?php echo get_avatar($comment, $size='64'); ?>
</div>
<div class="comment-meta">
<b><?php comment_author(); ?></b> <span><?php echo get_relative_time('comment');?></span>
<?php comment_text() ?>
</div>
<div class="clear"></div>
</div>
<?php $i++; ?>
<?php endforeach; ?>


<?php else : // this is displayed if there are no comments so far ?>

<?php if ( comments_open() ) : ?>
<!-- If comments are open, but there are no comments. -->

<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p class="nocomments">Comments are closed.</p>

<?php endif; ?>
<?php endif; ?>
<?php endif; // if you delete this the sky will fall on your head ?>
View Answers









Related Pages:
comments.php - Java Beginners
comments.php   This post is password protected. Enter the password to view comments. Ajouter un Commentaire You must be logged in to post a comment. Logged in as . Log out

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.