Wordpress图像无法显示

时间:2017-04-11 15:45:47

标签: php wordpress image

我从其他人那里接过了这份工作,我被要求用另一个替换图像,但在我将新图像上传到媒体库并修改了代码之后,新图像就不再显示了。前一个人完成的代码是这样的

background: url(images/logoCA.png)

我上传的图片名为" Logo_TM.png"所以我将其修改为

background: url(images/Logo_TM.png)

这是我唯一改变但图片不再显示的内容......

今天,我发现以前的人使用FileZilla上传文件,所以我尝试通过FileZilla上传。我将我的图像上传到他上传上一张图片所在的文件夹(路径为 wp-content / themes / sportscreen / images / filename )。但是......图像仍然没有显示出来。我很沮丧,请帮忙。谢谢。

2 个答案:

答案 0 :(得分:0)

在Wordpress中,图像也会保存在数据库中,因此您应该将其检出。

您可以查看这篇文章,详细说明您的图片可以正确加载的位置。

http://www.wpbeginner.com/beginners-guide/where-does-wordpress-store-images-on-your-site/

 "Information about your uploads is stored in database as a attachment 
 post type under the posts table."

希望它有所帮助。

答案 1 :(得分:0)

我假设文件位置是:

wp-content/themes/sportscreen/images/Logo_TM.png
wp-content/themes/sportscreen/style.css

如果是这样,css规则应该(确实):

background: url(images/Logo_TM.png);

确保它没有被其他css规则覆盖 - 你可能想要添加!important - 所以它看起来像这样:

background: url(images/Logo_TM.png) !important;

如果css文件位于其他位置,请说

wp-content/themes/sportscreen/css/style.css

你应该这样:

background: url(../images/Logo_TM.png) !important;

等等。

编辑 -

忘记提及,确保 http://www.example.com/wp-content/themes/sportscreen/images/Logo_TM.png 实际上可以从网络浏览器中访问。