• My page.php code has this line where it shows comments for pages. How can I make it conditional so it doesn’t show on my contact page (mydomain.com/contact) ? Thanks

    <?php comments_template(); ?>
    
    <?php endwhile; endif; ?>
    
    </div>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Copywrite

    (@copywrite2012)

    I think the solution is for me to create a template page for the contact form (formcontact.php or something similiar). I’ll copy my page.php but just get rid of the comments php. Good way to do it?!

    Hey copywrite2012,

    This one should work.

    <?php if (!is_page('contact')) { comments_template(); } ?>
    <?php endwhile; endif; ?>
    </div>

    But also you can turn off the comment on the admin page.
    When you create new post, there’s an option “Allow comments.” under the discussion section.

    Copy & geek
    I think the discussion pane is hidden by default in the more recent WP releases. That means you need to toggle the screen options tab at the top right, and select the discussion check-box, then you will have the option to allow/disallow comments on the page, and also block track-backs to that page (which for a contact page makes sense to help protect against track-back spam).
    C

    Thread Starter Copywrite

    (@copywrite2012)

    Comments is not selected in the screen options so it must be that the php is overriding it. Geekfolder your solution works perfectly. Thanks all

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Do not show comments when the page is mydomain.com/contact’ is closed to new replies.