Support » Fixing WordPress » Simple question about $postcount hat has me baffled–help!

  • Resolved rs11

    (@rs11)


    I’d like to use $postcount to display google ads in-between posts in 2-3 different places of a WordPress site.

    I’ve experimented with this code snippet, and it works great for 1 ad display in-between posts:

    <?php
    $postcount++;
    if($postcount==2){?>

    But if I want to display 3 sets of ads, then how do you put multiple numbers in the $postcount? I tried several coding methods that were rejected, including:

    <?php
    $postcount++;
    if($postcount==( array( 2,4 ) ) ){?>

    Do you have a suggestion? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Simple question about $postcount hat has me baffled–help!’ is closed to new replies.