• I want to have my home page alwasy display and ad between the 4th and 5th posts. How should I go about implementing this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • first you say hello. then you implement politeness, share your web address, and say thank you. then we reply.

    I’m happy to help, no introduction needed. 😉

    You can use something like CG-Inbetween to help you — basically you insert one line into your index or archive template, and then from the admin panel can create an ‘Inbetween’ set for after the fourth post. I generally recommend people use the ‘file include’ Inbetween type, as you can then include whatever HTML file/code you might want. Makes things easy.

    You can also do it ‘by hand’ if you have some PHP experience. Set a counter at the top of the posts loop, increment at the end of the loop, and when it equals 4 you echo out your ad code. But CG-Inbetween basically does that for you with one line added to your template, and allows you to create different Inbetweens with different offsets (say one at 4, one at 8, and one always after the Last post on a page).

    -d

    In addition to David’s reply -you can also check as an alternate: http://www.tamba2.org.uk/wordpress/adsense/

    Yeah, as I said, you can do it ‘by hand’ — that’s what that link shows how to do. CG-Inbetween does the complex stuff for you, and you only need to insert one line (well, per template file — simple themes might have one file, complex ones might have a few) of php code.

    Additionally, the problem with any case of editing php files is trying to tell people ‘where to put code’. Themes have completely differing code layout.

    In the future, I’m hoping to have CG-Inbetween ‘automatically hook’ into the posts loop. It won’t be guaranteed, and might not work properly if folks use custom queries.

    Unfortunately, WP needs some additional template tags/hooks that ALL theme designs follow in order to enable this stuff to happen without user editing of the theme files… We’re pushing for some of those changes.

    -d

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘How do I insert an ad between posts?’ is closed to new replies.