roots / sage

WordPress starter theme with Laravel Blade components and templates, Tailwind CSS, and a modern development workflow
https://roots.io/sage/
MIT License
12.74k stars 3.06k forks source link

URLs broken when install is >= 2 subfolders deep #395

Closed jfsebastian closed 11 years ago

jfsebastian commented 12 years ago

I've been trying to create a child theme in my wordpress which is installed in a custom directory (/vendor/wp in my case) and configured to work by default from / .

In the functions roots_scripts() in roots-scripts.php the value of $base is right, but it seems that the function wp_register_script adds automatically the base wordpress directory and hence duplicates the first part of the URI, in my case it converts it to /vendor/wp/vendor/wp/wp-content/themes/roots/js/[...]

I'm not enough familiar with the URI functions of wordpress, but it seems that is necessary a function like get_template_directory_uri() but relative to the install directory of wordpress.

By now I'll bypass the value of $base in the parent theme.

Thanks for a wonderful product.

Regards from Spain.

ohneSehnsucht commented 11 years ago

...oh, and I had to revert to standard links in settings.

juancarlos-rodriguez commented 11 years ago

Ok, it was working at the beginning, all my css and js was working great. I created some pages and Custom Post Types.. Everything was working. I created a single post... and everything is broken... no css, js, etc

Running WP 3.5 + roots-6.2.0 * On /public_html/wp-content/themes/root/ *

In the .htaccess file:

BEGIN WordPress

RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteRule ^assets/css/(._) /wp-content/themes/lmc/assets/css/$1 [QSA,L] RewriteRule ^assets/js/(._) /wp-content/themes/lmc/assets/js/$1 [QSA,L] RewriteRule ^assets/img/(._) /wp-content/themes/lmc/assets/img/$1 [QSA,L] RewriteRule ^plugins/(._) /wp-content/plugins/$1 [QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

END WordPress + HTML5 Boilerplate

Thanks!

juancarlos-rodriguez commented 11 years ago

After some testing... I didn't modified the htaccess or the scripts.php. I just changed the Permalink Settings to Default and everything it's working now and if I switch that to Post name, the styles, js... etc stop working.

At the beginning (when was working after installation) the theme was using "/assets/css/main.css" to get the file. After the wrote the first post, it was using "/assets/css/main.css" but didn't work When you change the Permalink Setting to Default. The theme uses "/wp-content/themes/roots/assets/css/main.css" and works at least.

After you modified the Permalink Setting, wordpress deletes the Rewrite Rules of the htaccess file. But if you place again the original htaccess file (the one I was using at the beginning, when everything was working) you won't get the styles working.

pasyuk commented 11 years ago

If you change /wp-content/uploads directory to /assets then RewriteRule will not work because you have RewriteCond %{REQUEST_FILENAME} !-d - condition to not rewrite if directory exists. rename uploads directory to something different from assets. You can do it on Settings -> Media page. Then rename it on FTP.

juancarlos-rodriguez commented 11 years ago

Hey pasyuk! Thanks a lot for the answer! That works!

lorenzzz commented 11 years ago

Thanks a lot and sorry for my unnecessary issue

Roots Theme rocks !

retlehs commented 11 years ago

closed by @damianregan's fixes pulled in with #688