WordPress block themes may feel confusing until you get used to them.
As you get used to the operation and understand how to use it, and if there are improvements in version upgrades, I think you will be able to make full use of the convenience of full site editing.
Backups are important for both WordPress and any other CMS.
Here are some points to pay special attention to when using block themes, as well as tools such as backup methods and plug-ins.
Backing up theme templates and template parts
Where block themes really come in handy is when you use the editor, where you can edit as you see it in the visual editor.
The editor can be used from the “Appearance” – “Editor” menu .
In addition to block editing, the editor can also be edited using the code editor from the upper right menu.
In the editor, you can edit and customize the template of the theme you are using and the template parts for your own site.
However, the caveat is that in conclusion, whether you use the visual editor or the code editor , simply updating and saving a template or template part using the editor will not change the actual template or part. The file is not updated .
The reason why the design is updated is that it is saved in the database on the server , just like the content of the article .
Downloading and saving a theme via FTP does not mean that you have backed up the latest version. If you make a mistake here, you may end up in a terrible situation.
There is a method of exporting in zip format to reflect the contents updated in the theme editor to the theme template itself .
You can download it from the “Export” menu on the top right of the editor , or you can use the plugin “Create Block Theme” and download it as a zip file of the theme in the export menu .
However, depending on the server environment, you may not be able to use the export menu, such as a message that the exported zip file is invalid and cannot be opened.
If it’s a theme editor in tools, the file is actually updated and saved
There is a way to open the code editor and copy the code edited with the theme editor , open the template or template part from the “Tools” – “Theme file editor” menu , and paste and update .
In the case of this method, the updated contents can be saved by updating the html files of templates and template parts.
Templates and template parts html files that reflect the latest updates can be effectively used as backups by downloading them via FTP .
The same applies to plug-in files edited with “Tools” – “Plug-in File Editor”.
With these methods, you can edit files such as templates, programs, and css directly, so be careful not to make a mistake.
Create Block Theme” is a plugin that can back up templates and template parts
But there is an easier way.
If you install the “Create Block Theme” plugin , check “Overwrite (theme name)” and press the “Generate” button , the latest theme edits will be reflected in the actual template.
Even with this plugin, exporting may not be successful depending on the server environment, but it is convenient because the latest edits can be saved in no time.
However, there is still a caveat.
If you made a mistake while editing in the editor, backing up the latest update may result in the wrong editing result being updated and saved.
For example, there are points to note when updating template parts as described below.
Precautions for updating template parts
There are also points to be aware of when editing template parts.
The same is true when editing template parts (headers, etc.) using the editor on each page, such as Front-page and Single-page.
After creating a template part, if you want to reuse the template part on other pages and edit its contents according to the page, you must always follow the procedure to “separate the part to be edited from the template part ” .
There is no problem if it is a template part common to each page like the header.
However, you need to be careful when reusing template parts used on other pages when you want to have different content for each page.
If you edit the part without “separating from the template part “, the changes will be reflected in the same template part used on other pages.
Backup of posts, images, etc.
Posts, individual articles, images, categories and other data for the entire site content can be exported using the plugin.
It is a good idea to back up the entire server database for user information, customized theme templates, parts, and information such as designs customized from the UI of the editor.
The official WordPress plugin “WordPress Importer” is useful for backing up content such as posts and images .
With a simple operation, you can immediately back up the content of your site as an xml file.
To export using the plugin “WordPress Importer” , install and activate the plugin.
Execute it from the “Tools” – “Export” screen and save the downloaded xml file .
The exported xml file can be imported from the “Import” menu .
Widgets have been used in WordPress, especially in classic themes, as a tool for easily inserting blocks of content in footers, sidebars, etc.
After becoming a block theme, it can be used from the “Appearance” – “Widgets” menu .
However, block themes may not be used very much because they can be laid out freely in the editor, and because the templates are html files instead of php files, it is difficult to insert content from widgets into html.
” FullSite-Patterner ” focuses on the fact that the content entered and saved in the widget menu can be read in a php file , and is used for the following functions.
・A function to save and insert tags, codes, etc. to be inserted in the head of the page as a widget, which is difficult to achieve with the default function of the block theme.
・A function to set and reflect the style customization by the user, which is difficult to achieve with the default function of the block theme, but is difficult with the editor UI and theme.json.
・Original pattern creation feature that allows you to create your own block patterns by entering html code or inserting blocks into widgets, saving them as widgets, and inserting them into pattern files in the pattern folder.
The data entered in the widget is stored in the server’s database.
The plug-in “Widget Importer & Exporter” is useful for backing up the data of this widget .
To export, click the Export Widget button to download and save as a .wie file .
When importing backed up widget data, click the “Import Widget” button in the plug-in “Widget Importer & Exporter” to upload it.
Depending on the server environment, an error message may appear and upload may not be successful.
However, in this case, you can import by copying the entire contents of the .wie file and entering it from the “Copy and paste the contents of the .wie file” menu.