source: trunk/www.guidonia.net/wp/wp-content/themes/duplexes/comments.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 15 years ago
File size: 6.1 KB
Line 
1<?php // Do not delete these lines
2// thanks to Jeremy at http://clarktech.no-ip.com for the tips
3 if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
4 die ('Please do not load this page directly. Thanks!');
5if (function_exists('post_password_required'))
6 {
7 if ( post_password_required() )
8 {
9 echo '<p class="nocomments">This post is password protected. Enter the password to view comments.</p>';
10 return;
11 }
12 } else
13 {
14 if (!empty($post->post_password))
15 { // if there's a password
16 if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password)
17 { // and it doesn't match the cookie ?>
18 <p class="nocomments">This post is password protected. Enter the password to view comments.</p>
19 <?php return;
20 }
21 }
22 }
23if (function_exists('wp_list_comments')):
24//WP 2.7 Comment Loop
25if ( have_comments() ) : ?>
26
27 <?php if ( ! empty($comments_by_type['comment']) ) :
28 $count = count($comments_by_type['comment']);
29 ($count !== 1) ? $txt = "Comments for this entry" : $txt = "Comment for this entry"; ?>
30 <h3 id="comments"><?php echo $count . " " . $txt; ?></h3>
31 <ul class="commentlist">
32 <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
33 </ul>
34 <?php endif; ?>
35
36 <div class="navigation">
37 <div class="alignleft"><?php previous_comments_link() ?></div>
38 <div class="alignright"><?php next_comments_link() ?></div>
39 <div class="cleared"></div>
40 </div>
41
42 <?php if ( ! empty($comments_by_type['pings']) ) :
43 $countp = count($comments_by_type['pings']);
44 ($countp !== 1) ? $txtp = "Trackbacks / Pingbacks for this entry" : $txtp = "Trackback or Pingback for this entry"; ?>
45 <h3><?php echo $countp . " " . $txtp; ?></h3>
46 <ul class="trackback">
47 <?php wp_list_comments('type=pings&callback=mytheme_ping'); ?>
48 </ul>
49 <?php endif; ?>
50
51
52<?php else : // this is displayed if there are no comments so far ?>
53 <?php if ('open' == $post->comment_status) :
54 // If comments are open, but there are no comments.
55 else : ?><p class="nocomments">Comments are closed.</p>
56 <?php endif;
57endif;
58else:
59//WP 2.6 and older Comment Loop
60/* This variable is for alternating comment background */
61 $oddcomment = 'alt';
62?>
63
64<!-- You can start editing here. -->
65<?php if ($comments) : ?>
66 <h3 id="comments"><?php comments_number('No comments filed', 'One comment', '% comments' );?> for this entry</h3>
67 <ol class="commentlist">
68 <?php foreach ( $comments as $comment ) : ?>
69 <li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
70
71<a class="gravatar">
72<?php
73if (function_exists('get_avatar')) {
74 echo get_avatar( $comment, 44);
75 } else {
76 //alternate gravatar code for < 2.5
77 $grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=
78 " . md5($email) . "&default=" . urlencode($default) . "&size=" . $size;
79 echo "<img src='$grav_url' height='44px' width='44px' />";
80 }
81?>
82</a>
83
84 <div class="commentbody">
85 <cite><?php comment_author_link() ?></cite>
86 <?php if ($comment->comment_approved == '0') : ?>
87 <em>Your comment is awaiting moderation.</em>
88 <?php endif; ?>
89 <br />
90 <small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> on <?php comment_time() ?></a> <?php edit_comment_link('edit','&nbsp;&nbsp;',''); ?></small>
91<div class="cleared"></div>
92 <?php comment_text() ?>
93 </div>
94 </li>
95
96 <?php /* Changes every other comment to a different class */
97 if ('alt' == $oddcomment) $oddcomment = '';
98 else $oddcomment = 'alt';
99 ?>
100 <?php endforeach; /* end for each comment */ ?>
101 </ol>
102 <?php else : // this is displayed if there are no comments so far ?>
103
104 <?php if ('open' == $post->comment_status) : ?>
105 <!-- If comments are open, but there are no comments. -->
106 <?php else : // comments are closed ?>
107 <!-- If comments are closed. -->
108 <p class="nocomments">Comments are closed.</p>
109
110
111
112
113<?php endif; ?>
114
115<?php endif; ?>
116
117<?php endif; // 2.6 and older Comment Loop end ?>
118
119<?php if ('open' == $post->comment_status) : ?>
120<div class="cleared"></div>
121<div id="respond">
122<h3>Leave a Reply</h3>
123<?php if (function_exists('cancel_comment_reply_link')) {
124//2.7 comment loop code ?>
125<div id="cancel-comment-reply">
126 <small><?php cancel_comment_reply_link();?></small>
127</div>
128<?php } ?>
129
130<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
131<p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p></div>
132<?php else : ?>
133<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
134<?php if ( $user_ID ) : ?>
135<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout &raquo;</a></p>
136<?php else : ?>
137<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
138<label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p>
139<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
140<label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p>
141<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
142<label for="url"><small>Website</small></label></p>
143<?php endif; ?>
144
145<?php if (function_exists('cancel_comment_reply_link')) {
146//2.7 comment loop code ?>
147 <?php comment_id_fields(); ?>
148<?php } ?>
149
150<!--<p><small><strong>XHTML:</strong> You can use these tags: <?php echo allowed_tags(); ?></small></p>-->
151<p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>
152<p><input name="submit" type="submit" id="submit" class="submitbutton" tabindex="5" value="Leave comment" />
153<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
154</p>
155
156<?php do_action('comment_form', $post->ID); ?>
157
158</form>
159</div>
160<?php endif; // If registration required and not logged in ?>
161
162<?php endif; // if you delete this the sky will fall on your head ?>
Note: See TracBrowser for help on using the repository browser.