1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Wordpress CSS/Layout rotation

Discussion in 'PHP' started by drvosjeca, Jul 30, 2011.

  1. #1
    Hi

    I need help with this and would be grateful if there is someone who can help me with this.

    I would like to create theme for worpress which would change layout randomly on each reload.
    My opinion is that most simple thing to do would be rotating .CSS files. My "luck" is that im not quite great with PHP and i dont know how to do it.

    Could you please help me with this css rotation or if you have other suggestions about how to rotate layouts?

    Thanks to all of you!
     
    drvosjeca, Jul 30, 2011 IP
  2. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #2
    It would be easy enough to do that in the header.php section;

    E.G

    <?php
    $styles=array("style1.css", "style2.css", "style3.css");
    
    $inc = rand(0, sizeof($styles)-1);
    ?>
    
    <link rel="stylesheet" type="text/css" href="<?php print $styles[$inc];?>" media="screen" />
    PHP:
    You would have to include the relevant path to the stylesheets as well, but you get the idea.
     
    lukeg32, Jul 31, 2011 IP