• Resolved phishie

    (@phishie)


    Hello,
    I would like to keep adsense robots from crawling post comments. I know I would use the following code:

    <!-- google_ad_section_start(weight=ignore) -->
    Comments section here
    <!-- google_ad_section_end -->

    but I do not know where to place the code.

    Any help is appreciated.

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Place it in your template, around the comments section. I can’t be more specific, you have to look at your template and figure it out. It’s not hard.

    Thread Starter phishie

    (@phishie)

    domain.com/wp-content/themes/vistered-little-1.6a/comments.php

    One of the divs in the file is:

    <div class="blog">
    <h3><?php comment_author_link(); ?></h3>
    <p class="headertext"><?php comment_type(); ?> on <?php comment_time('F jS, Y'); ?>. <?php edit_comment_link('e', '', ''); ?></p>
    <?php comment_text(); ?>
    </div>

    so I believe I have the right file. Please correct me if I am wrong or let me know if I am right.

    I added <!– google_ad_section_start(weight=ignore) –> on the first line of comments.php and <!– google_ad_section_end –> on the last line of comments.php

    That should work, right?

    Thanks in advance.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    That might work, but probably the better way is to put those in the single.php file, around the PHP call to comments_template().

    Again, without looking at it, it’s difficult to say what’s best. You’ll just have to figure it out. 🙂

    Thread Starter phishie

    (@phishie)

    Thanks, that worked. I opened up single.php (except it was called index.php with my template) and I made the modifications as follows:

    <!– google_ad_section_start(weight=ignore) –>
    <?php comments_template(); ?>
    <!– google_ad_section_end –>

    It’s working now. I can see it in my site’s source.

    Thanks for the help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to keep adsense robots from viewing comments’ is closed to new replies.