How to sync L&L files across multiple domains

Hi, I am wondering if anyone has any tips on how to manage an L&L-based WordPress theme across multiple domains?

Basically, I want to sync L&L files across multiple domains. My cPanel has a tool to copy selected database tables but I’m not sure which ones are required for L&L templates and styles etc.

I believe there is a plan to address this specific issue on the roadmap but I’m wondering how best to solve this in a meantime.

Thanks,
Phil.

Not sure I can help you with this one since the only way I’ve ever moved templates around was with L&L’s import/export functionality. It sounds like what you’re looking for is a way to sync those templates live between multiple sites. I can’t speak to workarounds, but you’re right that the team is working on a way to allow you to have a personal cloud to store templates in that would allow you to sync those templates between multiple sites. Most of the discussions I’ve seen, which specifically pertain to Tangible Blocks, have been around how version control of blocks, and theoretically L&L templates too, would be managed. There are some pretty massive implications to that setup since it’ll influence not only the ability to sync specific blocks/templates between your own sites but also needs to work when it comes to selling or otherwise distributing blocks to third parties. The goal, as with everything L&L-related, is maximum long-term flexibility, so we’re making sure to evaluate all the possible use cases. So thanks for bringing this up as a potential use case! Hopefully, someone with more general WP experience can chime in about how you could make that sync work with your existing tech stack.

Hey Phil, I’m following up on this thread because I spoke to someone that actually knows a thing or two about how L&L is all setup. It turns out that everything in L&L is saved as custom post types, so if you can sync those between your sites, you should be golden. From what I can see, the existing post types are:

  • tangible_template
  • tangible_layout
  • tangible_style
  • tangible_script

Hope that’s helpful!

Thanks that is what I suspected.

I’m sure there are many plugins and server-side solutions for syncing database tables across domains, so it would not be hard to solve.

Native L&L syncing would be really useful for businesses that want to share solutions across websites for clients etc. :slight_smile:

1 Like

I’ve been looking into this solution again, so I just thought I would provide an update that might be useful for future plugin development.

A few plugins, such as WP Migrate, handle database table migration quite well.

However, WP Migrate will not let me sync specific posts tables without removing all the other non-selected posts tables. I believe this is because they want to avoid doing any kind of database merging, which is explained here.

If L&L wanted to simplify the migration of templates to other websites/domains, the team could implement something similar to the Local JSON feature for ACF:

With this enabled, it becomes a simple case of copying the .json files between websites/domains and can be automated using whatever file copy process the user prefers. :slight_smile:

1 Like

Great link to how WP Migrate handles syncing databases across domains. I see this article goes into more detail: Syncing WordPress Database Changes Between Environments.


Also nice suggestion to look into the Local JSON feature of ACF. A concern I have with the approach is that it requires the plugin to scan a theme folder and import files, which will affect site performance if done automatically (always/regularly checking for possibly updated files). It’s a little simpler to copy files instead of doing import/export manually, but I wonder if it’s worth the convenience. I think it’s better to keep such data in the database.

An alternaive might be to support exporting templates as a single PHP file, which can be loaded by the theme and copied from site to site. But I wonder what happens when such automatically imported templates are edited on one site but not another.


As Ben mentioned, we’re planning to implement a personal cloud storage of templates, along with premium template libraries. As a stepping stone, and as one of the building blocks, there could be a feature to sync directly from one site to another (both running L&L).

In that case, it would probably work the same way as import/export, to simply overwrite or skip duplicate tempates. Version control is a gnarly question that Gutenberg blocks are tackling, but their current solution is not great for user experience. (Block Validation, Deprecation and Migration Experience).

2 Likes

ACF claims the local JSON feature ‘dramatically speeds up ACF’ due to reduced database calls, but perhaps this would not be the case for L&L.

I have a staging site that always has the latest version of my templates, so I am always happy to overwrite the target sites. To avoid overwriting templates/styles unique to the client site, I save them using ACF Tangible Templates, this has been super useful for streamlining my workflow. :slight_smile:

I’m looking forward to seeing this come to fruition. :slight_smile:

It could be that in some situations, database access for custom post types (like field groups) is slower than getting the same data from the file system.

Even in that case, I’d still prefer that the template system gets the freshest templates from the database, instead of checking for files automatically. We have a plan to eventually transition to using custom tables to manage all template types.


How about in the Import/Export screen in the admin, it can:

  • Check for JSON file in a theme folder, and show a button to import it
  • Have a button to export JSON file and save it to the theme folder

The workflow to sync templates across sites would be:

  • Export JSON file to theme in site A
  • Copy files to theme in site B
  • Import JSON in site B

I wonder if that’s any easier than the current way: download exported JSON file; then import it from target site.


Site-to-site sync would be nice. Like how WP Migrate does, connect sites with an API key of some kind, then directly import/export between them.

WordPress core is working on a feature for syncing entire sites. As part of that, they’ll probably develop functions useful for syncing data in general.

1 Like

I’ve been using the ACF Local JSON thing recently, and it works quite well. As soon as the acf-json folder and files are created, the plugin detects them and provides an option to sync the field groups.

The main advantage of the folder and file-based approach is that more technical users can build their own deployment processes using GIT or whatever. I believe that’s why ACF went in this direction.

I really liked how WP Migrate worked until I realised that it would not let me sync specific WP posts tables

Anyway, my use case is probably unique, so it may help to run a poll and see what the broader L&L community wants. :slight_smile: