Support

Account

Forum Replies Created

  • I am a PHP novice and have the following problem and I really hope someone can help as I cannot find the answer in any of the support forums: I want a non-tech WP admin to be able to change the image on a home page of a WordPress 4.1 site.

    I have successfully created an Image Object field and Image metabox that works just fine on a test page, but every time I try to replace the existing $home_banner image variable in the live home page template, it doesn’t work. I have also tried an Image URL field but it just renders in HTML as h

    I have set up an Image Object field called ‘image-main’ and I want to use it to replace the existing variable $home_banner variable in the following code. Can anyone tell me how to edit the existing page template do this. Thanks. Existing live code snippet is below:

    $home_banner = get_stylesheet_directory_uri() . ‘/library/images/’;

    if (is_mobile()) {
    $home_banner .= ‘home-banner-medium.jpg’;
    }

    else { $home_banner .= ‘home-banner.jpg’;

    }

    <script>window.home_banner = “<?php echo $home_banner; ?>”;</script>

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div class=”banner”>

    <h1>Bringing nature to you <span>wherever you are</span></h1>

    </div>

    The particular home page is here: http://inhouse-test.indoorgardendesign.com/

    Thanks in anticipation.

    SJL

Viewing 1 post (of 1 total)