undefined variable error: wordpress loop [on hold]

I have this snippet within the have_posts loop to echo a shortcode after every 3 posts in the homepage:

$ad_count++;
if($ad_count%3 == 0) {
echo adinserter (7);
echo adinserter (10);
}
else {
echo ‘<span class=”blank-ad”></span>’;
}

But the first line of the snippet returns an undefined variable error and keeps echoing the .blank-ad div instead. I’m not sure what to do since adding a value to $ad_count prevents the snippet from echoing anything at all.

Read more here:: undefined variable error: wordpress loop [on hold]

Leave a Reply

Your email address will not be published. Required fields are marked *