The MU forums have moved to WordPress.org

Hacking sidebar to show same random ads across multiple blogs (4 posts)

  1. billdennis5
    Member
    Posted 15 years ago #

    I'm running several blog with the same theme (Magazine-Basic, which I love).

    Basically, I'm using the Ad-Rotator widget which lets me place four different sets of rotating ads in my sidebars.

    What i want to do instead is hard HTML code the sidebars in this theme to show the same ads, all the time. If I place a new ad or remove an add, I want the change to happen on all the blogs at once. Otherwise, I'm goign to have to cut and past on four widgets on six different blogs widgets, rather than cut and past on one sidebar.php file.

    I tried to adapt a random code script, but I keep getting error messages:

    Parse error: syntax error, unexpected T_STRING in /home/blogpeor/public_html/dailynews/wp-content/themes/magazine-basic/sidebar2.php on line 17

    Without posting the HTLM I am using (which I'll do at the earliest opportunity) I am wondering if anyone in the wonderful WPMU community have a way of going about this.

  2. billdennis5
    Member
    Posted 15 years ago #

    OK, this is the HTML that I am trying to use in sidebar2.php:

      <?php $rdm=rand(1,4);
      if ($rdm==1) $quote="<a href="http://wpwebhost.com/affiliate/idevaffiliate.php?id=544_0_1_5" target="_blank"><img border="0" src="http://wpwebhost.com/affiliate/banners/wpbanner300x250.gif" width="300" height="250"></a><br />";
      else if ($rdm==2) $quote="<a href="http://wpwebhost.com/affiliate/idevaffiliate.php?id=544_0_1_18" target="_blank"> <img border="0" src="http://wpwebhost.com/affiliate/banners/wpbanner300x250-45k.gif" width="300" height="250"></a><br />";
      else if ($rdm==3) $quote="<a href="http://wpwebhost.com/affiliate/idevaffiliate.php?id=544_0_1_24" target="_blank"><img border="0" src="http://wpwebhost.com/affiliate/banners/300x250.gif" width="300" height="250"></a><br />";
      else if ($rdm==4) $quote="<a href="http://wpwebhost.com/affiliate/idevaffiliate.php?id=544_0_1_12" target="_blank"><img border="0" src="http://wpwebhost.com/affiliate/banners/banners-300x250.gif" width="300" height="250"></a><br />";
      echo $quote; ?>
      </ul>

      Line 17 begins if ($rdm==1)

      Any advice?

  3. billdennis5
    Member
    Posted 15 years ago #

    bumping up

  4. SteveAtty
    Member
    Posted 15 years ago #

    If you are using " to define $quote then you need to to either escape the " inside the tag or you need to use ' instead.

    To make thing easy I'd used ' to define quote, so: $quote='<a hef ref="

About this Topic

  • Started 15 years ago by billdennis5
  • Latest reply from SteveAtty