From 39379742fcdf1dcd5995bd4a36209013f51435b6 Mon Sep 17 00:00:00 2001 From: James Costian Date: Sat, 9 Jun 2012 18:05:56 -0500 Subject: [PATCH 1/2] Corrected home URL for subdir installs If Wordpress is installed in a sub-directory, this will prevent the URL from being the root of the domain (e.g. example.com/sub/directory/ will become /sub/directory instead of / ). --- inc/cleanup.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/cleanup.php b/inc/cleanup.php index 62b7417..def5b3c 100644 --- a/inc/cleanup.php +++ b/inc/cleanup.php @@ -61,8 +61,8 @@ function roots_root_relative_url($input) { '!(https?://[^/|"]+)([^"]+)?!', create_function( '$matches', - // If full URL is home_url("/"), return a slash for relative root - 'if (isset($matches[0]) && $matches[0] === home_url("/")) { return "/";' . + // If full URL is home_url("/") and this isn't a subdir install, return a slash for relative root + 'if (isset($matches[0]) && $matches[0] === home_url("/") && str_replace("http://", "", home_url("/", "http"))==$_SERVER["HTTP_HOST"]) { return "/";' . // If domain is equal to home_url("/"), then make URL relative '} elseif (isset($matches[0]) && strpos($matches[0], home_url("/")) !== false) { return $matches[2];' . // If domain is not equal to home_url("/"), do not make external link relative From aef67d23b8562c7af1288217fd2d05b48cbff69e Mon Sep 17 00:00:00 2001 From: James Costian Date: Sat, 9 Jun 2012 18:12:33 -0500 Subject: [PATCH 2/2] Corrects script and style URLs on subdir installs By removing get_template_directory_uri() from each call to either the wp_enqueue_style() or the wp_enqueue_script() function, the URLs to CSS and JS files will now be correct on subdir installs of WP. --- inc/scripts.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/inc/scripts.php b/inc/scripts.php index 5f65cf5..60acdc3 100644 --- a/inc/scripts.php +++ b/inc/scripts.php @@ -1,16 +1,16 @@