• Resolved robpannell

    (@robpannell)


    I have little idea what I’m doing with php & css etc, but I’ve found this line of code in the index.php that adds the Comments link to each page and post.

    <div class=”feedback”>
    <?php if (is_single()) wp_link_pages(); ?>
    <?php comments_popup_link(__(‘Comments (0)’), __(‘Comments (1)’)); ?>
    </div>

    Can anyone please tell me how to change it (add in an ‘if’ or something) so that it only displays on posts and not on pages? Even if I set each page as no comments allowed it still prints ‘Comments Off’ on the page. I want to remove this text too.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try replacing it with this:

    <?php if(is_page() ) { ?>
    <!-- do nothing -->
    <?php } else { ?>
    
    <div class="feedback">
    <?php if (is_single()) wp_link_pages(); ?>
    <?php comments_popup_link(__('Comments (0)'), __('Comments (1)')); ?>
    </div>
    
    <?php } ?>
    Thread Starter robpannell

    (@robpannell)

    That did the trick.

    Thank you so much for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Comments link > only on posts not pages please’ is closed to new replies.