Importing and Exporting Twigs
To speed up working with Twig Templates, the templates are not stored in the databases, but as a file on in your uploads directory. Not only does this save a query to the database, but it also enables you to copy your twigs over to another setup quickly.
You can also export your Twig Templates using the default WP exporter, which means they are portable to another setup with the importer too.
Both methods require an extra step though. The options are available on the "Settings > Toolbox > Tools" option-panel in your Dashboard.
Scenario 1: You have copied the physical .twig files using FTP into the "uploads/toolbox_twigs/" directory.
In your new installation you are now able to import and include the twig files. However, you are unable to edit them from the dashboard. You will need to "Import Twig Files to Posts". For each new Twig File that it finds it will create a new post, using the filename as the title and slug.
Scenario 2: You have imported the Post Type Twig Templates from an export-file
This means there appear to be Twig Templates, but they are not yet synced to the server. To create the actual files for quicker access, you need to "Export Twig Posts to Files". Toolbox will go over the Posts and export the necessary files.
In this section:
- Timber and Twig introduction
- Installing and activating Timber-library
- Module variables for Twig
- Writing templates for fields
- Getting field information and dealing with errors
- Useful Twig parameters
- Useful Timber, Twig Functions and Filters
- Importing and Exporting Twigs
- Custom Timber Posts Alias Modules
- Useful docs on Timber and Twig