• Resolved michaelpon12

    (@michaelpon12)


    I have a css for my site

    background: #e5ddc8 url(http://fabioide.com/frederiksminde/wp-content/uploads/2014/10/fredshotel-headbgg.png) top left repeat-x;
    }

    I want to change the url to a more consistent code by using funtion because if ever I change my site location it will not detect the url since i change the url. what is the right url to get the wordpress link of the site to access the wp-content.

    background: #e5ddc8 url(/wp-content/uploads/2014/10/fredshotel-headbgg.png) top left repeat-x;
    }

    I try to use this code but nothing happens the image doesn’t load.

Viewing 4 replies - 1 through 4 (of 4 total)
  • To use a relative URL, I believe it needs to be relative to the directory where the theme’s style.css is loaded. If you’re trying to get it to link to the file in your example above, note that your style.css is probably located at:

    wp-content/themes/themename/style.css

    So the path is going to be:

    background: #e5ddc8 url("../../uploads/2014/10/fredshotel-headbgg.png") top left repeat-x;
    }

    use:

    background: #e5ddc8 url(“/frederiksminde/wp-content/uploads/2014/10/fredshotel-headbgg.png”) top left repeat-x;

    There should be quotes (double or single, doesn’t matter) around the url as in my example.

    Thread Starter michaelpon12

    (@michaelpon12)

    Placed the image on my themes folder under images using the FTP

    then change my css to this

    body
    {
        background: #e5ddc8 url(images/fredshotel-headbgg.png) top left repeat-x;
    }

    Well if that worked for you then it worked, looks like you didn’t need our advice. You should still have quotes around the url though.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘url function for css’ is closed to new replies.