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.

Win the battle. Social Warfare Dynamik Website Builder Author Pro

Leave a Reply

46 Comments on "WordPress: How to Auto Expand Comments by Default"

Notify of
Sort by:   newest | oldest | most voted

Nice brief and this enter helped me alot in my college assignement. Gratefulness you for your information.

I’m looking for how to autoexpend my comments. Now, your blog really help what I want. Thanks. Great content.

Glad I helped :)

Thanks for posting

Should this work with wordpress 3.0?
Thank you

I haven’t tried it with WP 3. Let us know when you have, thanks :-)

It doesn’t work with 3.0. Do you have any suggestions?

I don’t at the moment. I’ll have a think and let you know if I come up with any.

Very nice post thanks for sharing, just what I was looking for. Made the changes and was up and running in minutes.

Thank you for visiting Matt. I’m happy it worked.

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.

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.

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.

Works. In my case the there is no “else” piece.
Instead of I got . I searched for “endwhile” and found it. Thanks a lot.

My PHP code disappeared so I’ll try to use the CODE tag. Instead of I got in my php script.

John, thank you for your response. the code tag has been stripped out also. Better to just quote it instead.

gtgretertrg

Nice one :) Seems silly for this not to be default. Now my hoards of non traffic will be able to see the comments box!

Lol, glad it worked for you :)

I looked all over for this, thank you so much for posting it, really appreciate it

You’re welcome Mike. Thanks for visiting. Remember to backlink to JournalXtra so others can find this information more easily :)

Thank you and Sheila!

KC de Cali

not working with cordobo green theame

Thanks for the advice.

Thanks for the update.

Thanks for the codes, it works to my site. Steps are easy to follow and understand. Well-done.

You’re welcome :)

Do it works to any version of wordpress?

It does. The only caveat is that some themes are badly coded and the modifications fail to work with such themes, otherwise it will work.

It regularly amazes me precisely how website owners for example your
self can find enough time and the commitment to carry on making terrific
blog posts.

I appreciate you taking the time to create this publish. It has been extremely helpful to me indeed. Appreciate it. http://www.mydietarystore.info

It’s challenging to find knowledgeable folks on this topic, but you sound like you know what you’re talking about! Thanks

Many thanks for sharing these instructions! <3

what if neither line of text from step 4 is present? this is with iribbon pro

what if neither line of text is present from step 4? im using i ribbon pro

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!

Thank you so much for this! It worked great! THANK YOU, THANK YOU for posting this!

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.

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

Please help! My dashboard doesn’t seem to have editor under appearance.

Never mind, it seems to have somehow sorted itself out.

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.

wpDiscuz

Free to your inbox

Join our mailing list to receive the latest news and updates from JournalXtra.

You have Successfully Subscribed!