• Hey Guys,
    I am trying to separate the comments form from the page, similarly you can see an example of what I am talking about here:
    https://www.mezzoblue.com/archives/2004/07/22/veer_marketi/
    if you look at the bottom of the post, you will notice there is no comments form, rather a link to the comments page, when you click on it, you are presented with a new page that are the comments for that post.
    I am wondering if this can be done with WordPress, if anyone can do this let me know, I am very, VERY interested in getting this done.

Viewing 11 replies - 1 through 11 (of 11 total)
  • u can try the popup way for the banners ??

    Thread Starter guruxl

    (@guruxl)

    I want a separate page, popups are annoying and in opinion not useful in this situation.

    I noticed this post and I found a solution, not sure if you have though so contact me or leave a reply to this post if you want the solution.

    would like to know the solution…thanks.

    I like the idea of this mod. One way of accomplishing it (lots of info follows):

    First, set up an if/else statement in your theme’s single.php (if one doesn’t exist, copy index.php and name that single.php) which displays either the post’s contents (i.e. The Loop) or the template tag for comments (comments_template()). The if statement tests on a specific GET query; for the example we’ll use ‘comments’:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <?php
    // comments mod
    if( isset($_GET['comments']) && ($_GET['comments'] == 1) ) : ?>
    <?php comments_template(); ?>
    <?php else : // display post, not comments ?>

    ~YOUR REGULAR LOOP CONTENT GOES HERE~

    <?php endif; // end of commments mod ?>

    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    Now for the GET stuff: add something like the following to your single.php template (where you want the comment link to appear), in The Loop:

    <a href="<?php the_permalink(); ?>&comments=1">Comment on this post</a> (<?php comments_number(); ?>)

    You may also want to add a link back to your post in the comments.php template (of your active theme, or if none exists the default theme):

    <a href="<?php the_permalink(); ?>" rel="bookmark">Return to the post</a>

    CUSTOM PERMALINK OPTION:

    If you want a prettified permalink to your comments, first you want to write the comment link above as:

    <a href="<?php the_permalink(); ?>comments/">Comment on this post</a> (<?php comments_number(); ?>)

    This next part is a bit advanced, as you need to manually add a line to your .htaccess file. As an example, I’ll use the common permalink structure of:

    /archives/%year%/%monthnum%/%day%/%postname%/

    For that, the rewrite rule for your comments will be:

    RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/comments/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&comments=1 [QSA,L]

    Insert this towards the end of .htaccess, just after:

    # END WordPress

    Again this can vary, so what you can do to match it up with your rewrite rules is to copy the line for trackbacks, and modify this. Just change:

    /trackback/?$ to /comments/?$

    and

    &tb=1 to &comments=1

    tsguitar

    (@tsguitar)

    This actually works quite well in 2.0.1. Very clear directions, Kafkaesqui. I haven’t tried the custom permalink option, yet. That’ll be next weekend.

    I’d like the comments to be their own page (lowercase “p”), though, so I can list different sidebar content on the comment pages. As it stands now, those comments, though seemingly on their own pages, fall under the is_single template. Does anyone see a way of giving those comments a different template?
    —–

    While typing this reply and getting sidetracked trying to fix this issue, I solved it.

    I created another file called “commentsidebar.php” and just included that page in “comments.php.” I moved the get_sidebar call to after the <?php else : // display post, not comments ?> listed in Kafkaesqui’s solution (I moved it to inside The Loop). So, when it runs through and displays the post content, it goes to get_sidebar, but when it runs through and displays the comments, the “comments_template” tells it to <?php include (TEMPLATEPATH . '/commentsidebar.php'); ?>. Now my comments have different sidebar content than any other page.

    tsguitar

    (@tsguitar)

    So, this solution works well, except for the permalink instructions. I’ve tried several variations of that permalink structure and nothing is working; I’m getting a 404 when visiting a comment page. Here’s my .htaccess:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /teaching/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /teaching/index.php [L]
    RewriteRule ^/([0-9]{4})/([0-9]{1,2})/([^/]+)/comments$ /index.php?year=$1&monthnum=$2&name=$3&comments=1 [QSA]

    </IfModule>

    # END WordPress

    I know Kafkaesqui’s instructions said to put the new RewriteRule line after #END WordPress, but I tried that and it didn’t make a difference. And it didn’t make sense to me, either, so I just put it inside the IfModule tag. Does anyone see how I can get this working? Thank you.

    Thread Starter guruxl

    (@guruxl)

    i’m a bit confused as to how I am supposed to edit the single.php file, could you just copy and paste the single.php file, for say the default Kubrick theme, here is the file in it’s entirety, edit it and please re-post it with the comments on a separate page modification.

    The permalink edit seems pretty straightforward.


    <?php get_header(); ?>

    <div id="content" class="widecolumn">

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div class="navigation">
    <div class="alignleft"><?php previous_post_link('« %link') ?></div>
    <div class="alignright"><?php next_post_link('%link »') ?></div>
    </div>

    <div class="post" id="post-<?php the_ID(); ?>">
    <h2>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></h2>

    <div class="entrytext">
    <?php the_content('<p class="serif">Read the rest of this entry »'); ?>

    <?php link_pages('Pages: ', '', 'number'); ?>

    <p class="postmetadata alt">
    <small>
    This entry was posted
    <?php /* This is commented, because it requires a little adjusting sometimes.
    You'll need to download this plugin, and follow the instructions:
    https://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */
    /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
    on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
    and is filed under <?php the_category(', ') ?>.
    You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.

    <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    // Both Comments and Pings are open ?>
    You can leave a response, or " rel="trackback">trackback from your own site.

    <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    // Only Pings are Open ?>
    Responses are currently closed, but you can " rel="trackback">trackback from your own site.

    <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    // Comments are open, Pings are not ?>
    You can skip to the end and leave a response. Pinging is currently not allowed.

    <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    // Neither Comments, nor Pings are open ?>
    Both comments and pings are currently closed.

    <?php } edit_post_link('Edit this entry.','',''); ?>

    </small>

    </div>
    </div>

    <?php comments_template(); ?>

    <?php endwhile; else: ?>

    Sorry, no posts matched your criteria.

    <?php endif; ?>

    </div>

    <?php get_footer(); ?>

    Thread Starter guruxl

    (@guruxl)

    I was fooling around and was able to take the comments off the single post page, that code is:

    <?php if ((‘open’ == $post-> comment_status) && (‘open’ == $post->ping_status)) {
    // Both Comments and Pings are open ?>
    You can leave a response, or ” rel=”trackback”>trackback from your own site.

    <?php } elseif (!(‘open’ == $post-> comment_status) && (‘open’ == $post->ping_status)) {
    // Only Pings are Open ?>
    Responses are currently closed, but you can ” rel=”trackback”>trackback from your own site.

    <?php } elseif ((‘open’ == $post-> comment_status) && !(‘open’ == $post->ping_status)) {
    // Comments are open, Pings are not ?>
    You can skip to the end and leave a response. Pinging is currently not allowed.

    <?php } elseif (!(‘open’ == $post-> comment_status) && !(‘open’ == $post->ping_status)) {
    // Neither Comments, nor Pings are open ?>
    Both comments and pings are currently closed.

    <?php } edit_post_link(‘Edit this entry.’,”,”); ?>

    and

    <?php comments_template(); ?>

    But, now how do I add the comments to a new separate page, like:

    domain.com/category/post-title/comments/ ???

    This way the comments and comment form only show up on this page, how can I make this work? I was fooling around with the Loop and code but, it doesn’t seem to be working, can someone please help me?!

    Thread Starter guruxl

    (@guruxl)

    Anybody? Anybody know how to mess with the code to get comments to appear on their own page?

    I tried to do the above but when clicking the link to the comments page it 404s. I did not try to do the permalink structure, although I normally do have a permalink structure on my site.

    Can anyone help?


    <?php include(‘header.php’); ?>

    <?php include(‘sidebar.php’); ?>
    <div id=”container”></div>

    <div id=”content”>

    <div class=”contentright”>

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php
    // comments mod
    if( isset($_GET[‘comments’]) && ($_GET[‘comments’] == 1) ) : ?>
    <?php comments_template(); ?>
    <?php else : // display post, not comments ?>

    <div class=”post”>

    <h3>

    <?php the_time(‘l, j M Y’,display); ?>

    </h3>

    <div class=”title” id=”post-<?php the_ID(); ?>”>

    ” rel=”bookmark”>

    <?php the_title(); ?>

    </div>

    <div class=”storycontent”>

    <?php the_content(__(‘(more…)’)); ?>

    </div>
    <?php wp_link_pages(); ?>
    &comments=1″>Comment on this post (<?php comments_number(); ?>)
    </div>

    <?php comments_template(); ?>

    <?php endif; // end of commments mod ?>
    <?php endwhile; else: ?>
    <?php _e(‘Sorry, no posts matched your criteria.’); ?>
    <?php endif; ?>

    <div class=”postnavigation”>

    <div class=”right”>

    <?php next_post(‘ % ?’,”,’yes’) ?>

    </div>

    <div class=”left”>

    <?php previous_post(‘? %’,”,’yes’) ?>

    </div>

    </div>

    </div> <!–Closes the contentright div–>

    </div> <!– Closes the content div–>

    <div id=”bottomcontentdouble”>

    </div>

    </div> <!– Closes the container div–>

    <?php include(‘footer.php’); ?>

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Separate Comments from Specified Posts’ is closed to new replies.