1

I have 15 different wordpress sites installed on my server. They are independent installations , not multisite. I have developed a parent theme and copied it in all sites. Now whenever I have to make a change in parent theme, I have to access parent theme of all sites and make changes in each theme. Is it possible that I can globalize this parent theme such that I do change on one place and it reflects on all 15 sites (Without using Multisite feature). Though I wrote a php script that copies parent theme in all sites but not satisfied since I have to call that script everytime.

4
  • How would one stand-alone WordPress install know about another one? Why don't you want to use MultiSite, which would make your problem a non-issue? Feb 26, 2013 at 16:24
  • They gave me 15 stand alone wordpress sites to work. :(
    – mysterious
    Feb 26, 2013 at 16:27
  • 1
    Then I would search the site for how to hook into the WordPress Update API, host the Theme somewhere yourself, and let the individual sites poll for updates. See this question, for example Feb 26, 2013 at 16:42
  • thanks. Will check it out. Can you make this comment your answer. I may consider accepting it :D.
    – mysterious
    Feb 26, 2013 at 16:47

2 Answers 2

1

Create a separate directory and a (sub) domain for your themes.
Lets say the domain is themes.example.com, and the directory is /extra/wp-themes/.

Now let all your installations use the new theme root. Or just do the same for plugins to manage all plugins from one place too.

Registering a new theme root is not possible with constants, you will need a plugin like this:

<?php
/* Plugin Name: Local Theme Roots */

add_filter( 'theme_root_uri', 't5_switch_theme_root' );
add_filter( 'theme_root',     't5_switch_theme_root' );

/**
 * Create a custom theme directory.
 *
 * @wp-hook theme_root
 * @wp-hook theme_root_uri
 * @author  Thomas Scholz, http://toscho.de
 * @param   string $in URL or path
 * @return  string
 */
function t5_switch_theme_root( $in )
{
    if ( 'theme_root_uri' === current_filter() )
        return "http://themes.example.com";

    // If we made it so far we are in the 'theme_root' filter.
    $new_root = '/extra/wp-themes';
    register_theme_directory( $new_root );
    return $new_root;
}

Be aware there is a bug in the WordPress’ theme updater that doesn’t let you update themes from the wordpress.org directory when you are using a custom theme directory. You have to run the updates for such themes either manually, or use my patch from Ticket #22501 until WordPress 3.6 is out.

0

Assuming you are on linux and all the sites are on one server you can use symbolic links

If your deployment location of the theme is /home/me/mytheme add an symbolic link in each site's theme directory to point to it

/home/site1/wp-content/themes/mytheme -> /home/me/mytheme

Once done every time apache will access the file /home/site1/wp-content/themes/mytheme/x.php the OS will load the file /home/me/mytheme/x.php, therefor a change in the /home/me/mytheme/x.php file will have an immediate impact in all of the sites.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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