
To place any types of ads after your first post on your home page, just add the following script to your custom_function.php file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
/* Places Ad After The 1st Post */
function after_first_post_ad($post_count) {
if (is_home()) {
if ($post_count == 1) { ?>
/* YOUR AD CODE GOES HERE IN PLACE OF THIS LINE - DELETE ME */
<?php }
}
}
add_action('thesis_hook_after_post', 'after_first_post_ad');
|
To place the ad after the 2nd only, just change all instances of the word "first" to "second" and change "if ($post_count == 1) { ?>" to "if ($post_count == 2) { ?>". Same method if you want to place an ad after 3rd, 4th, 5th, etc.
Many of us bloggers have run ads on our home page (after first post, after second post, etc), but how do you place an ad after your single post? "Single Post" meaning the page you see when clicking on either your permalink (offsite via Facebook, Twitter, etc.) or by clicking the post title on your home page. Below is the code you'll need to add to your custom_fuctions.php: Continue reading