• Hello everyone,
    Can I add this option to exclude some posts

    <?php if (is_single(’666')) {
    }
    else { ?>
    
    <p>Show this everywhere!</p>
    
    <?php } ?>

    with this code

    <?php
      $content = apply_filters('the_content', $post->post_content);  //get the post content store in $content
      $save = explode("</p>", $content);  //Separate the content into <p> blocks
      $tcount=0; //this is count for number of <p> blocks
      $adon=0;  //this is a variable so you don't show ads more than once.
      foreach($save as $item) {
        echo $item;  //print the <p> block
        echo "</p>";
        if(preg_match('/<p> /',$item)==0 && $tcount>=1 && $adon==0) {
                                    $adon=1;
    ?>
    ADSENSE HERE
    <?php
        }
     if(preg_match('/<p> /',$item)==0 && $tcount>=4 && $adon==1) {
                                    $adon=2;
    ?>
    ANOTHER ADSENSE IF YOUR POST HAVE MORE THEN 4 PARAGRAPHS
    <?php
       }
       $tcount++;
     }
    ?>

    Is this possible?

    Thank you.

  • The topic ‘Atuomatically add adsense in posts but…’ is closed to new replies.