Written by Pavan Kumar on December 17, 2008
This was the problem I got after my theme design. Though I googled all my way, it was hard to find the solution. Finally I figured out the problem with my theme and fixed the bug. In the mean time, I got to know different ways to sort out the problem. Pages used to disappear after comment posting during different cases and here is the list of all cases and solutions for the same.
Case 1: WordPress Solution – Problem with theme coding:
This solution has been listed in the wordpress codex troubleshooting faq. The problem is with comments.php file in your wordpress theme. You might have missed one critical code in your comment form by which wordpress does not understand to which post the comments belong to. Add the following code in your comment form. Somewhere after "submit" button and before </form>.
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
Case 2: Problem with wordpress core:
I read this solution in some blog and wonder why this problem does not arise to all though everyone is using the same wordpress installation. Anyway, the solution is important for us.
Open the wp-comments-post.php file in your wordpress installation [not theme] and you will find a white space after the last line – a blank line at line number 90, remove the blank line. Few people have got this solution working, hope this helps you in crisis.
Case 3: Domtab issue:
As you can see, my theme uses a domtab to display related, popular and featured posts. That created problem for me in displaying the comment section. The same problem appeared even when I clicked any comment link from recent comments list.
The domtab simply added this code before my content section:
The code made my whole post and comment section including the domtab to stay hidden though the entire page is loaded. Here is what that solved my problem.
Open domtab.js – in the "js" folder of your theme.
Scroll to line 55. Use EditPlus or any editor softwares rather than notepad. On line 55, you will find:
change that ‘none‘ to ‘block‘.
The final code will look like:
Hope this will solve your problem. Here is the screenshot of the edited domtab.js for reference.
People who liked this also read: