How to add php to html wordpress

Discussion in 'HTML & Website Design' started by yazah, Nov 18, 2010.

  1. #1
    I am trying to add an image rotator to my wordpress but it will not show up.Is there a way to do this here is the code

    <script type="text/javascript">
    <!-- Begin
    rnd.today=new Date();
    rnd.seed=rnd.today.getTime();

    function rnd() {
    rnd.seed = (rnd.seed*9301+49297) % 233280;
    return rnd.seed/(233280.0);
    };

    function rand(number) {
    var result = Math.ceil(rnd()*number);
    if (!result)result++;
    return result
    };
    var ad_cnt1 = 3;
    var ad1 = rand(ad_cnt1);
    var link1;
    var adBanner1;
    var width1
    var height1
    if (ad1==1) {
    link1="google.ca";
    adBanner1="http://yazah.com/imagerotator/images/image1.jpg";
    width1="400";
    height1="400";
    alt1="";
    }
    if (ad1==2) {
    link1="google.ca";
    adBanner1="http://yazah.com/imagerotator/images/image2.jpg";
    width1="400";
    height1="400";
    alt1="";
    }
    if (ad1==3) {
    link1="google.ca";
    adBanner1="http://yazah.com/imagerotator/images/image3.jpg";
    width1="400";
    height1="400";
    alt1="";
    }
    document.write('<center><img src="' + adBanner1 + '" width=' + width1 + ' height=' + height1 + ' border=0 alt="' + alt1 + '">');
    document.write('</center>');
    // End -->
    </SCRIPT>
     
    yazah, Nov 18, 2010 IP
  2. workingsmart

    workingsmart Well-Known Member

    Messages:
    411
    Likes Received:
    12
    Best Answers:
    9
    Trophy Points:
    120
    #2
    workingsmart, Nov 18, 2010 IP
  3. yazah

    yazah Peon

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    <script type="text/javascript">
    <!-- Begin
    rnd.today=new Date();
    rnd.seed=rnd.today.getTime();

    function rnd() {
    rnd.seed = (rnd.seed*9301+49297) % 233280;
    return rnd.seed/(233280.0);
    };

    function rand(number) {
    var result = Math.ceil(rnd()*number);
    if (!result)result++;
    return result
    };
    var ad_cnt1 = 3;
    var ad1 = rand(ad_cnt1);
    var link1;
    var adBanner1;
    var width1
    var height1
    if (ad1==1) {
    link1="google.ca";
    adBanner1="http://yazah.com/imagerotator/1.jpg";
    width1="400";
    height1="400";
    alt1="";
    }
    if (ad1==2) {
    link1="google.ca";
    adBanner1="http://yazah.com/imagerotator/2.JPG";
    width1="400";
    height1="400";
    alt1="";
    }
    if (ad1==3) {
    link1="google.ca";
    adBanner1="http://yazah.com/imagerotator/3.jpg";
    width1="400";
    height1="400";
    alt1="";
    }
    document.write('<center><img src="' + adBanner1 + '" width=' + width1 + ' height=' + height1 + ' border=0 alt="' + alt1 + '">');
    document.write('</center>');
    // End -->
    </SCRIPT>


    try that.thanks
     
    yazah, Nov 18, 2010 IP
  4. workingsmart

    workingsmart Well-Known Member

    Messages:
    411
    Likes Received:
    12
    Best Answers:
    9
    Trophy Points:
    120
    #4
    well that works - so if the ads are coming in then there is no reason why it won't work on your wordpress theme... You have to add the code to one of the files via > Appearance > Editor

    Select whichever file you are looking to add it to... Keep in mind the size of the image...

    Cheers!~
     
    workingsmart, Nov 18, 2010 IP
  5. yazah

    yazah Peon

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It works on your page but when i make a page in my wp admin and place that code in the content it shows nothing.
     
    yazah, Nov 18, 2010 IP