If you want to display comments and the comment form on posts but not on pages, you need to split up the logic in your template file to call comments_template() depending on the type of the item displayed (post or page). There are two ways to do this: either you keep one template file for both items, and use conditional tags:
if (!is_page()) {
comments_template();
}
The other option is to use both a single.php template file for your posts and a page.php for your pages (see the Template Hierarchy for more information). Just leave out the call to comments_template() in the page template. If there are no other differences between a post and a page layout, one combined template file with conditional tags is probably better for maintainability.
If you want to do this “from a distance”, so where the template file already includes a call to comments_template(), you can create a plugin that hooks into the comments_template filter and redirects it to an empty file in the directory (well, it could even be the plugin file itself – since it only contains PHP code, it won’t display anything – but this will be confusing to others).
If you want to display comments and the comment form on posts but not on pages, you need to split up the logic in your template file to call
comments_template()
depending on the type of the item displayed (post or page). There are two ways to do this: either you keep one template file for both items, and use conditional tags:The other option is to use both a
single.php
template file for your posts and apage.php
for your pages (see the Template Hierarchy for more information). Just leave out the call tocomments_template()
in the page template. If there are no other differences between a post and a page layout, one combined template file with conditional tags is probably better for maintainability.If you want to do this “from a distance”, so where the template file already includes a call to
comments_template()
, you can create a plugin that hooks into thecomments_template
filter and redirects it to an empty file in the directory (well, it could even be the plugin file itself – since it only contains PHP code, it won’t display anything – but this will be confusing to others).I like a lot this snippet from Hybrid theme at start of
comments.php
template that will flexibly disable comments if they are not supported or disabled on per-post/per-page basis:depending on the theme.
check pages.php code and remove stuff related to comments
be careful not to break the design.
If you can post the code of pages.php here, hope we can help tell u modifications that need to be done