WordPress.org

Ready to get started?Download WordPress

Forums

Single ad-rotator plugin for multiple blogs (3 posts)

  1. AshleyMorgan
    Member
    Posted 6 years ago #

    I'm using the ad-rotator plugin from http://blog.taragana.com but have a problem getting it to use a single URL source for the ad txt files. Here's the full original code...

    <?php
    function getad($ad = '') {
    $ad = trim($ad);
    if(strlen($ad) > 0) {
    $ad = ABSPATH . "wp-content/" . $ad . '.txt';
    if(file_exists($ad)) {
    $ads = file($ad);
    return $ads[rand(0, sizeof($ads)-1)];
    }
    }
    }
    ?>

    I want to be able to pull the same set of txt files from a single place on one of my websites, so I tried changing the line in bold to this...

    $ad = ABSPATH . "http://www.bigarenarecords.com/ads/" . $ad . '.txt';

    ...where "http://www.bigarenarecords.com/ads/" is the location of my txt ad files but it won't work. The plugin works fine if I keep the path as "wp-content/" but this won't work for me since I am trying to manage a large number of blogs. I want to be able to update my ad txt files in one place and then have all the blogs pull the ads from that one place. Otherwise, everytime I want to make a change to the ads I will have to upload a new set of files to every blog wp-content folder. Since I run a record label with a growing number of artists blogs, all of which I want to be able to pull and insert ads from one set, this could quickly become a headache.

    Any suggestions?

  2. Jeremy Clark
    Moderator
    Posted 6 years ago #

    Try this
    $ad = "http://www.bigarenarecords.com/ads/" . $ad . '.txt';

  3. AshleyMorgan
    Member
    Posted 6 years ago #

    Thanks Jeremy, I tried that but it doesn't work. No specific errors, just no ads showing.

Topic Closed

This topic has been closed to new replies.

About this Topic