Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to set up a few local multisite installs that will share the same themes folder, but have separate upload and plugin folders that will be in the usual places in wp-content.

UPDATED:

WordPress is installed at /Users/josh/Documents/Websites/themedev.dev/ and I've create the new theme directory at Users/josh/Documents/jp-content/jp-themes and put twenty twelve into it for testing purposes.

Per Otto's suggestion below I created and activated a plugin that is just this:

$directory = '/Users/josh/Documents/Websites/jp-content/jp-themes';
register_theme_directory( $directory );

That showed twenty twelve in the theme admin page, but on the front-end I got a blank page, and the page source was totally empty.

When I changed the first line to $directory = '/Users/josh/Documents/Websites/jp-content/jp-themes/' (note the trailing slash,) I got the theme, but not the style. When I echoed the value ofget_template_directory_uri()I gotUsers/josh/Documents/Websites/jp-content/jp-themes//twentytwelvewhich would explain it. I tried usingtrailingslashit` instead of adding the slash like this:

$string = '/Users/josh/Documents/Websites/jp-content/jp-themes';
$directory = trailingslashit( $string );
register_theme_directory( $directory );

and got the same results.

I still can't figure out what I'm doing wrong here...

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

http://codex.wordpress.org/Function_Reference/register_theme_directory

/**
 * Register a directory that contains themes.
 *
 * @since 2.9.0
 *
 * @param string $directory Either the full filesystem path to a theme folder or a folder within WP_CONTENT_DIR
 * @return bool
 */
function register_theme_directory( $directory )

You should be able to call register_theme_directory('/full/path/to/directory') and thus add a new path full of themes. This eliminates the need to use any defines as you're attempting to do. You could do this in a mu-plugin on each installation, to force the whole install to have those themes available.

I would leave the default themes in the wp-content/themes directory on each install, and just add your custom themes in your new theme path.

share|improve this answer
    
Thanks Otto. That's a lot simpler. I'm still getting the same results theme-wise. I updated the question accordingly. BTW It was very nice to meet you last weekend. –  JPollock Aug 29 '13 at 1:48
    
If your new theme directory is actually outside your main website folder, then no magic will ever make it work. Things like the stylesheet and such have to be accessible by the webserver for it to serve them directly. WordPress doesn't serve the style.css file, the webserver does. –  Otto Aug 29 '13 at 15:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.