How to Create a Style Kit
This guide is intended to help novices and pros alike, but assumes you know a little CSS. It offers best practices advice aimed at Style Kits intended for sale or client projects with regard to format and naming conventions. If you’re just getting started with using CSS to customize WordPress sites, see How to Customize Your Site with CSS Style Kits are comprised of three main parts:
- Page builder layouts and their widget’s settings
- Custom CSS code
- The content (XML)
We recommend starting on a fresh WordPress install with no pre-existing content. We also recommend setting up your demo on a live server before doing the export so others can reference what the intended outcome should be, and images come over in the content import without additional tweaking or manual upload.
Creating Page Builder Presets
- Build your pages starting with a blank page. When designing for the general public, only Layers widgets should be used, as 3rd Party widget data is not saved by our export function.
- Add custom styling that is specific to the widget or page layout using the Advanced option of the widget Design Bar.
- On the Page Editor view in your admin, ensure the page’s Title and Slug match and clearly describe the kind of layout it is. Example: Portfolio, Features, Team Members, etc.
- Export the page
See How to Export Page Builder Layouts
Build Your Custom CSS
The following will help you decide where to best place custom styling and if the Advanced option in the widget should be used vs the main CSS area.
See All Layers Customization Tutorials
Advanced Widget CSS
The benefit of using this method is that custom classes and styles added to the Advanced options in widget setups are saved along with the other data when exporting a page file. This makes importing the styling aspect a little more foolproof. See our Advanced Custom CSS Tutorial for a detailed walkthrough of using this feature to customize your presets.
Our example kit uses advanced techniques covered in the Advanced Tutorial to replace the large button in widgets with an app store image hosted on the app providers websites. Additionally, it adds some global CSS to the main CSS area which is not saved in the page export. Custom CSS added to the main CSS area is not associated with any one page, so needs manual export and import, explained next.
Custom CSS is used to add global custom styling to the CSS tab under the main Customizer menu if you need to provide additional styling changes. When building your custom CSS, keep the following in mind:
- Never copy entire styles from the inspector or core stylesheets – your declarations should contain only changed properties and new additions.
- Use waterfall formatting to make it easier to read and edit.
- Lint your CSS before finalizing it and saving it to your kit.
- If your custom css is really extensive, it may be time to consider a child theme. Style kit CSS should be as simple as possible and focused on basic styling changes like colors or element styles. It should not contain advanced CSS like transforms, layout hacks or hard-coded font sizing that might interfere with the user’s font or widget choices in the normal Layers options.
To prepare your Custom CSS for your kit, simply copy it into a plan-text document named css.txt. Mac Users, hit Shift+Cmd+T in TextEdit to switch to plain-text mode.
View the example kit css.txt file
Export WordPress Content
Including a content XML is an important step in ensuring the base pages used for your presets and the images used in the widgets can be easily imported by the user. Before exporting your content, check the following:
- There are no tags under →
- If your content includes demo posts, ensure any categories you created are relevant to your kit, otherwise create only one, such as “Demo”. This makes customization and cleanup of the content easier for end-users and reduces the risk of having a duplicate category with a bad slug.
- Pages other than Layers builder pages should not use “Home”, “Portfolio”, “Shop” or “Blog” as the page title.
- Empty the trash on your posts and page indexes
- Remove all comments
- Ensure all plugins are deactivated to avoid import of CPT data, etc
Export the content from→ and name the file your_kit-content.xml where your_kit is your kit name. Example: kittn-content.xml
Create the Readme
Your readme should include general information about you as the author, a link to the demo, if one exists, and some basic instructions for use. You may copy the demo kit’s readme and customize it for your kit, if desired.
If you will be hosting your kit on GitHub, don’t forget to add a readme.md file.
Pack It Up
Your kit should use a simple structure like this one:
- Test the import process on a live server to ensure everything works!
- Re-export all the data if your original files were staged locally. This ensures others can import images without uploading them manually.
- Zip the folder and name it kitname_layers-style-kit.zip where kitname is your Style Kit name.
Go through How to Import a Style Kit to verify your Style kit works as expected on a fresh install.
Did you know?
Our friends at Jetpack are doing some incredible work to improve the WordPress experience. Check out Jetpack and improve your site's security, speed and reliability.