Advertisement
masonjames

Custom Comment Form

Oct 17th, 2011
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.21 KB | None | 0 0
  1. <?php
  2. // Do not delete these lines
  3.     if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
  4.         die ('Please do not load this page directly. Thanks!');
  5.  
  6.     if ( post_password_required() ) { ?>
  7.         <p class="nocomments"><?php _e('This post is password protected. Enter the password to view comments', 'woothemes' ); ?>.</p>
  8.     <?php
  9.         return;
  10.     }
  11. ?>
  12.  
  13. <!-- You can start editing here. -->
  14.  
  15. <div id="comments_wrap">
  16.  
  17. <?php if ( have_comments() ) : ?>
  18.  
  19.     <h3><?php comments_number(__('No Responses', 'woothemes' ), __('One Response', 'woothemes' ), __('% Responses', 'woothemes' ) );?> <?php _e('to', 'woothemes' ); ?><?php the_title(); ?>”</h3>
  20.  
  21.     <ol class="commentlist">
  22.     <?php wp_list_comments('avatar_size=48&callback=custom_comment'); ?>
  23.     </ol>    
  24.  
  25.     <div class="navigation">
  26.         <div class="alignleft"><?php previous_comments_link() ?></div>
  27.         <div class="alignright"><?php next_comments_link() ?></div>
  28.         <div class="fix"></div>
  29.     </div>
  30.     <br />
  31.     <?php if ( $comments_by_type['pings'] ) : ?>
  32.     <h2 id="pings"><?php _e('Trackbacks/Pingbacks', 'woothemes' ); ?></h3>
  33.     <ol class="commentlist">
  34.     <?php wp_list_comments('type=pings'); ?>
  35.     </ol>
  36.     <?php endif; ?>
  37.  
  38. <?php else : // this is displayed if there are no comments so far ?>
  39.  
  40.     <?php if ('open' == $post->comment_status) : ?>
  41.         <!-- If comments are open, but there are no comments. -->
  42.  
  43.      <?php else : // comments are closed ?>
  44.         <!-- If comments are closed. -->
  45.         <p class="nocomments"><?php _e('Comments are closed.', 'woothemes' ); ?></p>
  46.  
  47.     <?php endif; ?>
  48.  
  49. <?php endif; ?>
  50.  
  51. </div> <!-- end #comments_wrap -->
  52.  
  53. <?php if ('open' == $post->comment_status) : ?>
  54.  
  55. <div id="respond">
  56. ?php do_action( 'comment_form_before' ); ?>
  57. <h3><?php comment_form_title( __('Leave a Reply', 'woothemes' ), __('Leave a Reply to %s', 'woothemes' ) ); ?></h3>
  58. <div class="cancel-comment-reply">
  59.     <small><?php cancel_comment_reply_link( __( 'Click here to cancel reply.', 'woothemes' ) ); ?></small>
  60. </div>
  61.  
  62. <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
  63.  
  64. <p><?php _e('You must be', 'woothemes' ); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>"><?php _e('logged in', 'woothemes' ); ?></a> <?php _e('to post a comment.', 'woothemes' ); ?></p>
  65.  
  66. <?php else : ?>
  67. <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
  68. <fieldset class="form1">
  69.  
  70. <?php if ( $user_ID ) : ?>
  71.  
  72. <p><?php _e('Logged in as', 'woothemes' ); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(); ?>" title="<?php _e('Log out of this account', 'woothemes' ); ?>"><?php _e('Logout &raquo;', 'woothemes' ); ?></a></p>
  73.  
  74. <?php else : ?>
  75.  
  76. <p style="padding:5px 0px 10px 0px;"><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
  77. <label for="author"><?php _e('Name', 'woothemes' ); ?> <?php if ($req) _e( '(required)', 'woothemes' ); ?></label></p>
  78.  
  79. <p style="padding:5px 0px 10px 0px;"><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
  80. <label for="email"><?php _e('Mail (will not be published)', 'woothemes' ); ?> <?php if ($req)  _e( '(required)', 'woothemes' ); ?></label></p>
  81.  
  82. <p style="padding:5px 0px 10px 0px;"><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
  83. <label for="url"><?php _e('Website', 'woothemes' ); ?></label></p>
  84.  
  85. <?php endif; ?>
  86.  
  87. <p><textarea name="comment" id="comment" cols="50" rows="15" tabindex="4" style="width:97%"></textarea></p>
  88.  
  89. <p><input name="submit" type="submit" class="btn" tabindex="5" value="<?php _e('Submit Comment', 'woothemes' ); ?>" />
  90. <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
  91. </p><?php comment_id_fields(); ?>
  92. <?php do_action('comment_form', $post->ID); ?>
  93.     </fieldset>
  94.  
  95. </form>
  96.  
  97. <?php endif; // If logged in ?>
  98. <?php do_action( 'comment_form_after' ); ?>
  99. <div class="fix"></div>
  100. </div> <!-- end #respond -->
  101.  
  102. <?php endif; // if you delete this the sky will fall on your head ?>
  103.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement