Support » Fixing WordPress » View only comments per post.

  • Resolved ssdesign


    I am developing a custom theme and heavily customising the feel of the blog.

    I am stuck at one place, when a user clicks the comments link, I want to display only comments (without the actual post content).

    If I am not wrong, the comments page uses the POST template file to render itself by adding:
    to the link URL.

    Is it possible to create a custom template for comments page using this code?

    <?php comments_template(); ?>

    I am confused…..

    Any help?

Viewing 10 replies - 1 through 10 (of 10 total)
  • you can find that included file called “comments.php” … in your theme folder

    the default CSS is also loaded with custom classes for displaying comments.

    bon chance!

    Yes that was the first thing i thought of.
    When I look at the URL of comments on the index page, it says something like this:

    Which means that by default, the comments link calls the INDEX.PHP file and adds:
    ?p=82#comments to it.

    If I were to call a custom comments page, what should the comment URL look like?

    If exists WP uses the single.php template file to display a single post (aka “comment page”) + the comments.php template is called in.
    If there is no single.php file ==> the index.php will be used.
    see Template_Hierarchy
    Based on this you can create a “single” template that won’t show the content, just calls the comments.
    Warning: this is just an “educated guess” 🙂 – but I’d give it a try.

    I solved it.

    Now my single.php looks like this:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php comments_template(); ?>
    <?php endwhile; else: ?>
    <?php endif; ?>

    Thats it.

    Glad it worked. Can you, please, mark this topic as “solved”?

    oops… not solved yet 🙂

    I do get a comments page with just the comments

    Now the post content is removed from the Archive pages as well… because it looks like comments and archive both use single.php

    Any idea how to tackle this one??

    Sorry I mean POST PERMALINK and not ARCHIVE

    ssdesign… hmmm… i think there’s a conceptual block here.

    i see now that you thought the #comments was part of a URL query string telling the script to render comments. and that is why you were asking “what should the URL look like”

    in fact, a # indicates an “anchor”. it’s just a basic HTML tag to move ‘within’ a page, like halfway down, where the comments are. so in that sense it is not processed by PHP. see for example, how this page ‘loads’ to the middle:

    i hope that is clear…

    so now i am confused. i re-read all of your questions here. i guess i don’t understand what you want in the end… you want a page of just all comments? there’s a plugin for comments:

    have a look at some of these here:

    Is using the built in comments popup script and comments popup link tags an option for you? It would then keep the comments separate from your posts – once you change your single.php (permalink page which is usually used for showing comments) appropriately.

    ok guys, sorry if I confused you all.

    I have recently shifted to WP and liked it so much that I went ahead and started developing a complete FLASH version of it.

    Now about this question, I tried what Valerie has already suggested, I modified the core include files and this is what I did:

    echo $home . ‘/’ . $wpcommentspopupfile.’?p=’.$id.’#comments’;

    echo $home . ‘/’ . $wpcommentspopupfile.’?comments_popup=’.$id;

    Then I modified the comments-popup.php in my theme folder to output a custom XML and there you go….

    Thanks again to everyone for flushing this out 🙂

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘View only comments per post.’ is closed to new replies.