Advertisement
alchymyth

frontpage-comments.php

May 7th, 2012
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.41 KB | None | 0 0
  1. <?php
  2. /**
  3.  * frontpage-comments.php
  4.  * to show comment form on front page
  5.  */
  6.  ?>
  7.  
  8.     <div class="frontpage-comments">
  9.     <?php if ( post_password_required() ) : ?>
  10.         <p class="nopassword"><?php 'This post is password protected. Enter the password to add comments.'; ?></p>
  11.     </div><!-- .frontpage-comments -->
  12.     <?php
  13.             /* Stop the rest of comments.php from being processed,
  14.              * but don't kill the script entirely -- we still have
  15.              * to fully load the template.
  16.              */
  17.             return;
  18.         endif;
  19.     ?>
  20.  
  21.     <?php // You can start editing here -- including this comment! ?>
  22.  
  23.     <?php if ( have_comments() ) : ?>
  24.         <p class="comments-title">
  25.             <a href="<?php the_permalink(); ?>#comments">Click to read the existing <?php echo ((get_comments_number()==1)?' comment':get_comments_number().' comments'); ?><?php if ( comments_open() ) echo ' before commenting'; ?>.</a><?php if ( comments_open() ) echo ' Or comment directly below:'; else echo ' Comments are closed.'; ?>
  26.         </p>
  27.  
  28.  
  29.     <?php
  30.         /* If there are no comments and comments are closed, let's leave a little note, shall we?
  31.          * But we don't want the note on pages or post types that do not support comments.
  32.          */
  33.         elseif ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) :
  34.     ?>
  35.         <p class="nocomments"><?php 'Comments are closed.'; ?></p>
  36.     <?php endif; ?>
  37.  
  38.     <?php comment_form(); ?>
  39.  
  40. </div><!-- .frontpage-comments -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement