How I create my own comments.php in WordPress? Any startingpoint / template to begin?

I have been trying to invert how the wordpress theme I’m using displays comments…without success…

The main thing I need to do is to invert how the comments are rendered:

Read More

The name of the person should be AFTER the comment message. I can’t get that work. I found this code worked very well, but the problem is that when I implement it, comments show in all the pages while I only want them to be displayed in one of the pages, for this purporse I used Comments Disable Master plugin for wordpess, that works OK. when I use this code, seems that comment disable master is not working anymore and comments display in all the pages…

<div class="clear"></div>

<?php

// Do not delete these lines
  if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    die ('Please do not load this page directly. Thanks!');

  if ( post_password_required() ) { ?>
    <div class="help">
        <p class="nocomments">This post is password protected. Enter the password to view comments.</p>
    </div>
  <?php
    return;
  }
?>

<!-- You can start editing here. -->

<?php if ( have_comments() ) : ?>

    <h5 id="comments" class="h5"><?php comments_number('<span>No</span> Responses', '<span>One</span> Response', '<span>%</span> Responses' );?> to “<?php the_title(); ?>”</h5>

    <nav id="comment-nav">
        <ul class="clearfix">
            <li><?php previous_comments_link() ?></li>
            <li><?php next_comments_link() ?></li>
        </ul>
    </nav>

    <ol class="commentlist">
        <?php wp_list_comments('callback=qs_comments'); ?>
    </ol>

    <nav id="comment-nav">
        <ul class="clearfix">
            <li><?php previous_comments_link() ?></li>
            <li><?php next_comments_link() ?></li>
        </ul>
    </nav>

    <?php else : // this is displayed if there are no comments so far ?>

    <?php if ( comments_open() ) : ?>
        <!-- If comments are open, but there are no comments. -->

    <?php else : // comments are closed ?>
    <!-- If comments are closed. -->
    <!--<p class="nocomments">Comments are closed.</p>-->

    <?php endif; ?>

<?php endif; ?>


<?php if ( comments_open() ) : ?>

<?php comment_form(); ?>

<?php endif; // if you delete this the sky will fall on your head ?>

I need to invert the output and I don’t know how to begin with this. The previous code has a problem because seems to lack of something that makes it work with the disable comment master plugin… Any hint??? Maybe I’m missing a line of code that makes it work…

Where can I found a template to build my comment.php ? Thanks for the help.

Related posts

Leave a Reply

2 comments

  1. Just check the post id on which you want to display the comments.

    if ( is_single('your-post-id') ) {
    
        // Your comment code here
    
    }
    

    Doing this will display comments only on the page that you have mentioned in ‘your-post-id’