• I have a problem. When I’d like to comment on a post I always get this error:
    “Error: please type a comment.”

    However, I’ve already typed it..
    I think I deleted accidentally something in my comments.php..or I don’t know. This is my comments.php file:

    <head><link rel="stylesheet" href="/wp-content/themes/DLNtheme/style.css" type="text/css" media="screen" /></head>
    <?php
    if (isset($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    die ('Please do not load this page directly. Thanks!');
    if ( post_password_required() ) {
    ?>
    <p class="nocomments">
    <?php _e('This post is password protected. Enter the password to view comments.'); ?>
    </p>
    <?php return; } ?>
    <!-- You can start editing here. -->
    <h3 id="comments">
    <?php comments_number(__('No replies'), __('One reply'), __('% replies'));?>
    <?php printf(__(' to “%s”'), the_title('', '', false)); ?>
    </h3>
    <div class="simplecont">
    <?php if($comments) : ?>
    <table class="allcomments" cellpadding="1" cellspacing="3" align="center">
    <?php foreach($comments as $comment) : ?>
    <tr>
    <td class="DLNcomment">
    <div class="DLNcomposter">
    Posted by <?php comment_author_link(); ?> | <?php if( function_exists( 'atrwcp_reply' ) ) atrwcp_reply(); ?>
    </div>
    <div class="DLNcomtext">
    <?php comment_text(); ?>
    </div>
    <div class="DLNcomdate">
    <?php comment_date(); ?> at <?php comment_time(); ?>
    </div>
    </td>
    </tr>
    <?php endforeach; ?>
    </table>
    </div>
    <?php else : ?>
    <p>No comments yet</p>
    <?php endif; ?>
    <?php if ( comments_open() ) : ?>
    </div>
    <div id="respond">
    <h3>
    <?php comment_form_title( __('Leave a reply'), __('Leave a reply for %s' ) ); ?>
    </h3>
    <div class="simplecont">
    <div id="cancel-comment-reply">
    <small>
    <?php cancel_comment_reply_link() ?>
    </small>
    </div>
    <?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
    <p>
    <?php printf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url( get_permalink() )); ?>
    </p>
    <?php else : ?>
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    <?php if ( is_user_logged_in() ) : ?>
    <p>
    <?php printf(__('Logged in as <a href="%1$s">%2$s</a>.'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity); ?>
    <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php _e('Log out of this account'); ?>">
    <?php _e('Log out &raquo;'); ?>
    </a>
    </p>
    <?php else : ?>
    <p>
    <input type="hidden" name="comment_post_ID" value="<?php echo $post->id; ?>" />
    </p>
    <p>
    <input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) 
    
    echo "aria-required='true'"; ?> />
    <label for="author">
    <small>
    <?php _e('Name'); ?>
    <?php if ($req) _e(" (required)"); ?>
    </small>
    </label>
    </p>
    <p>
    <input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if 
    
    ($req) echo "aria-required='true'"; ?> />
    <label for="email">
    <small>
    <?php _e('E-mail'); ?>
    <?php if ($req) _e(" (required)"); ?>
    </small>
    </label>
    </p>
    <p>
    <input type="text" name="url" id="url" value="<?php echo  esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
    <label for="url">
    <small>
    <?php _e('Website'); ?>
    </small>
    </label>
    </p>
    <?php endif; ?>
    <!--<p><small><?php printf(__('<strong>XHTML:</strong> You can use these tags: <code>%s</code>'), allowed_tags()); 
    
    ?></small></p>-->
    <p>
    <textarea id="comment" cols="50" rows="7" tabindex="4"></textarea>
    </p>
    <p>
    <input name="submit" type="submit" id="submit" tabindex="5" value="<?php _e('Submit comment'); ?>" />
    <?php comment_id_fields(); ?>
    </p>
    </div>
    <?php do_action('comment_form', $post->ID); ?>
    </form>
    <?php endif; // If registration required and not logged in ?>
    </div>
    </div>
    <?php endif; // if you delete this the sky will fall on your head ?>
    <?php wp_footer(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • What is this?

    <head><link rel="stylesheet" href="/wp-content/themes/DLNtheme/style.css" type="text/css" media="screen" /></head>

    You can’t have a <head> element here, this would be very invalid HTML, and might be messing with the form. First make sure your HTML is valid, then come back and let us know if you are still having problems.

    You’re missing name="comment"

    <textarea id="comment" cols="50" rows="7" tabindex="4"></textarea>

    Replace with:

    <textarea id="comment" name="comment" cols="50" rows="7" tabindex="4"></textarea>

    I know this was an old post but it comes to the top when searching for this error so added the solution for anyone else who finds there way here.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error: please type a comment.’ is closed to new replies.