Excluding article body when navigating comment pages

In response to Massimo’s question:

…would it be possible to have comments only in the first paged one, the one with the article body and NO article body text in the following pages?

example:
http://www.example.org/2005/08/12/my-article/
includes the article plus the first 10 comments
while
http://www.example.org/2005/08/12/my-article/comments/2
includes ONLY the following 10 comments with NO article and possible a link the the former page.

Many thanks.
Massimo.

A very simple solution would be to edit single.php (if you’re using the default theme), qualifying the call to the_content() with an if statement. For example:

<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>

would become

<?php if (!isset($_GET[’cp’])) the_content(’<p class=”serif”>Read the rest of this entry &raquo;</p>’); ?>

If you’d like to guide visitors to the full content, you can include an else statement with a link to the main article:

<?php if (!isset($_GET['cp'])) {
the_content('<p class="serif">Read the rest of this entry &raquo;</p>');
} else {
echo '<p>You are browsing comments, <a href="', get_permalink(), '">read full entry here</a>.</p>';
} ?>

One Response to “Excluding article body when navigating comment pages”

  1. 1
    WordPress Comment Pages - Continued… - exoskeleton Says:

    […] Very much appreciate the help, Keyvan! That does give me some clues on how to proceed. I also spotted another item on Keyvan’s site which may answer a different part of my request: Excluding article body when navigating comment pages. That shows how to remove the text of the article from a page with comments on it. I will sometime soon have to sit down and try to make all this work for me. Wonder if I should upgrade to WordPress 2.0.1 first or what? Tags: comments, WordPress Comments: […]