[wp-hackers] Disable feedback for pages option

Stephen Rider wp-hackers at striderweb.com
Tue Jun 26 15:10:14 GMT 2007


The custom field allows you to turn comments ON for a particular  
page.  Basically the page.php code has a bit in there that says, if  
CustomFieldX is present, show the comments form.

So... by default, no comments on pages.  If you want comments on a  
particular page, add the custom field to that page.

I use it -- my WordPress plugin is on a page (less transient than a  
blog post), and gets comments.  Other pages don't need comments, and  
don't have them.

Here's the code:

<?php if ( get_post_custom_values('comments') ) comments_template 
() // Add a key+value of "comments" to enable comments on this page ?>

-- 
Stephen Rider
<http://striderweb.com/>


On Jun 26, 2007, at 9:58 AM, Michael B wrote:

> Without looking at that theme, what's the purpose of the custom  
> field?  Why
> not just remove the call to the comment form in the default page  
> template
> and be done with it?  You could always create a Page template that  
> has the
> comment form if you knew there'd be Pages that need comments enabled.
>
> On 6/26/07, Stephen Rider <wp-hackers at striderweb.com> wrote:
>>
>> This can be done in a Theme and a custom field.  Check out the
>> Sandbox Theme with the "Spartan" setting.  I found this out by
>> surprise when I stopped getting comments on a popular page!
>>
>> On Jun 26, 2007, at 6:28 AM, Leonid Mamchenkov wrote:
>>
>> > it would be nice to have a global option to disable comments and
>> > pingbacks for pages.  Currently it's either pages AND posts, or  
>> on an
>> > individual level.


More information about the wp-hackers mailing list