我刚刚尝试在另一个位于域子目录中的WP安装上安装我的主题。我从来没有想过子目录,但它确实发生了,所以我知道我需要改变它。绝对URLS是不可行的,因为我计划分发主题。
这里的问题是URL需要在数组内部工作,更具体地说是在一些主题设置中。这是他们的样子。
function mytheme_get_theme_mods() {
$defaults = array(
'mytheme_header_logo' => '/wp-content/themes/mytheme/img/logo.png',
'mytheme_footer_logo' => '/wp-content/themes/mytheme/img/footerlogo.png',
'mytheme_middle_image' => '/wp-content/themes/mytheme/img/middleimg.png'
);
return $defaults;}
有人能帮我吗?
发布于 2013-11-18 14:09:56
试试这个:
function mytheme_get_theme_mods() {
$defaults = array(
'mytheme_header_logo' => get_theme_root_uri().'/mytheme/img/logo.png',
'mytheme_footer_logo' => get_theme_root_uri().'/mytheme/img/footerlogo.png',
'mytheme_middle_image' => get_theme_root_uri().'/mytheme/img/middleimg.png'
);
return $defaults;
}如果您喜欢查看数组的输出位置'print_r($defaults);‘,在返回下面,然后调用index.php中的函数,它将打印它查找图像的确切urls。
https://stackoverflow.com/questions/20021901
复制相似问题