WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] turn off comments on pages by default

[Resolved] turn off comments on pages by default

  • Don Spark
    Member

    @don-spark

    Hi,

    Simple question:

    How do I make comments “turned off” by default?

    I am shaping up a WP CMS for non-technical users. They shouldnt have to worry about erroneous check boxes.

    Thanks!

    Don Spark

Viewing 15 replies - 1 through 15 (of 24 total)
  • TransPersonal
    Member

    @transpersonal

    Settings >> Discussion >> uncheck “Allow people to post comments on new articles”

    This applies to new posts that you will publish from now on. To disallow comments from already publish posts:

    Posts >> select them all and “Edit” under bulk actions and hit apply >> choose “do not allow” next to comments and hit update posts.

    @mercime
    Participant

    @mercime

    What TransPersonal said. And, if you want to make it pseudo-permanent, you can delete the comments tag in single.php (and in page.php if you have one there)from your theme.

    S.K
    Member

    @kichu

    The topic title talks about “pages”. Assuming that you want to continue have discussion on your blog posts but turn it off only from “pages, you’ll have to remove the code snippet “<?php comments_template(); ?>” from the page.php of your theme, as mercime advised.

    If your theme uses some other template for pages, you find it out and snip out the line.

    S.K

    Don Spark
    Member

    @don-spark

    I just want to turn it off by default…on pages only. I want blog posts to have comments by default but not pages. The checkbox has a checked by default. I want it un-checked by default for pages.

    I am using the hybrid theme framework. That theme has a page.php which has this only this referring to comments
    <?php comments_template( '', true ); ?>

    Is something in there putting a check in the box or does that exist somewhere else in wordpress?

    We are going to be making lots of pages with nubies.

    Thanks!

    @mercime
    Participant

    @mercime

    If you want to have comments in your blog posts, then leave the comments on in Settings > Discussion. Then in order to disable comments in Pages, delete <?php comments_template( '', true ); ?> in page.php

    S.K
    Member

    @kichu

    You can remove that line of code if you want to disable comment on pages.

    Instead you can “comment out” the line of code thus:

    <?php// comments_template( '', true ); ?>

    You can remove the “//” part when you want to turn on comments on pages.

    HTH.

    S.K

    Don Spark
    Member

    @don-spark

    Thanks guys.

    Anyone know how to make this default?

    un-check

    the comments check box

    on pages only

    I need to be able to turn it on sometimes with the check box.

    dou9las
    Member

    @dou9las

    Well, I can’t speak for Don, but I for one was just looking for the answer to this, and this thread was perfect. Kichu, Transpersonal, Mercime, thanks, you hit the issue spot on for me.

    I wanted to simply take the comments off all pages (indefinitely) while keeping them available on blog posts.

    In particular, thinking I was all saavy and smart, before finding this, I went into page.php and used the <!– to comment out the entire php tag – but it broke the pages.

    I know that these different methods of commenting are used in slightly different ways, one for removing the instance of html (if I remember right) the other simply killing the php function. I don’t fully comprehend the differences in application of those, but anyway, I am a step closer to that, and my site is now working as intended.

    Thank You!

    Adding my word of thanks to kichu, et al as I was trying to do just that (disable the comments area on just pages) and had no clue as to how to do it. Cheers!

    grizzdesign
    Member

    @grizzdesign

    I want the same thing done… Comments off by default on new pages.

    Reason being the RSS-feed being putted into wp_head().

    Deleteing the comments_template() doesn’t uncheck the box in the page-editor and thus doesn’t get rid of the RSS feeds on page for “comments”.

    So, question remains:
    How can me make a setting that will automaticly disable comments for pages (and leave it on for comments) – OR – how can we get rid of the RSS-feeds for comments on PAGES.


    Thanks in advance,
    gd

    sounds like a lot of experts here on the topic of Comments on Pages.
    Can you offer assistance on a similar problem related to this topic?

    See http://wordpress.org/support/topic/338324

    Thanks!

    topic not found

    not sure what that “topic not found” problem is about.

    try this re-post:
    http://wordpress.org/support/topic/338366?replies=2#post-1303350

    Too late?

    Using Hybrid I would suggest to use a function within your functions.php.

    First add an empty file your template folder (sub theme), nothing in. No code, nothing. Just give it a name like “no-comments-please.php” and upload it to your server.

    After that you can add something like this to your functions.php in order to call the file when pages are called:


    add_filter( 'comments_template', 'remove_comments_template_on_pages', 11 );

    function remove_comments_template_on_pages( $file ) {
    if ( is_page() )
    $file = STYLESHEETPATH . '/no-comments-please.php';
    return $file;
    }

    After that comments will be removed from all pages. If you like you can enhance the function to do whatever you want.

    Best regards and happy christmas
    Oliver

    joefletcher
    Participant

    @joefletcher

    Hey Oliver, never too late. That’s exactly what I need to do.

    But, does anyone know how to either uncheck “allow comments” & “trackbacks” in the ADMIN on Pages only? So that by default, Posts have it checked; Pages have it unchecked.

    Or, if I remove Comments from the Page templates as described above, then any suggestions on removing that Meta box for Comments – again, in the Admin for Pages only?

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘[Resolved] turn off comments on pages by default’ is closed to new replies.