Global Parent theme for all sites

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.

Related posts

Leave a Reply

2 comments

  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.

  2. 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.