问题
I am having tons of trouble with this issue. I'm taking a WordPress course, and I'm on the final part... moving it from my localhost to a live server.
After doing so, however, my background images do not appear. At first, my whole media library was broken, but I was able to fix that. I can't seem to figure out the issue with the background images though.
I've been scouring multiple forums looking for an answer before posting here... but I can't seem to find it, or understand it, so I thought I'd ask for help regarding my specific situation.
Here is a link to the current, live WordPress site: http://176.32.230.251/znbootstraptowordpress.com/
And here is a link to the static site, so you can see what background images are missing: http://176.32.230.251/b2wzachnagatani.com/
Thanks in advance for any help!
回答1:
Check your style.css on /themes/bootsrap2wordpress/style.css
find /wp-content/themes/bootsrap2wordpress/assets/img/
there and replace all with
./assets/img/
Your problem will be solved .
full css
回答2:
Here is your problem:
#hero {
background: rgba(0, 0, 0, 0) url("/wp-content/themes/bootsrap2wordpress/assets/img/hero-bg.jpg") repeat fixed 50% 0;
color: white;
min-height: 500px;
padding: 40px 0;
text-rendering: optimizelegibility;
}
url path is incorrect so the browser cant find the image in the path specificed on css ... thats the problem.
Here is the correct path (taken from the page where the background image shows):
#hero {
background: rgba(0, 0, 0, 0) url("../img/hero-bg.jpg") repeat fixed 50% 0;
color: white;
min-height: 500px;
padding: 40px 0;
text-rendering: optimizelegibility;
}
Use Firebug to inspect the element, it helps a lot in this cases to find the root of a problem.
来源:https://stackoverflow.com/questions/32920346/wordpress-no-background-images-on-live-server