New position for comment box?
-
I would like to have the comment box above the comments. Is it possible?
-
Yes. See the comments.php file in your theme.
This is it… I don’t know what to change
Please don’t post huge chunks of code here. For larger blocks of code, use the WordPress pastebin and post the pastebin url here. It makes life easier for everyone.
Does this work: (Backup comments.php first)
<?php // Do not delete these lines if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) die ('Please do not load this page directly. Thanks!'); if (!empty($post->post_password)) { // if there's a password if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie ?> <p class="nocomments">This post is password protected. Enter the password to view comments.<p> <?php return; } } /* This variable is for alternating comment background */ $oddcomment = 'alt'; ?> <!-- You can start editing here. --> <?php if ('open' == $post->comment_status) : ?> <h3 id="respond">Have your say</h3> <?php if ( get_option('comment_registration') && !$user_ID ) : ?> <p>You must be /wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in to post a comment.</p> <?php else : ?> <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> <?php if ( $user_ID ) : ?> <p>Logged in as /wp-admin/profile.php"><?php echo $user_identity; ?>. /wp-login.php?action=logout" title="Log out of this account">Logout ?</p> <?php else : ?> <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" /> <label for="author">Name (required) <?php if ($req) echo "(required)"; ?></label></p> <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" /> <label for="email">Mail <?php if ($req) echo "(required)"; ?></label></p> <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /> <label for="url">Website</label></p> <?php endif; ?> <p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p> <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" /> <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /> </p> <?php do_action('comment_form', $post->ID); ?> </form> <?php endif; // If registration required and not logged in ?> <?php if ($comments) : ?> <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3> <ol class="commentlist"> <?php foreach ($comments as $comment) : ?> <li class="comment_back <?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>"> <cite><?php comment_author_link() ?></cite> Says: <?php if ($comment->comment_approved == '0') : ?> Your comment will be read by the moderators before it is published. Thank you very much for your participation! <?php endif; ?> <small class="commentmetadata">" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?> <?php edit_comment_link('e','',''); ?></small> <?php comment_text() ?> <?php /* Changes every other comment to a different class */ if ('alt' == $oddcomment) $oddcomment = ''; else $oddcomment = 'alt'; ?> <?php endforeach; /* end for each comment */ ?> <?php else : // this is displayed if there are no comments so far ?> <?php if ('open' == $post->comment_status) : ?> <!-- If comments are open, but there are no comments. --> <?php else : // comments are closed ?> <!-- If comments are closed. --> <p class="nocomments"></p> <?php endif; ?> <?php endif; ?> <?php endif; // if you delete this the sky will fall on your head ?>
Also don’t forget when posting code: Put code in between
backticks
. Makes it easier to read!Done… thanks very much
I also get this message below the “leave a reply”
Logged in as /wp-admin/profile.php”>bsm. /wp-login.php?action=logout” title=”Log out of this account”>Logout ?
Can I get rid of this?
I fixed it anyway never mind
Thanks everyone
xdesi has moved the form for you in the code above. Try deleting:
<p>Logged in as /wp-admin/profile.php"><?php echo $user_identity; ?>. /wp-login.php?action=logout" title="Log out of this account">Logout ?</p>
to get rid of the “Logged in as…” line.
Yeah sorry it’s because when you pasted the code it formatted some of it e.g the anchor tags, so it messed it up a bit.
And if I now view it on the pastebin it’s changed all the characters so I can’t get it properly..so you just make the following changes.Basically go to your original comments.php (before you made the changes)
1. and cut/copy everything from the line:
<?php if ('open' == $post->comment_status) : ?>
(About line 79)to and including this:
<?php endif; // If registration required and not logged in ?>
(The line before the very last one)2. Then paste this chunk right after the line:
<!-- You can start editing here. -->
(About line 29)That’s all!
What about threading these?
- The topic ‘New position for comment box?’ is closed to new replies.