Subversion Repositories ZenDark

Revisione

Revisione 3 | Responsabilità | Confronta con la precedente | Ultima modifica | Visualizza Log | feed RSS

<?php
/*
 * The template for displaying Comments.
 */

?>
<div id="comments">
        <?php if (post_password_required()) { ?>
                <h3 class="comments-title"><?php _e( 'This post is password protected: enter the password to view any comments', 'zendark' ); ?></h3>
        </div><!-- #comments -->
        <?php
                        /* Stop the rest of comments.php from being processed,
                         * but don't kill the script entirely -- we still have
                         * to fully load the template.
                         */

                        return;
                }
        ?>

<?php if (have_comments()) : ?>
        <h3 class="comments-title">
                <?php
                        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());
    ?>
        </h3>

<?php
  /* Here is what you do if you want paged comments, i.e. showing comments and
   * pingbacks/trackbacks together, because I haven't found a way to nicely
   * separate them. If you find it, please tell me.
   */

 
  if (get_option('page_comments')) : // are there comments to navigate through
    if (get_comment_pages_count() > 1) : ?>
        <nav id="comment-nav-above">
                <div class="nav-next"><?php next_comments_link(__('⇽ Newer Comments', 'zendark')); ?></div>
                <div class="nav-previous"><?php previous_comments_link(__('Older Comments ⇾', 'zendark')); ?></div>
        </nav>
  <?php endif; ?>

  <?php
                /* Loop through and list the comments. Tell wp_list_comments()
                 * to use twentyeleven_comment() to format the comments.
                 * If you want to overload this in a child theme then you can
                 * define twentyeleven_comment() and that will be used instead.
                 * See twentyeleven_comment() in twentyeleven/functions.php for more.
                 */

                wp_list_comments(array('callback' => 'zendark_all_comment'));

    if (get_comment_pages_count() > 1) :
  ?>
 
                <nav id="comment-nav-below">
                        <div class="nav-next"><?php next_comments_link(__('⇽ Newer Comments', 'zendark')); ?></div>
                        <div class="nav-previous"><?php previous_comments_link(__('Older Comments ⇾', 'zendark')); ?></div>
                </nav>
    <?php endif; ?>
  <?php endif; // check for comment navigation ?>

<?php
  /* Here is what you do if you don't have paged comments: you can separate
   * comments from trackbacks/pingbacks and display the latter at the end.
   */

   if (!get_option('page_comments')) :
   /* Loop through and list the comments. Tell wp_list_comments()
                 * to use twentyeleven_comment() to format the comments.
                 * If you want to overload this in a child theme then you can
                 * define twentyeleven_comment() and that will be used instead.
                 * See twentyeleven_comment() in twentyeleven/functions.php for more.
                 */

                wp_list_comments(array('callback' => 'zendark_comment'));

    // Check if we have pingbacks/trackbacks before displaying them
    if (zendark_trackback_number($comments) != 0) :
  ?>
  <h3 class="comments-title">Trackback e pingback</h3>

  <?php
                /* This way we separate comments from trackpacks/pingbacks
                 */

      wp_list_comments(array('callback' => 'zendark_trackback'));
    endif;
   endif; // check for comment navigation ?>
<?php endif; ?>

<?php
                /* If comments and trackbacks are closed, let's leave a little note, shall we?
                 * But we don't want the note on pages.
                 */

                if (!comments_open() && !pings_open() && !is_page()) :
        ?>
    <h3 class="comments-title"><?php _e('Comments and trackbacks are closed', 'zendark'); ?></h3>
<?php endif; ?>

<?php
                /* If comments are closed, let's leave a little note, shall we?
                 * But we don't want the note on pages.
                 */

                if (!comments_open() && pings_open() && !is_page()) :
        ?>
    <h3 class="comments-title"><?php _e('Comments are closed', 'zendark'); ?></h3>
<?php endif; ?>

<?php
                /* If trackbacks are closed, let's leave a little note, shall we?
                 * But we don't want the note on pages.
                 */

                if (comments_open() && !pings_open() && !is_page()) :
        ?>
    <h3 class="comments-title"><?php _e('Trackbacks are closed', 'zendark'); ?></h3>
<?php endif; ?>

<?php
                /* If there are no comments but they are opened, let's leave a little note, shall we?
                 * But we don't want the note on pages.
                 */

                if (comments_open() && !is_page() && !have_comments()) :
        ?>
                <h3 class="comments-title"><?php printf(__('0 comments on "%1$s"', 'zendark'), get_the_title()); ?></h3>
<?php endif; ?>

<?php
/* If comments are open, display a reply form. The function comment_form() is
 * necessary to have a form when replying to posts.
 */

  if (comments_open()) :

    // Code to generate form fields
    $fields = array(
      '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>',
      '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>',
      '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>'
    );

    comment_form(array(
      'title_reply' => __('Write a Comment', 'zendark'),
      'comment_notes_before' => '<p class="comment-notes">'.__('Your email address will not be published.', 'zendark').($req ? __(' Required fields are marked with *', 'zendark') : '').'</p>',
      'fields' => apply_filters('comment_form_default_fields', $fields),
      '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>',
      '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>',
      '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>',
      '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>',
      'label_submit' => __('Post Comment', 'zendark'),
      'title_reply_to' => __('Leave a Reply to %s', 'zendark'),
      'cancel_reply_link' => __('(Cancel reply)', 'zendark')
    ));
  endif;
?>

</div><!-- #comments -->