WordPress.org

Ready to get started?Download WordPress

Forums

Post-background does not change!?!!?! (2 posts)

  1. pookey
    Member
    Posted 6 years ago #

    Hi!

    I'm doing a random background by session function i my wp theme. I finally got it to work, when I noticed that the background i white when I click on a post!

    Does anyone know what this can be?

    I have this in my HEADER.PHP:

    <?php include("background.php");
    ?>

    ...

    </head>

    <body background="<?=$_SESSION['background']?>">

    and In my BACKGROUND.PHP:

    <?php
    session_start();

    if(!$_SESSION['background'])
    $_SESSION['background'] = 'wp-content/themes/tutorial2/background/background' . mt_rand(1, 5). '.jpg';
    ?>

    Thanks!

    /Hans

  2. Kafkaesqui

    Posted 6 years ago #

    Perhaps:

    <?=$_SESSION['background']?>

    should be:

    <?php echo $_SESSION['background']; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic