WordPress.org

Ready to get started?Download WordPress

Forums

PHP code in Adsense Plugin (1 post)

  1. what7
    Member
    Posted 8 years ago #

    Aloha,

    I have added Phil Hord's Adsense plugin to my new blog and would like to use it to display random ads from Adsense and others.

    I'm thinking that I should be able to add some PHP code to the Adsense section in the plugin file, but it doesn't want to execute my code :(

    I have added the following code:
    $adsense_code = '
    <!-- Begin Google Adsense code -->
    CODE1
    <phpcode>
    <?php
    srand(time());
    $random = (rand()%9);
    print("Random is: $random");
    CODE2
    ?>
    </phpcode>
    <!-- End Google Adsense code -->
    ';

    This displays CODE1 in my posts, but not the random number and CODE2. I have installed PHP Exec in my attempt to make it work, but that didn't change anything.

    Thanks,
    PhiMix

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags