From 67c028359d2bf4237542d2539080a12b90870e58 Mon Sep 17 00:00:00 2001 From: Maggie Date: Mon, 14 Mar 2022 17:47:06 +0100 Subject: [PATCH 01/13] first commit with initial files --- block-canvas/index.php | 2 ++ block-canvas/patterns/hidden-404.php | 15 ++++++++++++++ block-canvas/style.css | 29 ++++++++++++++++++++++++++++ block-canvas/templates/404.html | 10 ++++++++++ block-canvas/theme.json | 22 +++++++++++++++++++++ 5 files changed, 78 insertions(+) create mode 100644 block-canvas/index.php create mode 100644 block-canvas/patterns/hidden-404.php create mode 100644 block-canvas/style.css create mode 100644 block-canvas/templates/404.html create mode 100644 block-canvas/theme.json diff --git a/block-canvas/index.php b/block-canvas/index.php new file mode 100644 index 0000000000..b5b023f16c --- /dev/null +++ b/block-canvas/index.php @@ -0,0 +1,2 @@ + + + +

+ + + +

+ diff --git a/block-canvas/style.css b/block-canvas/style.css new file mode 100644 index 0000000000..a94a8fe1fc --- /dev/null +++ b/block-canvas/style.css @@ -0,0 +1,29 @@ +/* +Theme Name: Block canvas +Theme URI: https://github.com/Automattic/themes/tree/trunk/block-canvas +Author: Automattic +Author URI: https://automattic.com/ +Description: Block canvas is a simple theme that supports full-site editing. It comes with a set of minimal templates and design settings that can be manipulated through Global Styles. Use it to build something beautiful. +Requires at least: 5.7 +Tested up to: 5.9 +Requires PHP: 5.7 +Version: 0.0.1 +License: GNU General Public License v2 or later +License URI: http://www.gnu.org/licenses/gpl-2.0.html +Text Domain: block-canvas +Tags: one-column, custom-colors, custom-menu, custom-logo, editor-style, featured-images, full-site-editing, block-patterns, rtl-language-support, theme-options, threaded-comments, translation-ready, wide-blocks, auto-loading-homepage + +Block canvas WordPress Theme, (C) 2021 Automattic, Inc. +Block canvas is distributed under the terms of the GNU GPL. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +*/ diff --git a/block-canvas/templates/404.html b/block-canvas/templates/404.html new file mode 100644 index 0000000000..b1de407d48 --- /dev/null +++ b/block-canvas/templates/404.html @@ -0,0 +1,10 @@ + + + +
+ + +
+ + + diff --git a/block-canvas/theme.json b/block-canvas/theme.json new file mode 100644 index 0000000000..0c8a197053 --- /dev/null +++ b/block-canvas/theme.json @@ -0,0 +1,22 @@ +{ + "version": 1, + "settings": { + "color": { + "gradients": [], + "link": true, + "palette": [] + }, + "spacing": { + "customPadding": true + }, + "typography": { + "customLineHeight": true, + "fontFamilies": [], + "fontSizes": [] + }, + "layout": { + "contentSize": "840px", + "wideSize": "1100px" + } + } +} From 77dcbee99822e4408b3dea33d587a1e7fc3cbb7d Mon Sep 17 00:00:00 2001 From: Maggie Date: Mon, 14 Mar 2022 18:08:57 +0100 Subject: [PATCH 02/13] templates --- block-canvas/parts/footer.html | 11 +++++ block-canvas/parts/header.html | 29 ++++++++++++ block-canvas/parts/post-meta.html | 8 ++++ .../patterns/{hidden-404.php => 404.php} | 0 block-canvas/templates/404.html | 10 +++- block-canvas/templates/archive.html | 33 +++++++++++++ block-canvas/templates/blank.html | 1 + block-canvas/templates/footer-only.html | 3 ++ .../templates/header-footer-only.html | 10 ++++ block-canvas/templates/index.html | 33 +++++++++++++ block-canvas/templates/page.html | 27 +++++++++++ block-canvas/templates/search.html | 47 +++++++++++++++++++ block-canvas/templates/single.html | 28 +++++++++++ 13 files changed, 239 insertions(+), 1 deletion(-) create mode 100644 block-canvas/parts/footer.html create mode 100644 block-canvas/parts/header.html create mode 100644 block-canvas/parts/post-meta.html rename block-canvas/patterns/{hidden-404.php => 404.php} (100%) create mode 100644 block-canvas/templates/archive.html create mode 100644 block-canvas/templates/blank.html create mode 100644 block-canvas/templates/footer-only.html create mode 100644 block-canvas/templates/header-footer-only.html create mode 100644 block-canvas/templates/index.html create mode 100644 block-canvas/templates/page.html create mode 100644 block-canvas/templates/search.html create mode 100644 block-canvas/templates/single.html diff --git a/block-canvas/parts/footer.html b/block-canvas/parts/footer.html new file mode 100644 index 0000000000..6524af7242 --- /dev/null +++ b/block-canvas/parts/footer.html @@ -0,0 +1,11 @@ + +
+ +
+ +

Proudly Powered by WordPress

+ +
+ +
+ \ No newline at end of file diff --git a/block-canvas/parts/header.html b/block-canvas/parts/header.html new file mode 100644 index 0000000000..5b34a3f9db --- /dev/null +++ b/block-canvas/parts/header.html @@ -0,0 +1,29 @@ + +
+ + + + +
+ + + + + diff --git a/block-canvas/parts/post-meta.html b/block-canvas/parts/post-meta.html new file mode 100644 index 0000000000..bf00c30600 --- /dev/null +++ b/block-canvas/parts/post-meta.html @@ -0,0 +1,8 @@ + +
+ + + + +
+ \ No newline at end of file diff --git a/block-canvas/patterns/hidden-404.php b/block-canvas/patterns/404.php similarity index 100% rename from block-canvas/patterns/hidden-404.php rename to block-canvas/patterns/404.php diff --git a/block-canvas/templates/404.html b/block-canvas/templates/404.html index b1de407d48..4d12bb257c 100644 --- a/block-canvas/templates/404.html +++ b/block-canvas/templates/404.html @@ -2,7 +2,15 @@
- + + +

Oops! That page can’t be found.

+ + + +

It looks like nothing was found at this location. Maybe try a search?

+ +
diff --git a/block-canvas/templates/archive.html b/block-canvas/templates/archive.html new file mode 100644 index 0000000000..097b15cbaa --- /dev/null +++ b/block-canvas/templates/archive.html @@ -0,0 +1,33 @@ + + + +
+ + + +
+ + + + + + + +
+ + + +
+ + + + + + + +
+ +
+ + + diff --git a/block-canvas/templates/blank.html b/block-canvas/templates/blank.html new file mode 100644 index 0000000000..120094756e --- /dev/null +++ b/block-canvas/templates/blank.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/block-canvas/templates/footer-only.html b/block-canvas/templates/footer-only.html new file mode 100644 index 0000000000..6e42f28a78 --- /dev/null +++ b/block-canvas/templates/footer-only.html @@ -0,0 +1,3 @@ + + + diff --git a/block-canvas/templates/header-footer-only.html b/block-canvas/templates/header-footer-only.html new file mode 100644 index 0000000000..376b9c3bff --- /dev/null +++ b/block-canvas/templates/header-footer-only.html @@ -0,0 +1,10 @@ + + + +
+ + +
+ + + diff --git a/block-canvas/templates/index.html b/block-canvas/templates/index.html new file mode 100644 index 0000000000..82523e613d --- /dev/null +++ b/block-canvas/templates/index.html @@ -0,0 +1,33 @@ + + + +
+ + +
+ + + + + + + +
+ + + +
+ + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/block-canvas/templates/page.html b/block-canvas/templates/page.html new file mode 100644 index 0000000000..c77fec86e7 --- /dev/null +++ b/block-canvas/templates/page.html @@ -0,0 +1,27 @@ + + + + +
+ +
+ + + +
+ + + +
+ + + +
+ + + + +
+ + + diff --git a/block-canvas/templates/search.html b/block-canvas/templates/search.html new file mode 100644 index 0000000000..29fe3fcb3e --- /dev/null +++ b/block-canvas/templates/search.html @@ -0,0 +1,47 @@ + + + +
+ + + + + +
+ + + +
+ + +
+ + + + + + + + + + + +
+ + + + +
+ + + + + + + +
+ +
+ + + \ No newline at end of file diff --git a/block-canvas/templates/single.html b/block-canvas/templates/single.html new file mode 100644 index 0000000000..12bdb1dd19 --- /dev/null +++ b/block-canvas/templates/single.html @@ -0,0 +1,28 @@ + + + +
+ +
+ + + +
+ + + + + +
+ + + +
+ + + + +
+ + + From c45d13449dd23a77a568f4c2335040fa7c16873a Mon Sep 17 00:00:00 2001 From: Maggie Date: Mon, 14 Mar 2022 18:33:01 +0100 Subject: [PATCH 03/13] styles --- block-canvas/functions.php | 61 ++++++ block-canvas/style.css | 133 ++++++++++++ block-canvas/theme.json | 406 ++++++++++++++++++++++++++++++++++++- 3 files changed, 590 insertions(+), 10 deletions(-) create mode 100644 block-canvas/functions.php diff --git a/block-canvas/functions.php b/block-canvas/functions.php new file mode 100644 index 0000000000..dce13e7208 --- /dev/null +++ b/block-canvas/functions.php @@ -0,0 +1,61 @@ +get( 'Version' ) + ); + + // Enqueue theme stylesheet. + wp_enqueue_style( 'block_canvas-style' ); + + } + +endif; + +add_action( 'wp_enqueue_scripts', 'block_canvas_styles' ); diff --git a/block-canvas/style.css b/block-canvas/style.css index a94a8fe1fc..2c9c651ac0 100644 --- a/block-canvas/style.css +++ b/block-canvas/style.css @@ -27,3 +27,136 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ + +/* +Theme Name: Archeo +Theme URI: https://github.com/Automattic/themes/tree/trunk/archeo +Author: Automattic +Author URI: https://automattic.com +Description: A clean portfolio theme +Requires at least: 5.8 +Tested up to: 5.9 +Requires PHP: 5.7 +Version: 0.0.11 +License: GNU General Public License v2 or later +License URI: http://www.gnu.org/licenses/gpl-2.0.html +Text Domain: archeo +Tags: one-column, custom-colors, custom-menu, custom-logo, editor-style, featured-images, full-site-editing, block-patterns, rtl-language-support, theme-options, threaded-comments, translation-ready, wide-blocks + +Archeo WordPress Theme, (C) 2022 Automattic, Inc. +Archeo is distributed under the terms of the GNU GPL. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +*/ + +/* + * Font smoothing + */ + + body { + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; +} + +/* + * Button hover styles. + * Necessary until the following issue is resolved in Gutenberg: + * https://github.com/WordPress/gutenberg/issues/27075 + */ + +.wp-block-search__button:hover, +.wp-block-file .wp-block-file__button:hover, +.wp-block-button__link:hover { + background-color: var(--wp--preset--color--primary); +} + +/* + * Search and File Block button styles. + * Necessary until the following issues are resolved in Gutenberg: + * https://github.com/WordPress/gutenberg/issues/36444 + * https://github.com/WordPress/gutenberg/issues/27760 + */ + +.wp-block-search__button, +.wp-block-file .wp-block-file__button { + background-color: var(--wp--preset--color--foreground); + border-radius: 0; + border: none; + color: var(--wp--preset--color--background); + font-size: var(--wp--preset--typography--font-size--normal); + padding: calc(0.667em + 2px) calc(1.333em + 2px); +} + +/* + * Alignment styles, borrowed from Twenty Twenty-Two. + * These rules are temporary, and should not be relied on or + * modified too heavily by themes or plugins that build on + * Twenty Twenty-Two. These are meant to be a precursor to + * a global solution provided by the Block Editor. + * + * Relevant issues: + * https://github.com/WordPress/gutenberg/issues/35607 + * https://github.com/WordPress/gutenberg/issues/35884 + */ + +.wp-site-blocks, +body > .is-root-container, +.edit-post-visual-editor__post-title-wrapper, +.wp-block-group.alignfull, +.wp-block-group.has-background, +.wp-block-columns.alignfull.has-background, +.wp-block-cover.alignfull, +.is-root-container .wp-block[data-align='full'] > .wp-block-group, +.is-root-container .wp-block[data-align='full'] > .wp-block-columns.has-background, +.is-root-container .wp-block[data-align='full'] > .wp-block-cover { + padding-left: var(--wp--custom--gap--horizontal); + padding-right: var(--wp--custom--gap--horizontal); +} + +.wp-site-blocks .alignfull, +.wp-site-blocks > .wp-block-group.has-background, +.wp-site-blocks > .wp-block-cover, +.wp-site-blocks > .wp-block-template-part > .wp-block-group.has-background, +.wp-site-blocks > .wp-block-template-part > .wp-block-cover, +body > .is-root-container > .wp-block-cover, +body > .is-root-container > .wp-block-template-part > .wp-block-group.has-background, +body > .is-root-container > .wp-block-template-part > .wp-block-cover, +.is-root-container .wp-block[data-align='full'] { + margin-left: calc(-1 * var(--wp--custom--gap--horizontal)) !important; + margin-right: calc(-1 * var(--wp--custom--gap--horizontal)) !important; + max-width: unset; + width: unset; +} + +/* Blocks inside columns don't have negative margins. */ +.wp-site-blocks .wp-block-columns .wp-block-column .alignfull, +.is-root-container .wp-block-columns .wp-block-column .wp-block[data-align="full"], +/* We also want to avoid stacking negative margins. */ +.wp-site-blocks .alignfull:not(.wp-block-group) .alignfull, +.is-root-container .wp-block[data-align="full"] > *:not(.wp-block-group) .wp-block[data-align="full"] { + margin-left: auto !important; + margin-right: auto !important; + width: inherit; +} + +/* + * Responsive menu container padding. + * This ensures the responsive container inherits the same + * spacing defined above. This behavior may be built into + * the Block Editor in the future. + */ + +.wp-block-navigation__responsive-container.is-menu-open { + padding-top: var(--wp--custom--gap--horizontal); + padding-bottom: var(--wp--custom--gap--vertical); + padding-right: var(--wp--custom--gap--horizontal); + padding-left: var(--wp--custom--gap--horizontal); +} diff --git a/block-canvas/theme.json b/block-canvas/theme.json index 0c8a197053..d1c16592a6 100644 --- a/block-canvas/theme.json +++ b/block-canvas/theme.json @@ -1,22 +1,408 @@ { - "version": 1, + "$schema": "https://schemas.wp.org/trunk/theme.json", + "version": 2, + "customTemplates": [ + { + "name": "blank", + "title": "Blank", + "postTypes": [ + "page", + "post" + ] + }, + { + "name": "header-footer-only", + "title": "Header and Footer Only", + "postTypes": [ + "page", + "post" + ] + }, + { + "name": "footer-only", + "title": "Footer Only", + "postTypes": [ + "page", + "post" + ] + } + ], "settings": { + "appearanceTools": true, "color": { - "gradients": [], - "link": true, - "palette": [] + "palette": [ + { + "slug": "primary", + "color": "#007cba", + "name": "Primary" + }, + { + "slug": "secondary", + "color": "#006ba1", + "name": "Secondary" + }, + { + "slug": "foreground", + "color": "#333333", + "name": "Foreground" + }, + { + "slug": "background", + "color": "#ffffff", + "name": "Background" + }, + { + "slug": "tertiary", + "color": "#F0F0F0", + "name": "Tertiary" + } + ] + }, + "custom": { + "button": { + "border": { + "color": "var(--wp--preset--color--primary)", + "radius": "4px", + "style": "solid", + "width": "2px" + }, + "color": { + "background": "var(--wp--preset--color--primary)", + "text": "var(--wp--preset--color--background)" + }, + "hover": { + "color": { + "text": "var(--wp--preset--color--background)", + "background": "var(--wp--preset--color--secondary)" + }, + "border": { + "color": "var(--wp--preset--color--secondary)" + } + }, + "spacing": { + "padding": { + "top": "0.667em", + "bottom": "0.667em", + "left": "1.333em", + "right": "1.333em" + } + }, + "typography": { + "fontSize": "var(--wp--custom--font-sizes--normal)", + "fontWeight": "normal", + "lineHeight": 2 + } + }, + "fontSizes": { + "x-small": "14px", + "normal": "18px" + }, + "gap": { + "baseline": "15px", + "horizontal": "min(30px, 5vw)", + "vertical": "min(30px, 5vw)" + }, + "heading": { + "typography": { + "fontWeight": 400, + "lineHeight": 1.125 + } + } }, "spacing": { - "customPadding": true + "units": [ + "%", + "px", + "em", + "rem", + "vh", + "vw" + ] }, "typography": { - "customLineHeight": true, - "fontFamilies": [], - "fontSizes": [] + "fontFamilies": [ + { + "fontFamily": "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif", + "fontSlug": "system-font", + "slug": "body-font", + "name": "Body (System Font)" + }, + { + "fontFamily": "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif", + "fontSlug": "system-font", + "slug": "heading-font", + "name": "Headings (System Font)" + } + ], + "fontSizes": [ + { + "name": "Small", + "size": "16px", + "slug": "small" + }, + { + "name": "Medium", + "size": "24px", + "slug": "medium" + }, + { + "name": "Large", + "size": "28px", + "slug": "large" + }, + { + "name": "Extra Large", + "size": "32px", + "slug": "x-large" + } + ] }, "layout": { - "contentSize": "840px", - "wideSize": "1100px" + "contentSize": "620px", + "wideSize": "1000px" + } + }, + "styles": { + "blocks": { + "core/button": { + "border": { + "radius": "var(--wp--custom--button--border--radius)" + }, + "color": { + "background": "var(--wp--custom--button--color--background)", + "text": "var(--wp--custom--button--color--text)" + }, + "typography": { + "fontFamily": "var(--wp--preset--font-family--body-font)", + "fontSize": "var(--wp--custom--button--typography--font-size)", + "fontWeight": "var(--wp--custom--button--typography--font-weight)", + "lineHeight": "var(--wp--custom--button--typography--line-height)" + } + }, + "core/code": { + "border": { + "color": "#CCCCCC", + "radius": "0px", + "style": "solid", + "width": "2px" + }, + "spacing": { + "padding": { + "left": "var(--wp--custom--gap--horizontal)", + "right": "var(--wp--custom--gap--horizontal)", + "top": "var(--wp--custom--gap--vertical)", + "bottom": "var(--wp--custom--gap--vertical)" + } + }, + "typography": { + "fontFamily": "monospace" + } + }, + "core/gallery": { + "spacing": { + "margin": { + "bottom": "var(--wp--custom--gap--vertical)" + } + } + }, + "core/list": { + "spacing": { + "padding": { + "left": "calc( 2 * var(--wp--custom--gap--horizontal) )" + } + } + }, + "core/navigation": { + "typography": { + "fontSize": "var(--wp--custom--font-sizes--normal)" + } + }, + "core/post-title": { + "spacing": { + "margin": { + "bottom": "0" + } + }, + "typography": { + "fontFamily": "var(--wp--preset--font-family--heading-font)", + "fontSize": "var(--wp--preset--font-size--large)", + "lineHeight": "1.125" + } + }, + "core/post-date": { + "color": { + "link": "var(--wp--preset--color--foreground)", + "text": "var(--wp--preset--color--foreground)" + }, + "typography": { + "fontSize": "var(--wp--preset--font-size--small)" + } + }, + "core/pullquote": { + "border": { + "style": "solid", + "width": "1px 0" + }, + "typography": { + "fontStyle": "italic", + "fontSize": "var(--wp--preset--font-size--large)" + }, + "spacing": { + "padding": { + "left": "var(--wp--custom--gap--horizontal)", + "right": "var(--wp--custom--gap--horizontal)", + "top": "var(--wp--custom--gap--horizontal)", + "bottom": "var(--wp--custom--gap--horizontal)" + } + } + }, + "core/search": { + "typography": { + "fontSize": "var(--wp--custom--button--typography--font-size)", + "lineHeight": "1.6" + } + }, + "core/separator": { + "color": { + "text": "var(--wp--preset--color--foreground)" + }, + "border": { + "color": "currentColor", + "style": "solid", + "width": "0 0 1px 0" + } + }, + "core/quote": { + "border": { + "color": "var(--wp--preset--color--primary)", + "style": "solid", + "width": "0 0 0 1px" + }, + "spacing": { + "padding": { + "left": "var(--wp--custom--gap--horizontal)" + } + }, + "typography": { + "fontSize": "var(--wp--custom--font-sizes--normal)", + "fontStyle": "normal" + } + }, + "core/site-tagline": { + "typography": { + "fontSize": "var(--wp--custom--font-sizes--x-small)" + } + }, + "core/site-title": { + "typography": { + "fontSize": "var(--wp--custom--font-sizes--normal)", + "fontWeight": "700", + "textDecoration": "none" + } + } + }, + "color": { + "background": "var(--wp--preset--color--background)", + "text": "var(--wp--preset--color--foreground)" + }, + "elements": { + "h1": { + "typography": { + "fontFamily": "var(--wp--preset--font-family--heading-font)", + "fontWeight": "var(--wp--custom--heading--typography--font-weight)", + "lineHeight": "var(--wp--custom--heading--typography--line-height)", + "fontSize": "48px" + }, + "spacing": { + "margin": { + "top": "var(--wp--custom--gap--vertical)", + "bottom": "var(--wp--custom--gap--vertical)" + } + } + }, + "h2": { + "typography": { + "fontFamily": "var(--wp--preset--font-family--heading-font)", + "fontWeight": "var(--wp--custom--heading--typography--font-weight)", + "lineHeight": "var(--wp--custom--heading--typography--line-height)", + "fontSize": "var(--wp--preset--font-size--x-large)" + }, + "spacing": { + "margin": { + "top": "var(--wp--custom--gap--vertical)", + "bottom": "var(--wp--custom--gap--vertical)" + } + } + }, + "h3": { + "typography": { + "fontFamily": "var(--wp--preset--font-family--heading-font)", + "fontWeight": "var(--wp--custom--heading--typography--font-weight)", + "lineHeight": "var(--wp--custom--heading--typography--line-height)", + "fontSize": "var(--wp--preset--font-size--large)" + }, + "spacing": { + "margin": { + "top": "var(--wp--custom--gap--vertical)", + "bottom": "var(--wp--custom--gap--vertical)" + } + } + }, + "h4": { + "typography": { + "fontFamily": "var(--wp--preset--font-family--heading-font)", + "fontWeight": "var(--wp--custom--heading--typography--font-weight)", + "lineHeight": "var(--wp--custom--heading--typography--line-height)", + "fontSize": "var(--wp--preset--font-size--medium)" + }, + "spacing": { + "margin": { + "top": "var(--wp--custom--gap--vertical)", + "bottom": "var(--wp--custom--gap--vertical)" + } + } + }, + "h5": { + "typography": { + "fontFamily": "var(--wp--preset--font-family--heading-font)", + "fontWeight": "var(--wp--custom--heading--typography--font-weight)", + "lineHeight": "var(--wp--custom--heading--typography--line-height)", + "fontSize": "var(--wp--custom--font-sizes--normal)" + }, + "spacing": { + "margin": { + "top": "var(--wp--custom--gap--vertical)", + "bottom": "var(--wp--custom--gap--vertical)" + } + } + }, + "h6": { + "typography": { + "fontFamily": "var(--wp--preset--font-family--heading-font)", + "fontWeight": "var(--wp--custom--heading--typography--font-weight)", + "lineHeight": "var(--wp--custom--heading--typography--line-height)", + "fontSize": "var(--wp--preset--font-size--small)" + }, + "spacing": { + "margin": { + "top": "var(--wp--custom--gap--vertical)", + "bottom": "var(--wp--custom--gap--vertical)" + } + } + }, + "link": { + "color": { + "text": "var(--wp--preset--color--primary)" + } + } + }, + "spacing": { + "blockGap": "calc(2 * var(--wp--custom--gap--baseline))" + }, + "typography": { + "lineHeight": "1.6", + "fontFamily": "var(--wp--preset--font-family--body-font)", + "fontSize": "var(--wp--custom--font-sizes--normal)" } } } From efebc430b506c5cd00ba68904154daaa09a6e1d4 Mon Sep 17 00:00:00 2001 From: Maggie Date: Mon, 14 Mar 2022 18:52:43 +0100 Subject: [PATCH 04/13] template parts --- block-canvas/theme.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/block-canvas/theme.json b/block-canvas/theme.json index d1c16592a6..aca89d6193 100644 --- a/block-canvas/theme.json +++ b/block-canvas/theme.json @@ -1,6 +1,16 @@ { "$schema": "https://schemas.wp.org/trunk/theme.json", "version": 2, + "templateParts": [ + { + "name": "header", + "area": "header" + }, + { + "name": "footer", + "area": "footer" + } + ], "customTemplates": [ { "name": "blank", From 3bf222aa2fd42b7fa50ff6ecfb32671f9e884ae7 Mon Sep 17 00:00:00 2001 From: Jason Crist Date: Tue, 15 Mar 2022 11:26:39 -0400 Subject: [PATCH 05/13] Removed errant metadata --- block-canvas/style.css | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/block-canvas/style.css b/block-canvas/style.css index 2c9c651ac0..f858b0359c 100644 --- a/block-canvas/style.css +++ b/block-canvas/style.css @@ -1,5 +1,5 @@ /* -Theme Name: Block canvas +Theme Name: Block Canvas Theme URI: https://github.com/Automattic/themes/tree/trunk/block-canvas Author: Automattic Author URI: https://automattic.com/ @@ -28,35 +28,6 @@ GNU General Public License for more details. */ -/* -Theme Name: Archeo -Theme URI: https://github.com/Automattic/themes/tree/trunk/archeo -Author: Automattic -Author URI: https://automattic.com -Description: A clean portfolio theme -Requires at least: 5.8 -Tested up to: 5.9 -Requires PHP: 5.7 -Version: 0.0.11 -License: GNU General Public License v2 or later -License URI: http://www.gnu.org/licenses/gpl-2.0.html -Text Domain: archeo -Tags: one-column, custom-colors, custom-menu, custom-logo, editor-style, featured-images, full-site-editing, block-patterns, rtl-language-support, theme-options, threaded-comments, translation-ready, wide-blocks - -Archeo WordPress Theme, (C) 2022 Automattic, Inc. -Archeo is distributed under the terms of the GNU GPL. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. -*/ - /* * Font smoothing */ From 1036011ff216280a8ffe806216990b92fe009c3e Mon Sep 17 00:00:00 2001 From: Jason Crist Date: Tue, 15 Mar 2022 11:38:01 -0400 Subject: [PATCH 06/13] Added create tool To use `php create.php` and answer the prompts. This will create a folder alongside this theme with the provided metadata as well as namespaced attributes refactored. --- block-canvas/create.php | 231 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 block-canvas/create.php diff --git a/block-canvas/create.php b/block-canvas/create.php new file mode 100644 index 0000000000..8464e72808 --- /dev/null +++ b/block-canvas/create.php @@ -0,0 +1,231 @@ +theme = array( + 'name' => $this->old_themename, + 'slug' => $this->old_themeslug, + 'uri' => 'https://github.com/wordpress/theme-experiments/', + 'author' => 'Kjell Reigstad', + 'description' => 'The base for a block-based theme.', + ); + $this->get_theme_info(); + $this->create_folder(); + } + + function get_theme_info() { + + echo "Please provide the following information: "; + echo "\n"; + echo "Theme name: "; + $input = fopen ("php://stdin","r"); + $this->theme['name'] = trim(fgets($input)); + if($this->theme['name'] === ''){ + echo "ABORTING!\n"; + exit; + } + $this->theme['slug'] = $this->sanitize_title_with_dashes($this->theme['name']); + $this->theme['functions_slug'] = str_replace( '-', '_', $this->theme['slug'] ); + + echo "Description: "; + $input = fopen ("php://stdin","r"); + $this->theme['description'] = trim(fgets($input)); + + echo "Author: "; + $input = fopen ("php://stdin","r"); + $this->theme['author'] = trim(fgets($input)); + + echo "Theme URI: "; + $input = fopen ("php://stdin","r"); + $this->theme['uri'] = trim(fgets($input)); + } + + function create_folder() { + + $dir = '../' . $this->theme['slug']; + + if( is_dir($dir) === false ) { + + mkdir($dir); + $prototype_dir = './'; + $exclude_files = array( 'create.php', '.travis.yml', 'codesniffer.ruleset.xml', '.jscsrc', '.jshintignore', 'README.md', 'CONTRIBUTING.md', '.git', '.svn', '.DS_Store', '.gitignore', '.', '..' ); + $exclude_directories = array( '.git', '.svn', '.github', '.', '..' ); + + foreach ( $iterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator($prototype_dir, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item ) { + if ( in_array( $iterator->getSubPathName(), $exclude_files ) || in_array( $iterator->getSubPathName(), $exclude_directories ) ){ + continue; + } + + if ($item->isDir()) { + mkdir($dir . DIRECTORY_SEPARATOR . $iterator->getSubPathName()); + } else { + $contents = file_get_contents( $prototype_dir . $iterator->getSubPathName() ); + $file = fopen( $dir . '/' . $iterator->getSubPathName(),"w" ); + fwrite( $file, $this->replace_theme_name($contents, $iterator->getSubPathName()) ); + fclose( $file ); + } + } + echo "\n"; + echo "Your new theme is ready!\n"; + } else { + echo "\n"; + echo "This theme already exists\n"; + } + } + + function replace_theme_name($contents, $filename) { + + // Replace only text files, skip png's and other stuff. + $valid_extensions = array( 'php', 'css', 'scss', 'js', 'txt', 'html' ); + $valid_extensions_regex = implode( '|', $valid_extensions ); + if ( ! preg_match( "/\.({$valid_extensions_regex})$/", $filename ) ) { + return $contents; + } + $theme_slug_underscore = str_replace( '-', '_', $this->old_themeslug ); + + + // Special treatment for style.css + if ( 'style.css' === $filename ) { + $theme_headers = array( + 'Theme Name' => $this->theme['name'], + 'Text Domain' => $this->theme['slug'], + 'Theme URI' => $this->theme['uri'], + 'Description' => $this->theme['description'], + 'Author' => $this->theme['author'], + ); + + foreach ( $theme_headers as $key => $value ) { + $contents = preg_replace( '/(' . preg_quote( $key ) . ':)\s?(.+)/', '\\1 ' . $value, $contents ); + } + + $contents = str_replace( $this->old_themename, $this->theme['name'], $contents ); + return $contents; + } + + // Special treatment for functions.php + if ( 'functions.php' === $filename ) { + + $function_names = array( + 'wp_enqueue_style', + 'wp_enqueue_script' + ); + + foreach ( $function_names as $function ) { + $contents = preg_replace('/('.preg_quote($function).'[ ]?\([ ]?(?:\'|"))('.preg_quote($theme_slug_underscore).')/', '$1'.$this->theme['slug'], $contents); + } + + $contents = str_replace( $theme_slug_underscore, $this->theme['functions_slug'], $contents ); + $contents = str_replace( $this->old_themeslug, $this->theme['functions_slug'], $contents ); + $contents = str_replace( $this->old_themename, $this->theme['name'], $contents ); + return $contents; + } + + // Special treatment for php files + else if ( 'php' === substr($filename, strrpos($filename, '.') + 1) ) { + $contents = str_replace( $theme_slug_underscore, $this->theme['slug'], $contents ); + $contents = str_replace( $this->old_themeslug, $this->theme['slug'], $contents ); + return $contents; + } + + // Special treatment for templates + else if ( 'html' === substr($filename, strrpos($filename, '.') + 1) ) { + $contents = str_replace( $theme_slug_underscore, $this->theme['slug'], $contents ); + $contents = str_replace( $this->old_themeslug, $this->theme['slug'], $contents ); + return $contents; + } + + return $contents; + } + + function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) { + $title = strip_tags( $title ); + // Preserve escaped octets. + $title = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title ); + // Remove percent signs that are not part of an octet. + $title = str_replace( '%', '', $title ); + // Restore octets. + $title = preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title ); + + $title = strtolower( $title ); + + if ( 'save' === $context ) { + // Convert  , &ndash, and &mdash to hyphens. + $title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title ); + // Convert  , &ndash, and &mdash HTML entities to hyphens. + $title = str_replace( array( ' ', ' ', '–', '–', '—', '—' ), '-', $title ); + // Convert forward slash to hyphen. + $title = str_replace( '/', '-', $title ); + + // Strip these characters entirely. + $title = str_replace( + array( + // Soft hyphens. + '%c2%ad', + // ¡ and ¿. + '%c2%a1', + '%c2%bf', + // Angle quotes. + '%c2%ab', + '%c2%bb', + '%e2%80%b9', + '%e2%80%ba', + // Curly quotes. + '%e2%80%98', + '%e2%80%99', + '%e2%80%9c', + '%e2%80%9d', + '%e2%80%9a', + '%e2%80%9b', + '%e2%80%9e', + '%e2%80%9f', + // Bullet. + '%e2%80%a2', + // ©, ®, °, &hellip, and &trade. + '%c2%a9', + '%c2%ae', + '%c2%b0', + '%e2%80%a6', + '%e2%84%a2', + // Acute accents. + '%c2%b4', + '%cb%8a', + '%cc%81', + '%cd%81', + // Grave accent, macron, caron. + '%cc%80', + '%cc%84', + '%cc%8c', + ), + '', + $title + ); + + // Convert × to 'x'. + $title = str_replace( '%c3%97', 'x', $title ); + } + + // Kill entities. + $title = preg_replace( '/&.+?;/', '', $title ); + $title = str_replace( '.', '-', $title ); + + $title = preg_replace( '/[^%a-z0-9 _-]/', '', $title ); + $title = preg_replace( '/\s+/', '-', $title ); + $title = preg_replace( '|-+|', '-', $title ); + $title = trim( $title, '-' ); + + return $title; + } +} + +new Generate_Theme; +?> \ No newline at end of file From 1fa57ffcb8f6dabf712c99c1168ddc891ce25ed1 Mon Sep 17 00:00:00 2001 From: Jason Crist Date: Tue, 15 Mar 2022 11:51:10 -0400 Subject: [PATCH 07/13] Removed a create script. (It shouldn't be here...) --- block-canvas/create.php | 231 ---------------------------------------- 1 file changed, 231 deletions(-) delete mode 100644 block-canvas/create.php diff --git a/block-canvas/create.php b/block-canvas/create.php deleted file mode 100644 index 8464e72808..0000000000 --- a/block-canvas/create.php +++ /dev/null @@ -1,231 +0,0 @@ -theme = array( - 'name' => $this->old_themename, - 'slug' => $this->old_themeslug, - 'uri' => 'https://github.com/wordpress/theme-experiments/', - 'author' => 'Kjell Reigstad', - 'description' => 'The base for a block-based theme.', - ); - $this->get_theme_info(); - $this->create_folder(); - } - - function get_theme_info() { - - echo "Please provide the following information: "; - echo "\n"; - echo "Theme name: "; - $input = fopen ("php://stdin","r"); - $this->theme['name'] = trim(fgets($input)); - if($this->theme['name'] === ''){ - echo "ABORTING!\n"; - exit; - } - $this->theme['slug'] = $this->sanitize_title_with_dashes($this->theme['name']); - $this->theme['functions_slug'] = str_replace( '-', '_', $this->theme['slug'] ); - - echo "Description: "; - $input = fopen ("php://stdin","r"); - $this->theme['description'] = trim(fgets($input)); - - echo "Author: "; - $input = fopen ("php://stdin","r"); - $this->theme['author'] = trim(fgets($input)); - - echo "Theme URI: "; - $input = fopen ("php://stdin","r"); - $this->theme['uri'] = trim(fgets($input)); - } - - function create_folder() { - - $dir = '../' . $this->theme['slug']; - - if( is_dir($dir) === false ) { - - mkdir($dir); - $prototype_dir = './'; - $exclude_files = array( 'create.php', '.travis.yml', 'codesniffer.ruleset.xml', '.jscsrc', '.jshintignore', 'README.md', 'CONTRIBUTING.md', '.git', '.svn', '.DS_Store', '.gitignore', '.', '..' ); - $exclude_directories = array( '.git', '.svn', '.github', '.', '..' ); - - foreach ( $iterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator($prototype_dir, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item ) { - if ( in_array( $iterator->getSubPathName(), $exclude_files ) || in_array( $iterator->getSubPathName(), $exclude_directories ) ){ - continue; - } - - if ($item->isDir()) { - mkdir($dir . DIRECTORY_SEPARATOR . $iterator->getSubPathName()); - } else { - $contents = file_get_contents( $prototype_dir . $iterator->getSubPathName() ); - $file = fopen( $dir . '/' . $iterator->getSubPathName(),"w" ); - fwrite( $file, $this->replace_theme_name($contents, $iterator->getSubPathName()) ); - fclose( $file ); - } - } - echo "\n"; - echo "Your new theme is ready!\n"; - } else { - echo "\n"; - echo "This theme already exists\n"; - } - } - - function replace_theme_name($contents, $filename) { - - // Replace only text files, skip png's and other stuff. - $valid_extensions = array( 'php', 'css', 'scss', 'js', 'txt', 'html' ); - $valid_extensions_regex = implode( '|', $valid_extensions ); - if ( ! preg_match( "/\.({$valid_extensions_regex})$/", $filename ) ) { - return $contents; - } - $theme_slug_underscore = str_replace( '-', '_', $this->old_themeslug ); - - - // Special treatment for style.css - if ( 'style.css' === $filename ) { - $theme_headers = array( - 'Theme Name' => $this->theme['name'], - 'Text Domain' => $this->theme['slug'], - 'Theme URI' => $this->theme['uri'], - 'Description' => $this->theme['description'], - 'Author' => $this->theme['author'], - ); - - foreach ( $theme_headers as $key => $value ) { - $contents = preg_replace( '/(' . preg_quote( $key ) . ':)\s?(.+)/', '\\1 ' . $value, $contents ); - } - - $contents = str_replace( $this->old_themename, $this->theme['name'], $contents ); - return $contents; - } - - // Special treatment for functions.php - if ( 'functions.php' === $filename ) { - - $function_names = array( - 'wp_enqueue_style', - 'wp_enqueue_script' - ); - - foreach ( $function_names as $function ) { - $contents = preg_replace('/('.preg_quote($function).'[ ]?\([ ]?(?:\'|"))('.preg_quote($theme_slug_underscore).')/', '$1'.$this->theme['slug'], $contents); - } - - $contents = str_replace( $theme_slug_underscore, $this->theme['functions_slug'], $contents ); - $contents = str_replace( $this->old_themeslug, $this->theme['functions_slug'], $contents ); - $contents = str_replace( $this->old_themename, $this->theme['name'], $contents ); - return $contents; - } - - // Special treatment for php files - else if ( 'php' === substr($filename, strrpos($filename, '.') + 1) ) { - $contents = str_replace( $theme_slug_underscore, $this->theme['slug'], $contents ); - $contents = str_replace( $this->old_themeslug, $this->theme['slug'], $contents ); - return $contents; - } - - // Special treatment for templates - else if ( 'html' === substr($filename, strrpos($filename, '.') + 1) ) { - $contents = str_replace( $theme_slug_underscore, $this->theme['slug'], $contents ); - $contents = str_replace( $this->old_themeslug, $this->theme['slug'], $contents ); - return $contents; - } - - return $contents; - } - - function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) { - $title = strip_tags( $title ); - // Preserve escaped octets. - $title = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title ); - // Remove percent signs that are not part of an octet. - $title = str_replace( '%', '', $title ); - // Restore octets. - $title = preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title ); - - $title = strtolower( $title ); - - if ( 'save' === $context ) { - // Convert  , &ndash, and &mdash to hyphens. - $title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title ); - // Convert  , &ndash, and &mdash HTML entities to hyphens. - $title = str_replace( array( ' ', ' ', '–', '–', '—', '—' ), '-', $title ); - // Convert forward slash to hyphen. - $title = str_replace( '/', '-', $title ); - - // Strip these characters entirely. - $title = str_replace( - array( - // Soft hyphens. - '%c2%ad', - // ¡ and ¿. - '%c2%a1', - '%c2%bf', - // Angle quotes. - '%c2%ab', - '%c2%bb', - '%e2%80%b9', - '%e2%80%ba', - // Curly quotes. - '%e2%80%98', - '%e2%80%99', - '%e2%80%9c', - '%e2%80%9d', - '%e2%80%9a', - '%e2%80%9b', - '%e2%80%9e', - '%e2%80%9f', - // Bullet. - '%e2%80%a2', - // ©, ®, °, &hellip, and &trade. - '%c2%a9', - '%c2%ae', - '%c2%b0', - '%e2%80%a6', - '%e2%84%a2', - // Acute accents. - '%c2%b4', - '%cb%8a', - '%cc%81', - '%cd%81', - // Grave accent, macron, caron. - '%cc%80', - '%cc%84', - '%cc%8c', - ), - '', - $title - ); - - // Convert × to 'x'. - $title = str_replace( '%c3%97', 'x', $title ); - } - - // Kill entities. - $title = preg_replace( '/&.+?;/', '', $title ); - $title = str_replace( '.', '-', $title ); - - $title = preg_replace( '/[^%a-z0-9 _-]/', '', $title ); - $title = preg_replace( '/\s+/', '-', $title ); - $title = preg_replace( '|-+|', '-', $title ); - $title = trim( $title, '-' ); - - return $title; - } -} - -new Generate_Theme; -?> \ No newline at end of file From 4ca1c16119af3a996906649fb32e24c3ba57f129 Mon Sep 17 00:00:00 2001 From: Maggie Date: Tue, 15 Mar 2022 16:43:54 +0100 Subject: [PATCH 08/13] 404 block pattern --- block-canvas/patterns/404.php | 2 +- block-canvas/templates/404.html | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/block-canvas/patterns/404.php b/block-canvas/patterns/404.php index 6660aa4e8b..c0ac060077 100644 --- a/block-canvas/patterns/404.php +++ b/block-canvas/patterns/404.php @@ -1,7 +1,7 @@ diff --git a/block-canvas/templates/404.html b/block-canvas/templates/404.html index 4d12bb257c..ef1e8a1186 100644 --- a/block-canvas/templates/404.html +++ b/block-canvas/templates/404.html @@ -2,16 +2,10 @@
- - -

Oops! That page can’t be found.

- - - -

It looks like nothing was found at this location. Maybe try a search?

- + +
From 9ee11743559c8b68fb72ccf6a6b4a4a62fa185a1 Mon Sep 17 00:00:00 2001 From: Maggie Date: Tue, 15 Mar 2022 16:55:11 +0100 Subject: [PATCH 09/13] remove fontSlug --- block-canvas/theme.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/block-canvas/theme.json b/block-canvas/theme.json index aca89d6193..bd8fa5a8a9 100644 --- a/block-canvas/theme.json +++ b/block-canvas/theme.json @@ -133,13 +133,11 @@ "fontFamilies": [ { "fontFamily": "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif", - "fontSlug": "system-font", "slug": "body-font", "name": "Body (System Font)" }, { "fontFamily": "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif", - "fontSlug": "system-font", "slug": "heading-font", "name": "Headings (System Font)" } From 6e9fbcbdebb76828c70f54d8f0ccc20cf6f08dba Mon Sep 17 00:00:00 2001 From: Maggie Date: Tue, 15 Mar 2022 16:55:43 +0100 Subject: [PATCH 10/13] removed block styles support --- block-canvas/functions.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/block-canvas/functions.php b/block-canvas/functions.php index dce13e7208..1ca1bd6ede 100644 --- a/block-canvas/functions.php +++ b/block-canvas/functions.php @@ -20,9 +20,6 @@ */ function block_canvas_support() { - // Add support for block styles. - add_theme_support( 'wp-block-styles' ); - // Enqueue editor styles. add_editor_style( 'style.css' ); From 626e858e5714a1ab43dd9d37bfa82a1ff0b53750 Mon Sep 17 00:00:00 2001 From: Maggie Date: Tue, 15 Mar 2022 17:35:30 +0100 Subject: [PATCH 11/13] change slug of block pattern --- block-canvas/templates/404.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block-canvas/templates/404.html b/block-canvas/templates/404.html index ef1e8a1186..590ed7d5dc 100644 --- a/block-canvas/templates/404.html +++ b/block-canvas/templates/404.html @@ -3,7 +3,7 @@
- +
From bc1ba92e90f3bcc1d66baf47c6a5f33a523a7d53 Mon Sep 17 00:00:00 2001 From: Maggie Date: Thu, 17 Mar 2022 10:02:09 +0100 Subject: [PATCH 12/13] added namespace to pattern --- block-canvas/patterns/404.php | 1 + 1 file changed, 1 insertion(+) diff --git a/block-canvas/patterns/404.php b/block-canvas/patterns/404.php index c0ac060077..f747a9c5cb 100644 --- a/block-canvas/patterns/404.php +++ b/block-canvas/patterns/404.php @@ -1,6 +1,7 @@ Date: Thu, 17 Mar 2022 11:16:10 +0100 Subject: [PATCH 13/13] ignore this theme when pushing to the sandbox --- .sandbox-ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.sandbox-ignore b/.sandbox-ignore index d448670ce0..535661602a 100644 --- a/.sandbox-ignore +++ b/.sandbox-ignore @@ -9,6 +9,7 @@ .vscode .wp-env.* *.code-workspace +block-canvas/ package-lock.json sandbox.sh sandbox-git.sh