Support » Plugins » Removing ALL reference to COMMENTS

  • Hi, I know….seach wordpress for the answer…I have and still did not get a definitive one. Also searched Google….so here it is again….

    How can I ‘Removing ALL reference to COMMENTS’ on my wordpress blog by just editing my WordPress THEME?

    Thanks,
    B

Viewing 5 replies - 1 through 5 (of 5 total)
  • I’m not sure if this is the correct way to do it, but it works. In the Dashboard>Design>Theme Editor files, I commented out all the references that were calling comments, like this:

    <!-- <a href="<?php comments_link(); ?>" class="commentsLink"><?php comments_number('No comments','1 comment','% comments'); ?></a> -->

    Everything between <!– and –> is what was there originally. I could have just erased it all, but this way I can add comments back later if I want. Go through each of the files (single.php, posts.php, etc) and do this for each one.

    You have to clear the index.php, archive.php, perhaps the search.php and especially the single.php. Leave the comments.php like it is, it won’t be used when it is not called for anymore anyway.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Instead of commenting it out with <!– and –> tags, use these instead:

    <?php /* ?>
    commented stuff here
    <?php */ ?>

    This is better for two reasons. First, the stuff won’t show up in the page at all this way, even if you view source. Second, the commented code won’t even run (which it will the other way), meaning less load on your site.

    Hmmm, but in that code snippet above, that would leave some of the code outside the /* and */. Is that correct?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Errr.. what? No, that would work fine.

    <?php /* ?>
    <a href="<?php comments_link(); ?>" class="commentsLink"><?php comments_number('No comments','1 comment','% comments'); ?></a>
    <?php */ ?>

    See? You can put the whole thing into there. PHP comments even comment out stuff not in the PHP tags, as long as they surround them.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Removing ALL reference to COMMENTS’ is closed to new replies.