I'm sure it can be done, not sure how to do it. I'd like to display and adsense ad block after the tenth comment on my Wordpress blog. Anyone know what code I need to add? Any help would be tremendously appreciated.
Yep it can be done, try something like this: Inside comments.php or whatever comments template you use: anywhere below the line <?php if ($comments) : ?> PHP: add something like: <?php if (comment_ID() == 10) { echo '//ADSENSE CODE HERE'; ?> PHP: Wherever you want the ad block to appear.
I've had a quick look and I don't think they count the comments so we can do it ourselves. OK firstly to check that your changes are working: Anywhere below the line: <?php foreach ($comments as $comment) : ?> PHP: Just add the text <h1>Testing Text</h1> Code (markup): And re-upload the file and reload your page and check that this testing text appears inside every comment. OK if the test was successfull, now replace <h1>Testing Text</h1> with: <?php $counter ++; if ($counter == 3) { echo 'ADSENSE CODE GOES HERE'; } ?> PHP: I tested this and it's working so it should work. Change the number 3 to the number of the comment you'd like it to appear in.