Add comment form
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 15 Dec 2015 14:59:15 +0000 (09:59 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 15 Dec 2015 14:59:15 +0000 (09:59 -0500)
comments.php [new file with mode: 0644]
scss/_blog.scss
single.php

diff --git a/comments.php b/comments.php
new file mode 100644 (file)
index 0000000..f203e49
--- /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 053375a..e3b2bda 100644 (file)
@@ -238,4 +238,4 @@ input[type="submit"].blogbutton {
     ul {
         list-style-type: none;
     }
-}
\ No newline at end of file
+}
index 2f793ad..2b0e70c 100644 (file)
@@ -1,6 +1,6 @@
 <?php get_header(); ?>
    <?php glm_get_header(); ?>
-    <main class="blog-single">    
+    <main class="blog-single">
         <div class="row">
             <div id="blog-posts-over" class="small-12 medium-9 columns">
                 <?php if(have_posts()) : while(have_posts()): the_post();?>
                             </div>
                             <div class="small-12 columns">
                             <?php } else { ?>
-                            <div class="small-12 columns"> 
+                            <div class="small-12 columns">
                             <?php } ?>
                                 <article id="<?php the_ID()?>" <?php post_class()?>>
                                     <h1><?php the_title();?></h1>
                                     <?php echo the_content(); ?>
-                                    
+
                                 </article>
+                    <?php if ( comments_open() || get_comments_number() ) :
+                        comments_template();
+                    endif; ?>
                             </div>
                         </div>
                     </div>
-                </div>
+                    </div>
                 <?php endwhile; ?>
                 <?php else: ?>
                 <div id="post-404" class="noposts">