本地主机上的 Wordpress,图像路径错误
Wordpress on localhost, wrong path to images
经过很长一段时间后,我设法在本地主机 运行 xampp 上设置了我的 wordpress。现在的问题是,我在本地副本上看不到任何图片或帖子。通过开发工具,我意识到内容的路径如下所示:
wordpress.localhost/wordpress.localhost/wp-content/...
要不是双倍的"wordpress.localhost",我还能看到。这可能是什么原因造成的?这是由于数据库中的错误吗?我如何解决它?
谢谢!
祝福
如果图片在您的主题文件夹中,图片 src 必须如下所示。
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images-folder/image.png" alt="">
根据您的要求更改图片路径。
get_stylesheet_directory_uri()
returns 您的活动主题路径。
确保您已在设置 > 常规 > 站点地址下正确设置站点名称:http://wordpress.localhost
经过很长一段时间后,我设法在本地主机 运行 xampp 上设置了我的 wordpress。现在的问题是,我在本地副本上看不到任何图片或帖子。通过开发工具,我意识到内容的路径如下所示:
wordpress.localhost/wordpress.localhost/wp-content/...
要不是双倍的"wordpress.localhost",我还能看到。这可能是什么原因造成的?这是由于数据库中的错误吗?我如何解决它?
谢谢!
祝福
如果图片在您的主题文件夹中,图片 src 必须如下所示。
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images-folder/image.png" alt="">
根据您的要求更改图片路径。
get_stylesheet_directory_uri()
returns 您的活动主题路径。
确保您已在设置 > 常规 > 站点地址下正确设置站点名称:http://wordpress.localhost