Skip to content

Commit

Permalink
Adding custom templates and template parts
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanbossenger committed Nov 11, 2022
1 parent 2ab48c8 commit 935b53f
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 59 deletions.
21 changes: 21 additions & 0 deletions parts/post-meta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- wp:group {"layout":{"inherit":true,"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:group {"layout":{"type":"flex"}} -->
<div class="wp-block-group"><!-- wp:post-date {"format":"F j, Y"} /-->

<!-- wp:post-author {"showAvatar":false} /-->

<!-- wp:post-terms {"term":"category"} /-->

<!-- wp:post-terms {"term":"post_tag"} /--></div>
<!-- /wp:group -->

<!-- wp:spacer {"height":"var(--wp--preset--spacing--30)"} -->
<div style="height:var(--wp--preset--spacing--30)" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:separator {"opacity":"css","className":"is-style-wide"} -->
<hr class="wp-block-separator has-css-opacity is-style-wide"/>
<!-- /wp:separator -->

<!-- wp:comments {"legacy":true} /--></div>
<!-- /wp:group -->
19 changes: 19 additions & 0 deletions templates/page-alternative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->

<!-- wp:group {"tagName":"main"} -->
<main class="wp-block-group"><!-- wp:group {"layout":{"inherit":true,"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:post-title {"level":1,"align":"wide"} /-->

<!-- wp:separator {"opacity":"css","className":"alignwide is-style-wide"} -->
<hr class="wp-block-separator has-css-opacity alignwide is-style-wide"/>
<!-- /wp:separator --></div>
<!-- /wp:group -->

<!-- wp:spacer {"height":"var(--wp--preset--spacing--30)"} -->
<div style="height:var(--wp--preset--spacing--30)" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:post-content {"layout":{"inherit":true}} /--></main>
<!-- /wp:group -->

<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->
19 changes: 19 additions & 0 deletions templates/post-alternative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->

<!-- wp:group {"tagName":"main"} -->
<main class="wp-block-group"><!-- wp:group {"layout":{"inherit":true,"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:post-title {"level":1,"align":"wide"} /-->

<!-- wp:separator {"opacity":"css","className":"alignwide is-style-wide"} -->
<hr class="wp-block-separator has-css-opacity alignwide is-style-wide"/>
<!-- /wp:separator --></div>
<!-- /wp:group -->

<!-- wp:spacer {"height":"var(--wp--preset--spacing--30)"} -->
<div style="height:var(--wp--preset--spacing--30)" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:post-content {"layout":{"inherit":true}} /--></main>
<!-- /wp:group -->

<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->
148 changes: 89 additions & 59 deletions theme.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 2,

"customTemplates": [
{
"name": "page-alternative",
"postTypes": [
"page"
],
"title": "Page Alternative"
}
],

"customTemplates": [
{
"name": "blank",
Expand All @@ -16,6 +25,20 @@
"page"
],
"title": "404"
},
{
"name": "page-alternative",
"postTypes": [
"page"
],
"title": "Page (Alternative)"
},
{
"name": "post-alternative",
"postTypes": [
"post"
],
"title": "Post (Alternative)"
}
],
"settings": {
Expand Down Expand Up @@ -55,10 +78,10 @@
},
"spacing": {
"spacingScale": {
"operator": "+",
"increment": 0.5,
"steps": 9,
"mediumStep": 1.5,
"operator": "+",
"steps": 9,
"unit": "rem"
},
"units": [
Expand Down Expand Up @@ -110,12 +133,12 @@
"core/navigation": {
"elements": {
"link": {
":hover": {
":focus": {
"typography": {
"textDecoration": "underline"
}
},
":focus": {
":hover": {
"typography": {
"textDecoration": "underline"
}
Expand All @@ -132,38 +155,38 @@
"fontStyle": "italic"
}
},
"core/post-content": {
"elements": {
"link": {
"color": {
"text": "var(--wp--preset--color--secondary)"
}
}
}
},
"core/post-comments": {
"spacing": {
"padding": {
"top": "var(--wp--preset--spacing--30)"
}
}
},
"core/post-excerpt": {
"typography": {
"fontSize": "var(--wp--preset--font-size--small)"
"core/post-content": {
"elements": {
"link": {
"color": {
"text": "var(--wp--preset--color--secondary)"
}
}
}
},
"core/post-date": {
"typography": {
"fontSize": "var(--wp--preset--font-size--small)",
"fontWeight": "400"
},
"elements": {
"link": {
"typography": {
"textDecoration": "none"
}
}
},
"typography": {
"fontSize": "var(--wp--preset--font-size--small)",
"fontWeight": "400"
}
},
"core/post-excerpt": {
"typography": {
"fontSize": "var(--wp--preset--font-size--small)"
}
},
"core/post-terms": {
Expand All @@ -173,16 +196,16 @@
}
},
"core/post-title": {
"typography": {
"fontSize": "var(--wp--preset--font-size--large)",
"fontWeight": "400"
},
"elements": {
"link": {
"typography": {
"textDecoration": "none"
}
}
},
"typography": {
"fontSize": "var(--wp--preset--font-size--large)",
"fontWeight": "400"
}
},
"core/pullquote": {
Expand All @@ -191,15 +214,15 @@
}
},
"core/query-pagination": {
"typography": {
"fontSize": "var(--wp--preset--font-size--small)"
},
"elements": {
"link": {
"typography": {
"textDecoration": "none"
}
}
},
"typography": {
"fontSize": "var(--wp--preset--font-size--small)"
}
},
"core/quote": {
Expand All @@ -210,18 +233,18 @@
"core/site-title": {
"elements": {
"link": {
"typography": {
"textDecoration": "none"
},
":hover": {
":focus": {
"typography": {
"textDecoration": "underline"
}
},
":focus": {
":hover": {
"typography": {
"textDecoration": "underline"
}
},
"typography": {
"textDecoration": "none"
}
}
},
Expand All @@ -239,19 +262,9 @@
},
"elements": {
"button": {
"border": {
"radius": "0"
},
"color": {
"background": "var(--wp--preset--color--primary)",
"text": "var(--wp--preset--color--contrast)"
},
"typography": {
"fontSize": "var(--wp--preset--font-size--medium)"
},
":hover": {
":active": {
"color": {
"background": "var(--wp--preset--color--contrast)",
"background": "var(--wp--preset--color--secondary)",
"text": "var(--wp--preset--color--base)"
}
},
Expand All @@ -261,11 +274,21 @@
"text": "var(--wp--preset--color--base)"
}
},
":active": {
":hover": {
"color": {
"background": "var(--wp--preset--color--secondary)",
"background": "var(--wp--preset--color--contrast)",
"text": "var(--wp--preset--color--base)"
}
},
"border": {
"radius": "0"
},
"color": {
"background": "var(--wp--preset--color--primary)",
"text": "var(--wp--preset--color--contrast)"
},
"typography": {
"fontSize": "var(--wp--preset--font-size--medium)"
}
},
"h1": {
Expand Down Expand Up @@ -316,28 +339,28 @@
}
},
"link": {
"color": {
"text": "var(--wp--preset--color--contrast)"
":active": {
"typography": {
"textDecoration": "none"
}
},
":hover": {
"typography": {
"textDecoration": "underline dashed"
}
},
":active": {
"typography": {
"textDecoration": "none"
}
"color": {
"text": "var(--wp--preset--color--contrast)"
}
}
},
"spacing": {
"blockGap": "1.5rem",
"padding": {
"top": "0px",
"right": "var(--wp--preset--spacing--30)",
"bottom": "0px",
"left": "var(--wp--preset--spacing--30)"
"left": "var(--wp--preset--spacing--30)",
"right": "var(--wp--preset--spacing--30)",
"top": "0px"
}
},
"typography": {
Expand All @@ -356,6 +379,13 @@
"area": "footer",
"name": "footer",
"title": "Footer"
},
{
"area": "general",
"name": "post-meta",
"title": "Post Meta"
}
]
}
],
"version": 2,
"$schema": "https://schemas.wp.org/wp/6.1/theme.json"
}

0 comments on commit 935b53f

Please sign in to comment.