Before you ask please READ THIS

Random background images

edited July 2013 in Beach Please Posts: 3
Hello community. I would like to use multiple background images on my 'Beach Please' theme, which are getting selected randomly (i.e. I will then get a random image on each refresh on the 'Home' site). How can I achieve this? Thanks :)

Comments

  • AirAir
    Posts: 10,970
    Hello

    You could do such changes:
    go to advance/utilities.php line around 366, there you will find function a13_bg_image()
    change:
            //page/gallery individual
    if(get_post_meta(get_the_ID(), '_bg_settings', true) == 'bg_image'){
    $bg_image = get_post_meta(get_the_ID(), '_bg_image', true);
    $bg_color = get_post_meta(get_the_ID(), '_bg_image_color', true);
    $fit = get_post_meta(get_the_ID(), '_bg_image_fit', true);
    }
    //global setting
    else{
    $bg_image = $apollo13->get_option( 'appearance', 'body_image' );
    $bg_color = $apollo13->get_option( 'appearance', 'body_bg_color' );
    $fit = $apollo13->get_option( 'appearance', 'body_image_fit' );
    }
    to
            //page/gallery individual
    if(get_post_meta(get_the_ID(), '_bg_settings', true) == 'bg_image'){
    $bg_color = get_post_meta(get_the_ID(), '_bg_image_color', true);
    $fit = get_post_meta(get_the_ID(), '_bg_image_fit', true);
    }
    //global setting
    else{
    $bg_color = $apollo13->get_option( 'appearance', 'body_bg_color' );
    $fit = $apollo13->get_option( 'appearance', 'body_image_fit' );
    }
    and this part
            if(!empty($bg_image) || !empty($bg_color)){
    $html = '';
    }

    echo $html;
    change to
            $bg_image = array(
    'http://hypershot.theme.apollo13.eu/wp-content/uploads/sites/3/2013/07/shattered.jpg',
    'http://hypershot.theme.apollo13.eu/wp-content//uploads/sites/3/2012/11/002.jpg',
    'http://hypershot.theme.apollo13.eu/wp-content//uploads/sites/3/2012/11/003.jpg',
    'http://hypershot.theme.apollo13.eu/wp-content//uploads/sites/3/2012/11/004.jpg',
    );
    $rand_key = array_rand($bg_image);

    if(!empty($bg_image) || !empty($bg_color)){
    $html = '';
    }

    echo $html;
    And insert your images in $bg_image array, or use current as example.

    With regards.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion