WordPress: How to Auto Expand Comments by Default

Just a little gripe I have with some of the WordPress themes created by some of those amazing designers out there. Some theme designers forget to provide the option to have the comment dialogue box auto expand at the end of articles. Not a problem when there’s a button stating “add comment here” but it is a problem when there isn’t such a button or when busy visitors are too much in a rush to look for such a button. Think about it, do you look for a comment box or do you look for a “add comment” button?

After a little bit of searching I found the code edits needed to make the comment box always visible for WordPress articles; and I must say thank you to Sheila Hoff for posting the solution in the WordPress support forum (I’ve linked to your homepage in gratitude).

Here’s what you need to do to automatically expand WordPress comments:

  1. Go to your Dashboard, find where it says “Appearance” in the sidebar on the left-hand-side then select “Editor”
  2. On the right-hand-side of the newly opened page, you will see a list of files; select the one that says “Main Index Template” or “index.php”
  3. Look for a line of text that reads

    and add

    onto a new line below it
  4. Now check through the page for any line of text that might say

    If it isn’t present then find

    and above it, on a line of its own, add

The top of the edited code should now look similar to:

And somewhere toward the bottom it will then look like

You will find it easier to search “index.php” if you copy it into a text editor, press ctrl+f then type your search terms.

Comments

  1. says

    Hi,
    I’ve applied your tip to WP 3.0.1 with the default twentyten theme.
    It’s index.php has no at the bottom anymore, but it ‘kind of works’ when you add the below get_header and put between the get_sidebar and get_footer.

    The only ting is that now it seems to randomly (I just don’t see the pattern yet), show a “Leave A Reply” field under some posts and not others. All posts with comments get the reply field, but also some others without comments.

    It takes too much space on the page, so it ‘kind of works’.

    Thanks for your tip! I’m glad I’ll be able to shape it without another plugin.

    • says

      some code got filtered out of my post:
      no php endwhile at the bottom.
      when you add the withcomments=1 below get_header and leave away the comments_template part near the bottom, I get the best results.

      It’s still not an ideal solution:
      -The comments indent not enough, which makes them look too much like a post, instead of comment.
      -Huge empty “Leave a Reply” fields. While some is desired to encourage discussion, this is ott.

      If you have any ideas, please let us know.

    • says

      Hi Martinex. I’m actually looking at your site right now. I like it. Thank you for introducing me to it.

      Re the comments box: does the same happen when you use a different theme? I’m not sure why the the “Leave a Reply” shows under some posts and not others. I would need to test the tip on one of my test sites to work it out. For the comment box’s size and position, I would edit the theme’s CSS and HTML/PHP to move and resize the comment box to your desired place.

      Thank you for your feedback Martinex.

  2. Richard says

    Great! very good explaination. I searched for this in all forums about wordpress, but all commend pointed to an other comment, which pointed to a other forum etc.

    After an half hour google-ing I’ve found this and it’s exactly what i needed.

    Thank you!

  3. says

    Could you please repost what the code should now look like? I tried your solution and it “broke” my blog. Fortunately, I remembered what the code said before I edited it, and got it back. Thanks.

    • says

      It shouldn’t have broken the blog unless the code already exists within your theme. Double-check your theme’s settings; you might not need additional code :)

  4. says

    Fantastic !! thanks a lot! people were commenting in incorrect posts in my website because they didnt see the ´leave a reply´ for the post they wanted and were leaving the comment always in another posts

  5. says

    Ok, the comments box appears and disappears. If you’re on my homepage, the the comments and the box are hidden. If you’re on a particular post’s page then they reappear. Is there a way I can keep the comments and the reply box permanently visible? Sorry for the multiple comments.

Leave a Reply