【发布时间】:2021-12-08 17:15:18
【问题描述】:
我正在使用本地服务器 (xampp) 构建主题。我通过定制器创建了一个设置,有人可以从我使用下拉列表创建的多个背景中进行选择。在实时预览和静态主页上一切正常。创建新页面后,我收到了 404 错误,图片的路径是:http://localhost:777/wordpress-5.8/wordpress**/index.php/front-page/**wp-content/themes/sophia-valeria/backgrounds/bgg33.jpg
该链接不起作用。我不确定为什么会这样。
我确实注意到,每次我创建一个页面时,它的 URL 中都有 index.php,但主页没有。
我的 CSS 看起来像这样:
function understanding_bg(){ ?>
<style>
body{ background-repeat:no-repeat;
background-size:100% 100%;
background-image: url(<?php echo(get_theme_mod('backgrounds_setting', get_stylesheet_directory() . '/backgrounds/bgg33.jpg'));?>);}
</style> <?php }
add_action( 'wp_head', 'understanding_bg');
我不知道这是一个奇怪的 apache 问题还是什么——关于我必须做些什么来使图像不包含页面标题和 index.php 的任何想法。我在这里遗漏了一些东西。
【问题讨论】:
标签: php css wordpress wordpress-theming