0

I just tried installing my theme on another WP install that lies in a subdirectory of the domain. I never really thought too hard about subdirectories, but it does happen so I know I need to change it. Absolute URLS aren't feasible since I plan on distributing the theme.

The catch here is that the URL needs to work inside of an array more specifically with some themes settings. Here is how they look.

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;

}

Can anyone help me out?

user1632018
  • 2,485
  • 10
  • 52
  • 87
  • This should help you: http://stackoverflow.com/a/2356467/452233 – ultranaut Nov 16 '13 at 18:29
  • 2
    you really should be using `get_template_directory_uri()` or `get stylesheet directory()` ( http://codex.wordpress.org/Function_Reference/get_stylesheet_directory ) – Obmerk Kronen Nov 16 '13 at 19:08
  • If I could downvote comments I would downvote ultranaut's comment. You should use `get stylesheet directory()` and not `ABSPATH` – user2019515 Nov 17 '13 at 04:24

1 Answers1

0

Try this:

     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;
}

if you who like to look at the array's output place 'print_r($defaults);' underneath the return and then call the function in index.php and it will print the exact urls where it looking for the images.

mickhayworth
  • 36
  • 1
  • 3