Bläddra i källkod

Spearhead Blocks initial commit

Initial commit for the Spearhead blocks
Onur Oztaskiran 3 år sedan
förälder
incheckning
85b7c2165d

+ 2 - 0
spearheadblocks/.gitignore

@@ -0,0 +1,2 @@
+.DS_Store
+*.codekit3

+ 39 - 0
spearheadblocks/functions.php

@@ -0,0 +1,39 @@
+<?php
+
+/**
+* Enqueue Spearhead Blocks additional Styles
+*/
+
+add_action( 'wp_enqueue_scripts', 'enqueue_spearheadb_styles', 1 );
+
+function enqueue_spearheadb_styles() {
+   wp_enqueue_style( 'spearheadb-style', get_stylesheet_uri() );
+}
+
+
+function spearhead_the_excerpt( $excerpt ) {
+
+	$audio_block = '';
+	if ( has_block( 'audio' ) ) {
+		$post   = get_post();
+		$blocks = parse_blocks( $post->post_content );
+		foreach ( $blocks as $block ) {
+			if ( 'core/audio' === $block['blockName'] ) {
+				$audio_block .= '<div class="excerpt-audio-block">' . wp_kses_post( $block['innerHTML'] ) . '</div>';
+				break;
+			}
+		}
+	}
+
+	// For cases where the post excerpt is empty
+	// (but the post might have content)
+	if ( 0 === strlen( $excerpt ) ) {
+		return $excerpt . $audio_block;
+	}
+
+	return $excerpt . $audio_block;
+}
+
+// Filter the excerpt
+add_filter( 'get_the_excerpt', 'spearhead_the_excerpt' );
+

+ 9 - 0
spearheadblocks/parts/footer.html

@@ -0,0 +1,9 @@
+<!-- wp:group {"style":{"spacing":{"padding":{"bottom":"40px"}}},"layout":{"inherit":true}} -->
+<div class="wp-block-group" style="padding-bottom:40px"><!-- wp:group {"style":{"spacing":{"padding":{"top":"80px","bottom":"30px"}}}} -->
+<div class="wp-block-group" style="padding-top:80px;padding-bottom:30px"><!-- wp:group {"layout":{"type":"flex","flexWrap":"nowrap"}} -->
+<div class="wp-block-group"><!-- wp:site-title {"fontSize":"small"} /-->
+
+<!-- wp:site-tagline /--></div>
+<!-- /wp:group --></div>
+<!-- /wp:group --></div>
+<!-- /wp:group -->

+ 19 - 0
spearheadblocks/parts/header.html

@@ -0,0 +1,19 @@
+<!-- wp:group {"className":"gapless-group","layout":{"inherit":"true"}} -->
+<div class="wp-block-group gapless-group"><!-- wp:group {"align":"full","style":{"spacing":{"padding":{"bottom":"35px","top":"70px","right":"3.5vw","left":"3.5vw"}}},"className":"site-header","layout":{"type":"flex","justifyContent":"space-between","verticalAlignment":"top"}} -->
+<div class="wp-block-group alignfull site-header" style="padding-top:70px;padding-right:3.5vw;padding-bottom:35px;padding-left:3.5vw"><!-- wp:group {"className":"site-brand","layout":{"type":"flex"}} -->
+<div class="wp-block-group site-brand"><!-- wp:site-logo {"width":64} /-->
+
+<!-- wp:group {"style":{"spacing":{"blockGap":"5px"}}} -->
+<div class="wp-block-group"><!-- wp:site-title /-->
+
+<!-- wp:site-tagline {"style":{"typography":{"fontSize":"0.95rem"}}} /--></div>
+<!-- /wp:group --></div>
+<!-- /wp:group -->
+
+<!-- wp:navigation {__unstableLocation":"primary","className":"social-links","layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"right","orientation":"horizontal"},"style":{"spacing":{"margin":{"top":"0"}}}} /--></div>
+<!-- /wp:group --></div>
+<!-- /wp:group -->
+
+<!-- wp:spacer {"height":"50px"} -->
+<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>
+<!-- /wp:spacer -->

+ 31 - 0
spearheadblocks/readme.txt

@@ -0,0 +1,31 @@
+=== Spearhead Blocks ===
+Contributors: Automattic
+Requires at least: 5.8
+Tested up to: 5.9
+Requires PHP: 5.7
+License: GPLv2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+
+== Description ==
+
+Spearhead Blocks is the Full Site Editing capable, block based version of the original Spearhead theme.
+
+== Changelog ==
+
+= 0.0.1 =
+* Initial release
+
+== Copyright ==
+
+Spearhead Blocks WordPress Theme, (C) 2022 Automattic
+Spearhead Blocks 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.

BIN
spearheadblocks/screenshot.png


+ 32 - 0
spearheadblocks/style.css

@@ -0,0 +1,32 @@
+/*
+Theme Name: Spearhead Blocks
+Theme URI: https://github.com/automattic/themes/tree/trunk/spearhead-blocks
+Author: Automattic
+Author URI: https://automattic.com
+Description: Spearhead Blocks is the Full Site Editing capable, block based version of the original Spearhead theme.
+Requires at least: 5.8
+Tested up to: 5.9
+Requires PHP: 5.7
+Version: 0.0.1
+License: GNU General Public License v2 or later
+License URI: https://raw.githubusercontent.com/Automattic/themes/trunk/LICENSE
+Template: blockbase
+Text Domain: spearheadblocks
+Tags: one-column, custom-colors, custom-menu, custom-logo, editor-style, featured-images, full-site-editing, rtl-language-support, theme-options, threaded-comments, translation-ready, wide-blocks
+*/
+.wp-block-post .wp-block-post-title a {
+  text-decoration-line: none;
+}
+.wp-block-post .wp-block-post-title a:hover {
+  text-decoration-line: underline;
+}
+
+.excerpt-audio-block .wp-block-audio {
+  margin-left: 0;
+  margin-right: 0;
+  margin-top: 2rem;
+}
+
+.excerpt-audio-block .wp-block-audio audio {
+  width: 100%;
+}

+ 34 - 0
spearheadblocks/style.scss

@@ -0,0 +1,34 @@
+/*
+Theme Name: Spearhead Blocks
+Theme URI: https://github.com/automattic/themes/tree/trunk/spearhead-blocks
+Author: Automattic
+Author URI: https://automattic.com
+Description: Spearhead Blocks is the Full Site Editing capable, block based version of the original Spearhead theme.
+Requires at least: 5.8
+Tested up to: 5.9
+Requires PHP: 5.7
+Version: 0.0.1
+License: GNU General Public License v2 or later
+License URI: https://raw.githubusercontent.com/Automattic/themes/trunk/LICENSE
+Template: blockbase
+Text Domain: spearheadblocks
+Tags: one-column, custom-colors, custom-menu, custom-logo, editor-style, featured-images, full-site-editing, rtl-language-support, theme-options, threaded-comments, translation-ready, wide-blocks
+*/
+
+.wp-block-post .wp-block-post-title a {
+
+    text-decoration-line: none;
+
+    &:hover {
+        text-decoration-line: underline;
+    }
+}
+
+.excerpt-audio-block .wp-block-audio {
+  margin-left: 0;
+  margin-right: 0;
+  margin-top: 2rem;
+}
+.excerpt-audio-block .wp-block-audio audio {
+  width: 100%;
+}

+ 52 - 0
spearheadblocks/styles/midnight.json

@@ -0,0 +1,52 @@
+{
+	"version": 1,
+	"title": "Midnight",
+	"settings": {
+		"color": {
+			"palette": [
+				{
+					"slug": "primary",
+					"color": "#ff6a81",
+					"name": "Primary"
+				},
+				{
+					"slug": "secondary",
+					"color": "#b2b2b2",
+					"name": "Secondary"
+				},
+				{
+					"slug": "foreground",
+					"color": "#ffffff",
+					"name": "Foreground"
+				},
+				{
+					"slug": "background",
+					"color": "#1e1f21",
+					"name": "Background"
+				}
+			]
+		}
+	},
+	"styles": {
+		"color": {
+			"background": "var(--wp--preset--color--background)",
+			"text": "var(--wp--preset--color--foreground)"
+		},
+		"blocks": {
+			"core/site-title": {
+				"elements": {
+					"link": {
+						":hover": {
+							"color": {
+								"text": "var:preset|color|foreground"
+							}
+						},
+						"color": {
+							"text": "var:preset|color|primary"
+						}
+					}
+				}
+			}
+		}
+	}
+}

+ 37 - 0
spearheadblocks/templates/archive.html

@@ -0,0 +1,37 @@
+<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
+
+<!-- wp:query {"queryId":3,"query":{"perPage":10,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true,"taxQuery":null,"parents":[]},"tagName":"main","layout":{"inherit":true}} -->
+<main class="wp-block-query"><!-- wp:query-title {"type":"archive","style":{"spacing":{"margin":{"bottom":"100px"}}}} /-->
+
+<!-- wp:post-template -->
+<!-- wp:group -->
+<div class="wp-block-group"><!-- wp:post-title {"isLink":true} /-->
+
+<!-- wp:post-featured-image {"isLink":true} /-->
+
+<!-- wp:post-excerpt /-->
+
+<!-- wp:group {"style":{"elements":{"link":{"color":{"text":"var:preset|color|secondary"}}}},"textColor":"secondary","layout":{"type":"flex","flexWrap":"nowrap"},"fontSize":"small"} -->
+<div class="wp-block-group has-secondary-color has-text-color has-link-color has-small-font-size"><!-- wp:post-author-name {"isLink":true} /-->
+
+<!-- wp:post-date {"format":null,"style":{"elements":{"link":{"color":{"text":"var:preset|color|secondary"}}}}} /--></div>
+<!-- /wp:group -->
+
+<!-- wp:spacer {"height":"40px"} -->
+<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>
+<!-- /wp:spacer --></div>
+<!-- /wp:group -->
+<!-- /wp:post-template -->
+
+<!-- wp:group {"layout":{"inherit":true}} -->
+<div class="wp-block-group"><!-- wp:query-pagination {"paginationArrow":"arrow","layout":{"type":"flex","justifyContent":"space-between"}} -->
+<!-- wp:query-pagination-previous /-->
+
+<!-- wp:query-pagination-numbers /-->
+
+<!-- wp:query-pagination-next /-->
+<!-- /wp:query-pagination --></div>
+<!-- /wp:group --></main>
+<!-- /wp:query -->
+
+<!-- wp:template-part {"slug":"footer","tagName":"footer","className":"site-footer-container"} /-->

+ 29 - 0
spearheadblocks/templates/index.html

@@ -0,0 +1,29 @@
+<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
+
+<!-- wp:query {"queryId":0,"query":{"perPage":10,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true,"taxQuery":null,"parents":[]},"tagName":"main","layout":{"inherit":true}} -->
+<main class="wp-block-query"><!-- wp:post-template -->
+<!-- wp:group -->
+<div class="wp-block-group"><!-- wp:post-title {"isLink":true} /-->
+
+<!-- wp:post-featured-image {"isLink":true} /-->
+
+<!-- wp:post-excerpt /-->
+
+<!-- wp:spacer {"height":"40px"} -->
+<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>
+<!-- /wp:spacer --></div>
+<!-- /wp:group -->
+<!-- /wp:post-template -->
+
+<!-- wp:group {"layout":{"inherit":true}} -->
+<div class="wp-block-group"><!-- wp:query-pagination {"paginationArrow":"arrow","layout":{"type":"flex","justifyContent":"space-between"}} -->
+<!-- wp:query-pagination-previous /-->
+
+<!-- wp:query-pagination-numbers /-->
+
+<!-- wp:query-pagination-next /-->
+<!-- /wp:query-pagination --></div>
+<!-- /wp:group --></main>
+<!-- /wp:query -->
+
+<!-- wp:template-part {"slug":"footer","tagName":"footer","className":"site-footer-container"} /-->

+ 61 - 0
spearheadblocks/templates/page.html

@@ -0,0 +1,61 @@
+<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
+
+<!-- wp:group {"layout":{"inherit":true}} -->
+<div class="wp-block-group"><!-- wp:post-title {"style":{"typography":{"fontSize":"2.5rem","lineHeight":1.3999999999999999}}} /--></div>
+<!-- /wp:group -->
+
+<!-- wp:group {"tagName":"main","lock":{"move":false,"remove":true}} -->
+<main class="wp-block-group"><!-- wp:post-featured-image {"align":"full"} /-->
+
+<!-- wp:post-content {"lock":{"move":false,"remove":true},"layout":{"inherit":true}} /--></main>
+<!-- /wp:group -->
+
+<!-- wp:group {"layout":{"inherit":true}} -->
+<div class="wp-block-group"><!-- wp:spacer {"height":"60px"} -->
+<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
+<!-- /wp:spacer -->
+
+<!-- wp:comments {"className":"wp-block-comments-query-loop "} -->
+<div class="wp-block-comments wp-block-comments-query-loop"><!-- wp:comments-title /-->
+
+<!-- wp:comment-template -->
+<!-- wp:columns -->
+<div class="wp-block-columns"><!-- wp:column {"width":"40px"} -->
+<div class="wp-block-column" style="flex-basis:40px"></div>
+<!-- /wp:column -->
+
+<!-- wp:column -->
+<div class="wp-block-column"><!-- wp:group {"style":{"spacing":{"blockGap":"10px"}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
+<div class="wp-block-group"><!-- wp:avatar {"size":40,"style":{"border":{"radius":"20px"},"spacing":{"margin":{"top":"10px"}}}} /-->
+
+<!-- wp:group -->
+<div class="wp-block-group"><!-- wp:comment-author-name /-->
+
+<!-- wp:group {"style":{"spacing":{"margin":{"top":"0px","bottom":"0px"},"blockGap":"0.5em"}},"layout":{"type":"flex"}} -->
+<div class="wp-block-group" style="margin-top:0px;margin-bottom:0px"><!-- wp:comment-date {"format":"F j, Y \\a\\t g:i a"} /-->
+
+<!-- wp:comment-edit-link /--></div>
+<!-- /wp:group --></div>
+<!-- /wp:group --></div>
+<!-- /wp:group -->
+
+<!-- wp:comment-content /-->
+
+<!-- wp:comment-reply-link /--></div>
+<!-- /wp:column --></div>
+<!-- /wp:columns -->
+<!-- /wp:comment-template -->
+
+<!-- wp:comments-pagination -->
+<!-- wp:comments-pagination-previous /-->
+
+<!-- wp:comments-pagination-numbers /-->
+
+<!-- wp:comments-pagination-next /-->
+<!-- /wp:comments-pagination -->
+
+<!-- wp:post-comments-form /--></div>
+<!-- /wp:comments --></div>
+<!-- /wp:group -->
+
+<!-- wp:template-part {"slug":"footer","tagName":"footer","className":"site-footer-container"} /-->

+ 73 - 0
spearheadblocks/templates/single.html

@@ -0,0 +1,73 @@
+<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
+
+<!-- wp:group {"layout":{"inherit":true}} -->
+<div class="wp-block-group"><!-- wp:post-date {"textColor":"secondary","fontFamily":"ibm-plex-mono"} /-->
+
+<!-- wp:post-title {"style":{"typography":{"fontSize":"2.5rem","lineHeight":1.3999999999999999}}} /--></div>
+<!-- /wp:group -->
+
+<!-- wp:group {"tagName":"main","lock":{"move":false,"remove":true}} -->
+<main class="wp-block-group"><!-- wp:post-featured-image {"align":"full"} /-->
+
+<!-- wp:post-content {"lock":{"move":false,"remove":true},"layout":{"inherit":true}} /-->
+
+<!-- wp:group {"style":{"spacing":{"blockGap":"0px","padding":{"top":"30px"}}},"layout":{"inherit":true}} -->
+<div class="wp-block-group" style="padding-top:30px"><!-- wp:paragraph {"textColor":"secondary","fontSize":"small"} -->
+<p class="has-secondary-color has-text-color has-small-font-size">Published by</p>
+<!-- /wp:paragraph -->
+
+<!-- wp:post-author-name {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} /-->
+
+<!-- wp:post-author-biography {"style":{"spacing":{"margin":{"top":"20px"}}}} /--></div>
+<!-- /wp:group --></main>
+<!-- /wp:group -->
+
+<!-- wp:group {"layout":{"inherit":true}} -->
+<div class="wp-block-group"><!-- wp:spacer {"height":"60px"} -->
+<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
+<!-- /wp:spacer -->
+
+<!-- wp:comments {"className":"wp-block-comments-query-loop "} -->
+<div class="wp-block-comments wp-block-comments-query-loop"><!-- wp:comments-title /-->
+
+<!-- wp:comment-template -->
+<!-- wp:columns -->
+<div class="wp-block-columns"><!-- wp:column {"width":"40px"} -->
+<div class="wp-block-column" style="flex-basis:40px"></div>
+<!-- /wp:column -->
+
+<!-- wp:column -->
+<div class="wp-block-column"><!-- wp:group {"style":{"spacing":{"blockGap":"10px"}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
+<div class="wp-block-group"><!-- wp:avatar {"size":40,"style":{"border":{"radius":"20px"},"spacing":{"margin":{"top":"10px"}}}} /-->
+
+<!-- wp:group -->
+<div class="wp-block-group"><!-- wp:comment-author-name /-->
+
+<!-- wp:group {"style":{"spacing":{"margin":{"top":"0px","bottom":"0px"},"blockGap":"0.5em"}},"layout":{"type":"flex"}} -->
+<div class="wp-block-group" style="margin-top:0px;margin-bottom:0px"><!-- wp:comment-date {"format":"F j, Y \\a\\t g:i a"} /-->
+
+<!-- wp:comment-edit-link /--></div>
+<!-- /wp:group --></div>
+<!-- /wp:group --></div>
+<!-- /wp:group -->
+
+<!-- wp:comment-content /-->
+
+<!-- wp:comment-reply-link /--></div>
+<!-- /wp:column --></div>
+<!-- /wp:columns -->
+<!-- /wp:comment-template -->
+
+<!-- wp:comments-pagination -->
+<!-- wp:comments-pagination-previous /-->
+
+<!-- wp:comments-pagination-numbers /-->
+
+<!-- wp:comments-pagination-next /-->
+<!-- /wp:comments-pagination -->
+
+<!-- wp:post-comments-form /--></div>
+<!-- /wp:comments --></div>
+<!-- /wp:group -->
+
+<!-- wp:template-part {"slug":"footer","tagName":"footer","className":"site-footer-container"} /-->

+ 110 - 0
spearheadblocks/theme.json

@@ -0,0 +1,110 @@
+{
+	"settings": {
+		"color": {
+			"palette": [
+				{
+					"color": "#db0042",
+					"name": "Primary",
+					"slug": "primary"
+				},
+				{
+					"color": "#555555",
+					"name": "Secondary",
+					"slug": "secondary"
+				},
+				{
+					"color": "#000000",
+					"name": "Foreground",
+					"slug": "foreground"
+				},
+				{
+					"color": "#ffffff",
+					"name": "Background",
+					"slug": "background"
+				},
+				{
+					"color": "#fafbf6",
+					"name": "Tertiary",
+					"slug": "tertiary"
+				}
+			]
+		},
+		"layout": {
+			"contentSize": "782px",
+			"wideSize": "1247px"
+		},
+		"custom": {
+			"heading": {
+				"typography": {
+					"fontWeight": 800
+				}
+			}
+		}
+	},
+	"styles": {
+		"blocks": {
+			"core/heading": {
+				"typography": {
+					"fontStyle": "normal",
+					"fontWeight": "700"
+				}
+			},
+			"core/navigation": {
+				"typography": {
+					"fontSize": "17px",
+					"fontStyle": "normal",
+					"fontWeight": "400"
+				}
+			},
+			"core/post-title": {
+				"typography": {
+					"fontSize": "var:preset|font-size|medium",
+					"fontStyle": "normal",
+					"fontWeight": "800"
+				}
+			},
+			"core/site-title": {
+				"elements": {
+					"link": {
+						":hover": {
+							"color": {
+								"text": "#000000"
+							}
+						},
+						"color": {
+							"text": "var:preset|color|primary"
+						}
+					}
+				},
+				"typography": {
+					"fontFamily": "var:preset|font-family|ibm-plex-mono",
+					"fontSize": "22px"
+				}
+			}
+		},
+		"elements": {
+			"link": {
+				":hover": {
+					"color": {
+						"text": "var:preset|color|primary"
+					}
+				},
+				"color": {
+					"text": "var:preset|color|foreground"
+				}
+			},
+			"heading": {
+				"typography": {
+					"fontWeight": "var(--wp--custom--heading--typography--font-weight)"
+				}
+			}
+		},
+		"typography": {
+			"fontFamily": "var:preset|font-family|libre-franklin",
+			"fontStyle": "normal",
+			"fontWeight": "500",
+			"lineHeight": 1.8
+		}
+	},
+	"version": 2
+}