added comments.php and comments function into single.php
authorAnthony Talarico <talarico@gaslightmedia.com>
Thu, 14 Jan 2016 17:54:25 +0000 (12:54 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Thu, 14 Jan 2016 17:54:25 +0000 (12:54 -0500)
comments.php [new file with mode: 0644]
single.php

diff --git a/comments.php b/comments.php
new file mode 100644 (file)
index 0000000..353cd14
--- /dev/null
@@ -0,0 +1,89 @@
+<?php
+/**
+ * The template for displaying comments
+ *
+ * The area of the page that contains both current comments
+ * and the comment form.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+if ( ! function_exists( 'twentyfifteen_comment_nav' ) ) :
+/**
+ * Display navigation to next/previous comments when applicable.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_comment_nav() {
+    // Are there comments to navigate through?
+    if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :
+?>
+<nav class="navigation comment-navigation" role="navigation">
+    <h2 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfifteen' ); ?></h2>
+    <div class="nav-links">
+        <?php
+    if ( $prev_link = get_previous_comments_link( __( 'Older Comments', 'twentyfifteen' ) ) ) :
+    printf( '<div class="nav-previous">%s</div>', $prev_link );
+    endif;
+
+    if ( $next_link = get_next_comments_link( __( 'Newer Comments', 'twentyfifteen' ) ) ) :
+    printf( '<div class="nav-next">%s</div>', $next_link );
+    endif;
+        ?>
+    </div><!-- .nav-links -->
+</nav><!-- .comment-navigation -->
+<?php
+    endif;
+}
+endif;
+/*
+ * If the current post is protected by a password and
+ * the visitor has not yet entered the password we will
+ * return early without loading the comments.
+ */
+if ( post_password_required() ) {
+    return;
+}
+?>
+
+<div id="comments" class="comments-area">
+
+    <?php if ( have_comments() ) : ?>
+    <h2 class="comments-title">
+        <?php
+        printf( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'twentyfifteen' ),
+               number_format_i18n( get_comments_number() ), get_the_title() );
+        ?>
+    </h2>
+
+    <?php twentyfifteen_comment_nav(); ?>
+
+    <ol class="comment-list">
+        <?php
+        wp_list_comments( array(
+            'style'       => 'ol',
+            'short_ping'  => true,
+            'avatar_size' => 56,
+        ) );
+        ?>
+    </ol><!-- .comment-list -->
+
+    <?php twentyfifteen_comment_nav(); ?>
+
+    <?php endif; // have_comments() ?>
+
+    <?php
+    // If comments are closed and there are comments, let's leave a little note, shall we?
+    if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
+    ?>
+    <p class="no-comments"><?php _e( 'Comments are closed.', 'twentyfifteen' ); ?></p>
+    <?php endif; ?>
+
+    <?php comment_form(
+    array(
+        'class_submit' => 'button'
+    )
+); ?>
+
+</div><!-- .comments-area -->
index 544afa5..259a475 100644 (file)
@@ -55,6 +55,9 @@
                                     ?>
                                 </footer>
                             </article>
+                            <?php if ( comments_open() || get_comments_number() ) :
+                            comments_template();
+                            endif; ?>
                         </div><!--/.small-12 .columns-->
                     </div><!--/.row-->
                 </div><!--/.small-11 .small-centered .columns-->