#1492 closed defect (bug) (fixed)
comments_popup_link() doesn't work on pages
Reported by: | gregh | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 1.5.1.2 |
Component: | Administration | Keywords: | |
Focuses: | Cc: |
Description
The admin interface for writing pages (not posts) includes a check box for "Allow Comments" but if you try to use the "comments_popup_link()" template tag in your page template (page.php) you will find that it doesn't output anything at all.
This is because in the comments_popup_link() function in the file comments-functions.php at line 95 there is a test for "is_page()" and if it passes, the function does nothing and returns.
I don't know if this is the only place in the comments code where a check is done to see if it's being called from a page rather than a post, but it seems like a bug to me: if the intention is that WordPress disallow comments on pages then the "Allow Comments" checkbox shouldn't be in the admin interface; and if the intention is the opposite then the comments_popup_link() function (and any others like it which may be doing the same kind of test) should be changed to work on pages and not just posts.
This is my first bug report using trac, so I hope it's all right.
I have temporarily worked around this problem by using comments_number() instead of comments_popup_link() on the single.php and page.php templates. This isn't quite as nice because comments_number() doesn't automatically provide a link to the comments anchor, and also doesn't handle the case where comments are disallowed (ie. it displays "No Comments" rather than "Comments Off").
So I think the comments_popup_link function should drop the test for is_single() and is_page(). I don't think it would do any harm.