Try looking in post.php or post-homepage.php (if that file exists).
I looked at post.php but I do not see the <?php endwhile; ?> code. I do not see anything in the post.php page that stands out. The index.php page does have the following code though.
<?php
if (have_posts()) : while (have_posts()) : the_post();
get_template_part('post', 'homepage');
endwhile;
else :
get_template_part('post', 'noresults');
endif;
get_template_part('navigation');?>
Drop a copy of post.php into the WordPress pastebin and post the pastebin url here. Perhaps someone will be able to suggest a solution.
here is the link to pastebin.
http://pastebin.com/QCKEQde4
Just to clarify some more. I am looking to insert ads into my homepage after every few posts. Lets use after every 4th post for an example. Thanks again for the help.
Ah! Now I understand. Try replacing:
<?php
if (have_posts()) : while (have_posts()) : the_post();
get_template_part('post', 'homepage');
endwhile;
with:
<?php
if (have_posts()) : $c = 0; while (have_posts()) : the_post();
$c ++;
get_template_part('post', 'homepage');
if ($c > 2 ) {
$c = 0;?>
[ insert ad code here ]
<?php
}
endwhile;
in index.php.
Thanks that worked like a charm. If I want to do the same when somebody clicks on a category and it is listing a list of posts I would add the same code into either Single.php or page.php?
when somebody clicks on a category and it is listing a list of posts
that would possibly be archive.php or category.php;
see http://codex.ww.wp.xz.cn/Template_Hierarchy
Cool. Everything works great. Thanks again.
Right on, esmi. That’s the only code I could get to work with Twenty Twelve because of its odd php tag placements.
The only problem I had was that I wanted more than one ad, and when I tried that, it placed ads with every post, and I ended up with yellowish ad place holders after the 3 max (Google AdSense).
display:none had no effect on the ids, and placing the code inside divs and trying to collapse them did not work either (besides, I did not know if having theme there was violating Google’s TOU.
Finally the Ad Injection plugin came to my rescue.