• I have used the following code to insert in the ‘page.php’ and image if the user is on the front page.

    <?PHP
    if(is_front_page()){
    echo '<div align="center"><img src="wp-content/themes/Driver/images/Advert.jpg" /></div>';
    }
    ?>

    However, It does display on some computers and then it doesn’t on others. I have tried updating there browsers etc and still no luck. I have tried change the path to the full path and have the same result.

    I find this really odd why some will display. I have tried it on all browsers so it doesn’t seem to be a browser problem.

    Any suggestions?

Viewing 3 replies - 1 through 3 (of 3 total)
  • 1. Do not use relative urls in WordPress. They can be unpredictable. always use full (absolute) urls.

    2. Your image markup is broken. It is missing the width, height and alt attributes.

    3. align="center" is old, deprecated, markup. You should be using CSS to position page elements.

    Thread Starter jay_bo

    (@jay_bo)

    Sorry I did have the attributes in but I was experimenting to see if I had did them wrong, resulting in it not displaying.

    Okay I have taken your point into consideration and still didn’t display anything.

    So now I have place a div tag where I want the picture and styled it with the following …

    `#advert
    {
    width: 598px;
    height: 428px;
    background-image:url(https://www.******.co.uk/wp-content/themes/Driver/images/Advert.jpg);
    background-repeat:no-repeat;
    }’

    I’m pulling my hair out with this.

    Thanks for your reply.

    Thread Starter jay_bo

    (@jay_bo)

    SOLVED:

    Seems WordPress did not like the image being stored in the images folder. I fixed it by moving the image to the root of the web hosting space and referenced the full URL and it worked.

    Hope this helps people.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Image display problem’ is closed to new replies.