Post

Twenty Ten Child Theme Remove Comments from Pages

In Twenty Ten Child Theme on January 7, 2012 by Your Friend Tagged: , , ,

You may remove comments from any of your pages in your Wordpres Twenty-Ten child theme. Whether you are looking to remove comments from a static page, a particular page or all pages, see the instructions below.

  1. Using a program such as Note Pad, create a blank page and save it as something like “no-comments-pages.php”. To save a file other than as a .txt file, you must change the” file type” in Note Pad to “All Files”. I saved my to my desktop.
  2. Then in your child theme, add the following code to the Function.php file. I was able to add it near the bottom, right above “require_once……text-wrangler”. Make sure you replace “11″ with the proper page number from which you wish to remove the comments. To find the page number of a particular page, open the page in the edit mode. See the link above and notice towards the end there will be a number. That it is your page number. It may be one digit of 5 digits, etc. It all depends upon how many posts and pages you have on your blog.

CODE TO ADD TO YOUR CHILD THEME’S FUNCTION.PHP FILE:

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;
}

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.