Subversion Repositories ZenDark

Rev

Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 iacchi 1
<?php
2
/*
3
 * The template for displaying Comments.
4
 */
5
?>
6
<div id="comments">
7
        <?php if (post_password_required()) { ?>
27 iacchi 8
                <h3 class="comments-title"><?php _e( 'This post is password protected: enter the password to view any comments', 'zendark' ); ?></h3>
3 iacchi 9
        </div><!-- #comments -->
10
        <?php
11
                        /* Stop the rest of comments.php from being processed,
12
                         * but don't kill the script entirely -- we still have
13
                         * to fully load the template.
14
                         */
15
                        return;
16
                }
17
        ?>
18
 
19
<?php if (have_comments()) : ?>
20
        <h3 class="comments-title">
21
                <?php
27 iacchi 22
                        printf(_n('One comment on "%2$s"', '%1$s comments on "%2$s"', get_comments_number(), 'zendark'), number_format_i18n(get_comments_number()), get_the_title());
3 iacchi 23
    ?>
24
        </h3>
25
 
26
<?php
27
  /* Here is what you do if you want paged comments, i.e. showing comments and
28
   * pingbacks/trackbacks together, because I haven't found a way to nicely
29
   * separate them. If you find it, please tell me.
30
   */
31
 
32
  if (get_option('page_comments')) : // are there comments to navigate through
33
    if (get_comment_pages_count() > 1) : ?>
34
        <nav id="comment-nav-above">
27 iacchi 35
                <div class="nav-next"><?php next_comments_link(__('⇽ Newer Comments', 'zendark')); ?></div>
36
                <div class="nav-previous"><?php previous_comments_link(__('Older Comments ⇾', 'zendark')); ?></div>
3 iacchi 37
        </nav>
38
  <?php endif; ?>
39
 
40
  <?php
41
                /* Loop through and list the comments. Tell wp_list_comments()
42
                 * to use twentyeleven_comment() to format the comments.
43
                 * If you want to overload this in a child theme then you can
44
                 * define twentyeleven_comment() and that will be used instead.
45
                 * See twentyeleven_comment() in twentyeleven/functions.php for more.
46
                 */
27 iacchi 47
                wp_list_comments(array('callback' => 'zendark_all_comment'));
3 iacchi 48
 
49
    if (get_comment_pages_count() > 1) :
50
  ?>
51
 
52
                <nav id="comment-nav-below">
27 iacchi 53
                        <div class="nav-next"><?php next_comments_link(__('⇽ Newer Comments', 'zendark')); ?></div>
54
                        <div class="nav-previous"><?php previous_comments_link(__('Older Comments ⇾', 'zendark')); ?></div>
3 iacchi 55
                </nav>
56
    <?php endif; ?>
57
  <?php endif; // check for comment navigation ?>
58
 
59
<?php
60
  /* Here is what you do if you don't have paged comments: you can separate
61
   * comments from trackbacks/pingbacks and display the latter at the end.
62
   */
63
   if (!get_option('page_comments')) :
64
   /* Loop through and list the comments. Tell wp_list_comments()
65
                 * to use twentyeleven_comment() to format the comments.
66
                 * If you want to overload this in a child theme then you can
67
                 * define twentyeleven_comment() and that will be used instead.
68
                 * See twentyeleven_comment() in twentyeleven/functions.php for more.
69
                 */
27 iacchi 70
                wp_list_comments(array('callback' => 'zendark_comment'));
3 iacchi 71
 
72
    // Check if we have pingbacks/trackbacks before displaying them
27 iacchi 73
    if (zendark_trackback_number($comments) != 0) :
3 iacchi 74
  ?>
75
  <h3 class="comments-title">Trackback e pingback</h3>
76
 
77
  <?php
78
                /* This way we separate comments from trackpacks/pingbacks
79
                 */
27 iacchi 80
      wp_list_comments(array('callback' => 'zendark_trackback'));
3 iacchi 81
    endif;
82
   endif; // check for comment navigation ?>
83
<?php endif; ?>
84
 
85
<?php
86
                /* If comments and trackbacks are closed, let's leave a little note, shall we?
87
                 * But we don't want the note on pages.
88
                 */
89
                if (!comments_open() && !pings_open() && !is_page()) :
90
        ?>
27 iacchi 91
    <h3 class="comments-title"><?php _e('Comments and trackbacks are closed', 'zendark'); ?></h3>
3 iacchi 92
<?php endif; ?>
93
 
94
<?php
95
                /* If comments are closed, let's leave a little note, shall we?
96
                 * But we don't want the note on pages.
97
                 */
98
                if (!comments_open() && pings_open() && !is_page()) :
99
        ?>
27 iacchi 100
    <h3 class="comments-title"><?php _e('Comments are closed', 'zendark'); ?></h3>
3 iacchi 101
<?php endif; ?>
102
 
103
<?php
104
                /* If trackbacks are closed, let's leave a little note, shall we?
105
                 * But we don't want the note on pages.
106
                 */
107
                if (comments_open() && !pings_open() && !is_page()) :
108
        ?>
27 iacchi 109
    <h3 class="comments-title"><?php _e('Trackbacks are closed', 'zendark'); ?></h3>
3 iacchi 110
<?php endif; ?>
111
 
112
<?php
113
                /* If there are no comments but they are opened, let's leave a little note, shall we?
114
                 * But we don't want the note on pages.
115
                 */
116
                if (comments_open() && !is_page() && !have_comments()) :
117
        ?>
27 iacchi 118
                <h3 class="comments-title"><?php printf(__('0 comments on "%1$s"', 'zendark'), get_the_title()); ?></h3>
3 iacchi 119
<?php endif; ?>
120
 
121
<?php
122
/* If comments are open, display a reply form. The function comment_form() is
123
 * necessary to have a form when replying to posts.
124
 */
125
  if (comments_open()) :
126
 
127
    // Code to generate form fields
128
    $fields = array(
27 iacchi 129
      'author' => '<p class="comment-form-field"><label for="author">'.__('Name', 'zendark').($req ? ' *' : '').'</label><br /><input id="author" name="author" type="text" value="'.esc_attr($commenter['comment_author']).'" size="100"'.$aria_req.' /></p>',
130
      'email' => '<p class="comment-form-field"><label for="email">'.__('Email', 'zendark').($req ? ' *' : '').'</label><br /><input id="email" name="email" type="text" value="'.esc_attr($commenter['comment_author_email']).'" size="100"'.$aria_req.' /></p>',
131
      'url' => '<p class="comment-form-field"><label for="url">'.__('Website', 'zendark').'</label><br /><input id="url" name="url" type="text" value="'.esc_attr($commenter['comment_author_url']).'" size="100" /></p>'
3 iacchi 132
    );
133
 
134
    comment_form(array(
27 iacchi 135
      'title_reply' => __('Write a Comment', 'zendark'),
136
      'comment_notes_before' => '<p class="comment-notes">'.__('Your email address will not be published.', 'zendark').($req ? __(' Required fields are marked with *', 'zendark') : '').'</p>',
3 iacchi 137
      'fields' => apply_filters('comment_form_default_fields', $fields),
27 iacchi 138
      'logged_in_as' => '<p class="logged-in-as">'.sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out ⇾</a>', 'zendark'), admin_url('profile.php'), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink()))).'</p>',
139
      'must_log_in' => '<p class="must-log-in">'.sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'zendark'), wp_login_url(apply_filters('the_permalink', get_permalink()))).'</p>',
140
      'comment_field' => '<p class="comment-form-comment"><label for="comment">'._x('Comment', 'noun', 'zendark').($req ? ' *' : '').'</label><br /><textarea id="comment" name="comment" cols="80" rows="8" aria-required="true"></textarea></p>',
141
      'comment_notes_after' => '<p class="form-allowed-tags">'.sprintf(__('Allowed <abbr title="HyperText Markup Language">HTML</abbr> code: %s', 'zendark'), '<code>'.allowed_tags().'</code>').'</p>',
142
      'label_submit' => __('Post Comment', 'zendark'),
143
      'title_reply_to' => __('Leave a Reply to %s', 'zendark'),
144
      'cancel_reply_link' => __('(Cancel reply)', 'zendark')
3 iacchi 145
    ));
146
  endif;
147
?>
148
 
149
</div><!-- #comments -->