Just dig through the Roots Theme code, and you’ll find it. Actually, if I remember correctly, that Theme has very extensive documentation on its website; so I’d start there.
It considers that static-resource URL rewriting to be a “feature”; personally, I disagree. I think it’s entirely pointless, and wasted resources.
Rather than arguing about why, I’d rather people respond with how. I think it’s useful for people who want to hide the fact that the site is built on WordPress. The roots theme does lots of things, I’m only interested in this one thing and I have yet to get this to work without using the entire theme. Please help.
Start here:
https://github.com/retlehs/roots/wiki
Here is the function-specific documentation:
https://github.com/retlehs/roots/wiki/Roots-functions
The documentation indicates that URL rewrites are defined in:
inc/roots-cleanup.php
Here’s the source of inc/roots-cleanup.php:
https://github.com/retlehs/roots/blob/master/inc/roots-cleanup.php
And in that file, here is the function that defines the rewrites:
function roots_add_rewrites($content) {
$theme_name = next(explode('/themes/', get_stylesheet_directory()));
global $wp_rewrite;
$roots_new_non_wp_rules = array(
'css/(.*)' => 'wp-content/themes/'. $theme_name . '/css/$1',
'js/(.*)' => 'wp-content/themes/'. $theme_name . '/js/$1',
'img/(.*)' => 'wp-content/themes/'. $theme_name . '/img/$1',
'plugins/(.*)' => 'wp-content/plugins/$1'
);
$wp_rewrite->non_wp_rules += $roots_new_non_wp_rules;
}
add_action('admin_init', 'roots_flush_rewrites');
Thanks for the help. Finally got it working using the code below. Had to install Roots Theme to see what the final .htaccess file looked like to pull the code. This is what I came up with for anyone else interested, obviously changing the theme folder name “realnice” to whatever you’re using:
Functions.php
[Code moderated as per the Forum Rules. Please use the pastebin]
@jessetr
could you kindly post your code again in pastebin?
thanks
Here’s a link to Pastebin. I’ve never used it before. Let me know if you need anything else.
Pastebin link.
thanks, mate!
i’ve been studying Chip Bennett’s links, and will post results and code afterwards