This project provides a structured way to manage Elementor page data downloaded from a WordPress site, facilitating offline editing and updating. This project also includes the corresponding cursor rules for the project.
pages/: Stores the raw page configurations downloaded from WordPress. These files contain the full page data, including metadata like page ID and title.elementor/: Contains the extracted and formatted Elementor configuration data. This is where you should make edits to the Elementor layouts.compress/: Holds the compressed Elementor data, ready for uploading back to WordPress.
All configuration files in these folders are named using the page slug and have a .json extension (e.g., home.json).
Two Node.js helper scripts are provided for managing Elementor data:
-
extract_elementor.js- Purpose: Extracts and formats the Elementor data from raw page configuration files in
pages/and saves it to theelementor/folder. - Usage:
node extract_elementor.js [optional_arg] optional_arg:- Not provided: Extracts data from all files in
pages/and writes them toelementor/. skipExisting: Extracts data only for pages inpages/that do not already have a corresponding file inelementor/.<filename.json>(e.g.,home.json): Extracts data only from the specified file inpages/toelementor/.
- Not provided: Extracts data from all files in
- When to use: Run this script after downloading or fetching new page data into the
pages/folder to prepare the Elementor data for editing.
- Purpose: Extracts and formats the Elementor data from raw page configuration files in
-
compress_elementor.js- Purpose: Compresses the edited Elementor data from the
elementor/folder into thecompress/folder, preparing it for upload. - Usage:
node compress_elementor.js [optional_arg] optional_arg:- Not provided: Compresses all files in
elementor/and writes them tocompress/. skipExisting: Compresses only the files inelementor/that do not already exist incompress/.<filename.json>(e.g.,home.json): Compresses only the specified file fromelementor/tocompress/.
- Not provided: Compresses all files in
- When to use: Run this script after making changes to files in the
elementor/folder and before updating the page on the WordPress site.
- Purpose: Compresses the edited Elementor data from the
- Fetch/Download: Obtain the page data from WordPress and save the full JSON configuration into the
pages/folder (e.g.,pages/about-us.json). - Extract: Run
node extract_elementor.js [page-slug.json]to extract the Elementor-specific data into theelementor/folder (e.g.,elementor/about-us.json). - Edit: Modify the Elementor JSON data within the corresponding file in the
elementor/directory. - Compress: Run
node compress_elementor.js [page-slug.json]to generate the compressed version of your changes in thecompress/folder (e.g.,compress/about-us.json). - Update: Use the appropriate tool or method to upload the compressed Elementor data from the file in
compress/back to the WordPress page. The corresponding file inpages/can be used to retrieve necessary metadata like thepageIdfor the update operation.