Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How to share a theme across multiple - Separate - WP Installs? WordPress

  • SOLVED

I have a custom theme that is being used by 5 different sites. They are each running on a separate WP install.

Each time I update the theme, I have to copy and upload the same files across the 5 sites. I am wondering if there is a way to remotely load the theme in from one place as opposed to keeping the same files in 5 different places.

Answers (4)

2011-11-22

Luis Abarca answers:

1.- If you have shell access, you can upload your theme to a Git or SVN repository and the checkout in your sites.

2.- If your sites are hosted in the same server you can create a symlink to your theme folder.

CPanel gives you the option to create many domains in one account, the it sahres the same account.

Root site:
/home/wp-content/themes/your-theme

Childs:
/home/domain1.com
home/domain2.com


badnews comments:

Say my home site is:
/public_html/sites/folder/parentsite.com and naturally the themes are at /public_html/sites/folder/parentsite.com/wp-content/themes/the-theme-to-share

how exactly would i symlink the same theme the child sites?
/public_html/sites/folder/childsite1.com
/public_html/sites/folder/childsite2.com
/public_html/sites/folder/childsite3.com
and so on?


Luis Abarca comments:



$ shh yoursite.com
$ ln -s /public_html/sites/folder/parentsite.com/wp-content/themes/the-theme-to-share /public_html/sites/folder/childsite1.com/wp-content/themes/the-theme-to-share


badnews comments:

It seems to partially work...

I get:

The following themes are installed but incomplete. Themes must have a stylesheet and a template.
Name Description
parenttheme Stylesheet is missing.


Luis Abarca comments:

Check if the mentioned files exists, or have have the correct file permissions, usually 644 or 664


badnews comments:

Yes on both counts.


badnews comments:

Actually scratch.

At the child site I had made the symlink inside the-theme-to-share folder which I had accidentally created. Like:
"themes/the-theme-to-share/the-theme-to-share(symlink)".

When I correct that to "themes/the-theme-to-share(symlink)" no theme is read at all.


Luis Abarca comments:

Try this way


$ shh yoursite.com
$ cd /public_html/sites/folder/childsite1.com/wp-content/themes/
$ ln -s /public_html/sites/folder/parentsite.com/wp-content/themes/the-theme-to-share the-theme-to-share

$ ls -ld theme-to-share


and check if you can see the files


badnews comments:

Gives me this:
lrwxrwxrwx 1 username username 58 Nov 23 04:24 themes -> /public_html/sites/folder/parentsite.com/wp-content/themes

From what I can tell the symlink is working as long as being accessed from within shell. Not for wordpress though. Strange.


Luis Abarca comments:

Try to add world permission to the theme just to see if it works, maybe is a matter of user permissions


badnews comments:

Unfortunately that's not the issue either. The permission are fine. Readlink reads the symlink just fine. Must have something to do with hostgator - their support was useless on this.

2011-11-22

rizaljohn answers:

badnews,

I guess sharing theme across 5 different sites might not be possible. You can achieve this if you are using multisite.


badnews comments:

Unfortunately, multisite is not an option. I'm told that symlinking might work. Don't know how one would go about doing that though.


badnews comments:

http://wordpress.org/support/topic/using-a-remote-theme-on-multiple-wordpress-sites

I saw the suggestion for symbolic links here.


rizaljohn comments:

You may try the symbolic links that needs quite lot of work because you have 5 sites.

2011-11-22

John Cotton answers:

I'm guessing that you don't want to share you theme with the world on WordPress's theme repository?

If that's the case, then I believe there isn't another built in way to do this - you'd have to invent something.

If there are all on the same server you could write a little script and execute with a cron job.

If they are different servers, how about:

* Uploading the theme ZIP to one of the sites - your master site
* Have a little script in the functions file will accepts a date and - if it's earlier than the last-modified date of the zip file, have it send back the zip file, otherwise nothing.
* The other sites poll the master site regularly (use WP Cron) with their last-changed date (stored as an option) and - if they get a file back - unpack it, update the theme and store the new last-changed date.

For $5, I can't write the code for you, but I don't think the above would take too long to put together. (have a look in wp-admin/update.php and you'll see how the internal uploader does it; it's a slight modification of that).



badnews comments:

John,

They are all on the same server. As I don't know what would be involved in getting this done, $5 is negotiable - since I had to put an amount to post :).


John Cotton comments:

How urgent is it?


badnews comments:

Not too much as these sites are working fine as they are. Just a nice to have.


John Cotton comments:

OK - in which I might have a crack at it in a few days (I'm too busy with projects to focus on it just yet).

When it's done I'll let you know.

JC

2011-11-22

Romel Apuya answers:

hi badnews,

You dont need to upload all the theme files when you update the theme.
you just need to upload the file that you updated.

cheers,