WordPress.org

Ready to get started?Download WordPress

Forums

Comments on a seperate page (2 posts)

  1. neveremail
    Member
    Posted 7 years ago #

    I'm looking for a way to get comments to appear on a seperate page that the individual posts page.

    In other words you have the post page then at the bottom a link to comments on that post.

    If anyone has an answer I'd greatly appreciate it.

  2. Kafkaesqui

    Posted 7 years ago #

    Here's a quick 4-step hack for one way to implement this:

    1. The link:

    <a href="<?php the_permalink(); ?>?comments=1">View Comments</a>

    (Note: Change the last part of the url to &comments=1 if you do *not* use custom permalinks.)

    2. Surround The Loop in your single post template (typically single.php) with the following if statement:

    <?php if( !(isset($_GET['comments']) && $_GET['comments'] == 1) ) : ?>

    ~ The Loop goes here ~

    <?php endif; ?>

    (Note: You may want to modify this somewhat so part of The Loop, say the post title, still displays when viewing comments.)

    3. Change the comments_template() template tag in your single post template to:

    <?php if($_GET['comments'] == 1) comments_template(); ?>

    4. There is no step 4.

    Lots of ways this could be played with... A warning though: internally WordPress knows nothing about what we're doing here, so redirects on comment submissions will still end up on the main permalink (sans our comments append). This would have to be dealt with, somehow (I guess you might consider this step 4).

Topic Closed

This topic has been closed to new replies.

About this Topic