• Amnesia180

    (@amnesia180)


    Hi All,

    If you visit https://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

Viewing 8 replies - 1 through 8 (of 8 total)
  • kkarpieszuk

    (@kkarpieszuk)

    in template, before code responsible for showing comments put:

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

    and after code of comments:

    <?php endif; ?>

    aaanorton

    (@aaanorton)

    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.

    Thread Starter Amnesia180

    (@amnesia180)

    Doesn’t seem to work.

    Thread Starter Amnesia180

    (@amnesia180)

    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; ?>

    aaanorton

    (@aaanorton)

    One more quick question… How do I find a page’s ID?

    Thanks again.

    kkarpieszuk

    (@kkarpieszuk)

    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 https://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

    aaanorton

    (@aaanorton)

    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

    Thread Starter Amnesia180

    (@amnesia180)

    Thanks for your help.

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Removing comments from certain pages’ is closed to new replies.