Forums

Removing comments from certain pages (9 posts)

  1. Amnesia180
    Member
    Posted 3 years ago #

    Hi All,

    If you visit http://www.thewebevolved.com/enter you will see that on the "about" page and "contact page" it has comments.. I want to totally remove these (and not just disable them) for those particular pages.

    How can I do this?

    Thanks

  2. kkarpieszuk
    Member
    Posted 3 years ago #

    in template, before code responsible for showing comments put:

    <?php if (!is_page('about', 'contact-me')) : ?>

    and after code of comments:

    <?php endif; ?>

  3. aaanorton
    Member
    Posted 3 years ago #

    Thank You!

    I've been working on this for days without success... I'm no coder whatsoever and have been doing trial/error.

    Much appreciated.

  4. Amnesia180
    Member
    Posted 3 years ago #

    Doesn't seem to work.

  5. Amnesia180
    Member
    Posted 3 years ago #

    This is what the code looks like ;

    <?php if (!is_page('about', 'contact-me')) : ?>
    	<span class="date"><?php the_time('F jS, Y') ?></span> | <span class="comments"><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> </span> | <span class="category">Posted in <?php the_category(', ') ?></span> | <?php edit_post_link('edit', '', ''); ?>
    
    	<?php endif; ?>
  6. aaanorton
    Member
    Posted 3 years ago #

    One more quick question... How do I find a page's ID?

    Thanks again.

  7. kkarpieszuk
    Member
    Posted 3 years ago #

    this is not correct place to put my code. you tried to hide something what is hidden in fact. could you show all code of index.php of template? use http://rafb.net/paste/ if it is long

    ID you can see when you are in Admin > Manage > Page. place mouse pointer over link to page which ID you search and look at status bar of browser. i think you will find it easy, it is part of url

  8. aaanorton
    Member
    Posted 3 years ago #

    I've been playing with this some more and found that if you want more than one page to be affected, you must use array.
    So <?php if (!is_page('about', 'contact-me')) : ?>
    sould read <?php if (!is_page(array('about', 'contact-me'))) : ?>

    At least that's how I got mine working with multiple pages. I'm on WP 2.7.1

  9. Amnesia180
    Member
    Posted 3 years ago #

    Thanks for your help.

    The index.php on my template file can be found here - http://rafb.net/p/rd2LeU54.html

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.