For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to create cross-installation components

Reusability is a core principle that helps us build advanced functionality without spending a long time on implementation.

With Advanced Views, you can reuse Layouts and Post Selections created for one website across any number of other websites.

Save any item to your personal library and reuse it in future projects to accelerate development and maintain consistency.

Component export vs. Cross-installation components

Both features support exporting and importing components, but they serve different purposes.

  1. Component export is the simplest option for creating backups or performing a one-time migration of components between installations.

  2. Cross-Installation components are designed for long-term reuse across multiple installations. They let you maintain standalone, reusable components, which include related Meta Groups.

1. About git-based storage

Reusing components requires a storage location that is independent of any specific project, along with a way to push components to and pull them from that library.

In Advanced Views, any GitLab repository can serve as a component library. The plugin provides a built-in UI for pushing Layouts and Post Selections to the library and pulling them into other projects.

We chose Git because it is a robust, widely adopted version control system, and GitLab offers free repositories that are ideal for this purpose.

You can manage your library entirely through the plugin's UI or, if you prefer, work with it directly using Git and the GitLab web interface.

Your component libraries are private and fully under your control, giving you complete ownership of your reusable assets.

Note: The Git library is independent of your projects, so you can continue using Git to manage each project as usual. Advanced Views does not create a .git directory or interfere with your existing repositories. Instead, it uses the GitLab REST API to push components to and pull them from your library.

2. How to create a cross-installation library

  1. Create a GitLab account (free).

  2. Establish a new private repository (free).

  3. Navigate to the 'Git repositories' tab in the plugin settings and follow the provided instructions to add the new repository.

3. How to add (push) items to a library

Once you've added a Git repository in the settings, you can 'push' any Layout or Post Selection to the repository. Simply edit the Layout or Post Selection, select the repository from the 'GitLab repositories' box (located in the right panel), and click 'Push'.

If you select the 'Include related Meta groups' checkbox, the component will also store data of the associated Meta Groups (such as ACF Group) and automatically import them during 'pulling'.

Note: When you 'push' a Layout or Post Selection, all related Layouts will be included automatically. Therefore, pushing a Post Selection will also push the corresponding Layout.

4. How to import (pull) items from a library

Once you've added a Git repository in the settings, you can 'pull' any Layout or Post Selection from the repository to the current website.

In the items list table header (Layouts or Post Selections), you'll notice a new tab named after your repository. Click on it to see the list of available items. You can then 'import' individual items or perform bulk imports.

Overriding existing items

If you import items that already exist on the website, then they will be overridden instead of creating duplicate entries.

Last updated