Support » Plugin: Ad Inserter - Ad Manager & AdSense Ads » What if I have more than 16 ads?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Spacetime


    Well, this plugin had only 8 code blocks few version ago.

    I can not imagine any real situation where you would need more than 16 ad positions.

    Thank you for your reply.
    In fact, I do not need that many ad positions but only 3. However, I need to display different ads for different categories at the same spots, my website has more than 20 categories, I want to display different ads.
    For example, my site have an ad position that is below the post title, if a post is under Basketball category, I want to display a specific ad for Basketball category, if a post is under Football category, I want to display a specific ad for Football Category, etc.

    Plugin Author Spacetime


    I see, but this is a very specific requirement.

    However, this can easily be achieved with current version using some simple PHP code for each block – enable PHP processing and write code to check for post categories.

    Plugin Author Spacetime


    Closing the thread.

    Wowordpress, I needed the exact same thing; a way to display rotating iframes at the bottom of a post and have them change on page refresh. But, I also wanted different ads to show depending on the post category. I had a friend help me with the php code. I will add it below:

    /*Enter the WordPress category number, then the url's that you want to rotate in the iframe*/
     $urls = array (
        207 => array("",""),
        208 => array("","")
      /*This gets the category*/
      $category = get_the_category();
      /*This counts the number of urls in the selected category*/
      $randcategory = rand(0,(count($category)-1));
      /*this randomizes the urls in the category*/
      $category = $category[$randcategory];
      /*If more than one category is selected for a post, this randomizes all urls in the categories selected*/
      $rand = rand(0,(count($urls[$category->cat_ID])-1));
      /*This checks to see if there are urls in a category. If so, then it displays the random urls in an iframe. If not, then nothing appears including the iframe.*/
      if(!empty($urls[$category->cat_ID][ $rand ])){
      echo "<iframe width='' src='".$urls[$category->cat_ID][ $rand ]."'></iframe>";

    There are many ways of finding out what the category number is of a post in WordPress. You can hover over the category name in the WP Dashboard, and the number will be at the end of the url. You can also download the plugin “Reveal ID’s”. Also you can enter the following php code, and enter it in the WordPress Loop of your single.php page.

      foreach((get_the_category()) as $category) {
      echo $category->cat_ID . ' ';

    You can then use this plugin to place the ads where ever you want on your site. Make sure you check the “Process PHP” checkbox. If you want to insert the ads somewhere other than the default locations in the plugin, you can enable “PHP function adinserter for block 1” then add the code <?php echo adinserter (1); ?> anywhere in your pages using the editor.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘What if I have more than 16 ads?’ is closed to new replies.