-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from bcgov/feature/descw-2510-Add-documentation…
…-for-header-template- added patterns docs
- Loading branch information
Showing
2 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Patterns | ||
|
||
## Template Parts | ||
### How to Add a Template Part by Category | ||
|
||
To add a template part, create an `.html` file in the `parts` folder that represents your template part. For example, let's create a header template part called `header-site-title.html`. | ||
|
||
#### Getting Started with a Template Part | ||
|
||
##### Step 1: Create the Look and Layout | ||
Create the look and layout you want inside a group block. | ||
|
||
##### Step 2: Copy the Code | ||
Switch to code view and copy the code to your clipboard. | ||
|
||
##### Step 3: Paste the Code | ||
Paste the code into your `.html` file. | ||
|
||
#### Alternative Source of Starter Template Parts | ||
|
||
You can also use the WordPress pattern directory as a source of starter template parts: https://wordpress.org/patterns/ | ||
|
||
#### Registering the Template Part | ||
|
||
Once the code is added to your template part `.html` file, edit the `theme.json` file to register the template part. | ||
|
||
### Example: Adding a Header Template Part | ||
|
||
Here's an example of how to add multiple headers to the header category of the template parts for the site editor: | ||
|
||
```json | ||
"templateParts": [ | ||
{ | ||
"name": "header-no-site-title", | ||
"title": "Header No Site Title", | ||
"area": "header" | ||
}, | ||
{ | ||
"name": "header-site-title", | ||
"title": "Header Site Title", | ||
"area": "header" | ||
}, | ||
] |