WordPress.org

Ready to get started?Download WordPress

Forums

Removing ALL reference to COMMENTS (6 posts)

  1. bitznbytes
    Member
    Posted 5 years ago #

    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

  2. Wendel Brume
    Member
    Posted 5 years ago #

    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.

  3. Roy
    Member
    Posted 5 years ago #

    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.

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    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.

  5. Wendel Brume
    Member
    Posted 5 years ago #

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

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic