Преглед на файлове

Merge pull request #2962 from Automattic/add/blankie-theme

Try: Adding a "Blank" Theme
Kjell Reigstad преди 4 години
родител
ревизия
49773cd111

+ 43 - 0
blank-page/footer.php

@@ -0,0 +1,43 @@
+<?php
+/**
+ * The template for displaying the footer
+ *
+ * Contains the closing of the #content div and all content after.
+ *
+ * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
+ *
+ * @package Blank Page
+ * @since 1.0
+ */
+
+?>
+
+	</div><!-- #content -->
+
+	<footer id="colophon" class="site-footer default-max-width" role="contentinfo" aria-label="<?php esc_attr_e( 'Footer', 'blank-page' ); ?>">
+
+		<div class="site-info">
+			<?php $blog_info = get_bloginfo( 'name' ); ?>
+			<?php if ( ! empty( $blog_info ) ) : ?>
+				<a class="site-name" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a><span class="comma">,</span>
+			<?php endif; ?>
+			<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'seedlet' ) ); ?>" class="imprint">
+				<?php
+				/* translators: %s: WordPress. */
+				printf( __( 'Proudly powered by %s.', 'seedlet' ), 'WordPress' );
+				?>
+			</a>
+			<?php
+			if ( function_exists( 'the_privacy_policy_link' ) ) {
+				the_privacy_policy_link( '', '<span role="separator" aria-hidden="true"></span>' );
+			}
+			?>
+		</div><!-- .site-info -->
+	</footer><!-- #colophon -->
+
+</div><!-- #page -->
+
+<?php wp_footer(); ?>
+
+</body>
+</html>

+ 128 - 0
blank-page/functions.php

@@ -0,0 +1,128 @@
+<?php
+/**
+ * Blank Page functions and definitions
+ *
+ * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
+ *
+ * @package WordPress
+ * @subpackage Blank Page
+ * @since 1.0
+ */
+
+if ( ! function_exists( 'blank_page_setup' ) ) :
+	/**
+	 * Sets up theme defaults and registers support for various WordPress features.
+	 *
+	 * Note that this function is hooked into the after_setup_theme hook, which
+	 * runs before the init hook. The init hook is too late for some features, such
+	 * as indicating support for post thumbnails.
+	 */
+	function blank_page_setup() {
+		// Add support for editor styles.
+		add_theme_support( 'editor-styles' );
+
+		// Enqueue editor styles.
+		add_editor_style( 'variables.css' );
+
+		// Editor color palette.
+		$colors_theme_mod = get_theme_mod( 'custom_colors_active' );
+		$primary          = ( ! empty( $colors_theme_mod ) && 'default' === $colors_theme_mod || empty( get_theme_mod( 'seedlet_--global--color-primary' ) ) ) ? '#000000' : get_theme_mod( 'seedlet_--global--color-primary' );
+		$secondary        = ( ! empty( $colors_theme_mod ) && 'default' === $colors_theme_mod || empty( get_theme_mod( 'seedlet_--global--color-secondary' ) ) ) ? '#007cba' : get_theme_mod( 'seedlet_--global--color-secondary' );
+		$foreground       = ( ! empty( $colors_theme_mod ) && 'default' === $colors_theme_mod || empty( get_theme_mod( 'seedlet_--global--color-foreground' ) ) ) ? '#333333' : get_theme_mod( 'seedlet_--global--color-foreground' );
+		$tertiary         = ( ! empty( $colors_theme_mod ) && 'default' === $colors_theme_mod || empty( get_theme_mod( 'seedlet_--global--color-tertiary' ) ) ) ? '#FAFAFA' : get_theme_mod( 'seedlet_--global--color-tertiary' );
+		$background       = ( ! empty( $colors_theme_mod ) && 'default' === $colors_theme_mod || empty( get_theme_mod( 'seedlet_--global--color-background' ) ) ) ? '#FFFFFF' : get_theme_mod( 'seedlet_--global--color-background' );
+
+		add_theme_support(
+			'editor-color-palette',
+			array(
+				array(
+					'name'  => __( 'Primary', 'blank-page' ),
+					'slug'  => 'primary',
+					'color' => $primary,
+				),
+				array(
+					'name'  => __( 'Secondary', 'blank-page' ),
+					'slug'  => 'secondary',
+					'color' => $secondary,
+				),
+				array(
+					'name'  => __( 'Foreground', 'blank-page' ),
+					'slug'  => 'foreground',
+					'color' => $foreground,
+				),
+				array(
+					'name'  => __( 'Tertiary', 'blank-page' ),
+					'slug'  => 'tertiary',
+					'color' => $tertiary,
+				),
+				array(
+					'name'  => __( 'Background', 'blank-page' ),
+					'slug'  => 'background',
+					'color' => $background,
+				),
+			)
+		);
+	}
+endif;
+add_action( 'after_setup_theme', 'blank_page_setup', 11 );
+
+/**
+ * Remove Seedlet theme features.
+ */
+function blank_page_remove_parent_theme_features() {
+
+	// Theme Support
+	remove_theme_support( 'custom-header' );
+	remove_theme_support( 'custom-logo' );
+	remove_theme_support( 'customize-selective-refresh-widgets' );
+
+	// Navigation Areas
+	unregister_nav_menu( 'primary' );
+	unregister_nav_menu( 'footer' );
+	unregister_nav_menu( 'social' );
+}
+add_action( 'after_setup_theme', 'blank_page_remove_parent_theme_features', 10 );
+
+function blank_page_dequeue_parent_scripts() {
+	// Naviation assets
+	wp_dequeue_script( 'seedlet-primary-navigation-script' );
+	wp_dequeue_style( 'seedlet-style-navigation' );
+}
+add_action( 'wp_enqueue_scripts', 'blank_page_dequeue_parent_scripts', 11 );
+
+/**
+ * Remove Meta Footer Items.
+ */
+if ( ! function_exists( 'seedlet_entry_meta_footer' ) ) :
+	/**
+	 * Prints HTML with meta information for the categories, tags and comments.
+	 */
+	function seedlet_entry_meta_footer() {
+
+		// Edit post link.
+		edit_post_link(
+			sprintf(
+				wp_kses(
+					/* translators: %s: Name of current post. Only visible to screen readers. */
+					__( 'Edit <span class="screen-reader-text">%s</span>', 'seedlet' ),
+					array(
+						'span' => array(
+							'class' => array(),
+						),
+					)
+				),
+				get_the_title()
+			),
+			'<span class="edit-link">' . seedlet_get_icon_svg( 'edit', 16 ),
+			'</span>'
+		);
+	}
+endif;
+
+/**
+ * Enqueue scripts and styles.
+ */
+function blank_page_enqueue() {
+	wp_enqueue_style( 'blank-page-styles', get_stylesheet_uri() );
+}
+add_action( 'wp_enqueue_scripts', 'blank_page_enqueue', 11 );

+ 53 - 0
blank-page/header.php

@@ -0,0 +1,53 @@
+<?php
+/**
+ * The header for our theme
+ *
+ * This is the template that displays all of the <head> section and everything up until <div id="content">
+ *
+ * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
+ *
+ * @package Blank Page
+ * @since 1.0
+ */
+$blog_info    = get_bloginfo( 'name' );
+$description  = get_bloginfo( 'description', 'display' );
+$show_title   = ( true === get_theme_mod( 'display_title_and_tagline', true ) );
+$header_class = $show_title ? 'site-title' : 'screen-reader-text';
+
+?><!doctype html>
+<html <?php language_attributes(); ?>>
+<head>
+	<meta charset="<?php bloginfo( 'charset' ); ?>" />
+	<meta name="viewport" content="width=device-width, initial-scale=1" />
+	<link rel="profile" href="https://gmpg.org/xfn/11" />
+	<?php wp_head(); ?>
+</head>
+
+<body <?php body_class(); ?>>
+<?php wp_body_open(); ?>
+<div id="page" class="site">
+	<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'blank-page' ); ?></a>
+
+	<header id="masthead" class="<?php echo $header_classes; ?>" role="banner">
+		<?php if ( has_custom_logo() && $show_title && ! is_singular() ) : ?>
+			<div class="site-logo"><?php the_custom_logo(); ?></div>
+		<?php endif; ?>
+
+		<div class="site-branding">
+			<?php if ( ! empty( $blog_info ) && $show_title && ! is_singular() ) : ?>
+				<?php if ( is_front_page() && is_home() ) : ?>
+					<h1 class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php echo $blog_info; ?></a></h1>
+				<?php else : ?>
+					<p class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php echo $blog_info; ?></a></p>
+				<?php endif; ?>
+			<?php endif; ?>
+
+			<?php if ( ( $description || is_customize_preview() ) && $show_title && ! is_singular() ) : ?>
+				<p class="site-description">
+					<?php echo $description; ?>
+				</p>
+			<?php endif; ?>
+		</div><!-- .site-branding -->
+	</header><!-- #masthead -->
+
+	<div id="content" class="site-content">

+ 192 - 0
blank-page/inc/wpcom-colors-utils.php

@@ -0,0 +1,192 @@
+<?php
+
+// Custom Colors: Seedlet
+function seedlet_define_color_annotations( $colors ) {
+	// Background Color
+	// --global--color-background
+	add_color_rule(
+		'bg',
+		$colors['background'],
+		array(
+
+			// This placeholder is needed to make the color annotations work
+			array( '.global--color-background', 'background-color' ),
+
+		),
+		__( 'Background Color' )
+	);
+
+	// Foreground Color
+	// --global--color-foreground
+	add_color_rule(
+		'txt',
+		$colors['foreground'],
+		array(
+
+			// This placeholder is needed to make the color annotations work
+			array( '.global--color-foreground', 'color' ),
+
+		),
+		__( 'Foreground Color' )
+	);
+
+	// Primary Color
+	// --global--color-primary
+	add_color_rule(
+		'link',
+		$colors['primary'],
+		array(
+
+			// This placeholder is needed to make the color annotations work
+			array( '.global--color-primary', 'color' ),
+
+		),
+		__( 'Primary Color' )
+	);
+
+	// Secondary Color
+	// --global--color-secondary
+	add_color_rule(
+		'fg1',
+		$colors['secondary'],
+		array(
+
+			// Text-color
+			array( '.global--color-secondary', 'color' ),
+
+		),
+		__( 'Secondary Color' )
+	);
+
+	// Tertiary Color
+	// --global--color-tertiary
+	add_color_rule(
+		'fg2',
+		$colors['tertiary'],
+		array(
+
+			// Text-color
+			array( '.global--color-tertiary', 'color' ),
+
+		),
+		__( 'Tertiary Color' )
+	);
+}
+
+// These functions are borrowed from the colorline lib
+function hex_to_rgb( $hex ) {
+	return sscanf( $hex, '%02X%02X%02X' );
+}
+
+// RGB values: 0-255
+// LUM values: 0-1
+function rgb_to_lum( $rgb ) {
+	list( $r, $g, $b ) = $rgb;
+	return sqrt( 0.241 * $r * $r + 0.691 * $g * $g + 0.068 * $b * $b ) / 255;
+}
+
+// RGB values:    0-255, 0-255, 0-255
+// HSV values:    0-360, 0-100, 0-100, 0-100
+function rgb_to_hsvl( $rgb ) {
+	$l                 = rgb_to_lum( $rgb );
+	list( $r, $g, $b ) = $rgb;
+	$r                 = $r / 255;
+	$g                 = $g / 255;
+	$b                 = $b / 255;
+	$max_rgb           = max( $r, $g, $b );
+	$min_rgb           = min( $r, $g, $b );
+	$chroma            = $max_rgb - $min_rgb;
+	$v                 = 100 * $max_rgb;
+	if ( 0 === (int) $chroma ) {
+		return array( 0, 0, $v, $l );
+	}
+	$s = 100 * ( $chroma / $max_rgb );
+	if ( $r === $min_rgb ) {
+		$h = 3 - ( ( $g - $b ) / $chroma );
+	} elseif ( $b === $min_rgb ) {
+		$h = 1 - ( ( $r - $g ) / $chroma );
+	} else { // $g === $min_rgb
+		$h = 5 - ( ( $b - $r ) / $chroma );
+	}
+	$h = 60 * $h;
+	return array( $h, $s, $v, $l );
+}
+
+function change_color_luminescence( $hex, $amount ) {
+	$hex_without_hash = substr( $hex, 1, strlen( $hex ) );
+	$rgb              = hex_to_rgb( $hex_without_hash );
+	$hsvl             = rgb_to_hsvl( $rgb );
+	return 'hsl( ' . $hsvl[0] . ',' . $hsvl[1] . '%,' . ( $hsvl[2] + $amount ) . '%)';
+}
+
+/**
+ * Custom CSS.
+ * The plugin takes the body of this function and applies it in a style tag in the document head.
+ */
+function seedlet_custom_colors_extra_css() {
+	$colors_array = get_theme_mod( 'colors_manager' );
+	$background   = $colors_array['colors']['bg'];
+	$foreground   = $colors_array['colors']['txt'];
+	$primary      = $colors_array['colors']['link'];
+	$secondary    = $colors_array['colors']['fg1'];
+	$tertiary     = $colors_array['colors']['fg2'];
+
+	$foreground_low_contrast  = change_color_luminescence( $foreground, 10 );
+	$foreground_high_contrast = change_color_luminescence( $foreground, -10 );
+	$primary_hover            = change_color_luminescence( $primary, 10 );
+	$secondary_hover          = change_color_luminescence( $secondary, 10 );
+	?>
+
+	:root,
+	#editor .editor-styles-wrapper {
+		--global--color-background: <?php echo $background; ?>;
+		--global--color-foreground: <?php echo $foreground; ?>;
+		--global--color-foreground-low-contrast: <?php echo $foreground_low_contrast; ?>;
+		--global--color-foreground-high-contrast: <?php echo $foreground_high_contrast; ?>;
+		--global--color-primary: <?php echo $primary; ?>;
+		--global--color-primary-hover: <?php echo $primary_hover; ?>;
+		--global--color-secondary: <?php echo $secondary; ?>;
+		--global--color-secondary-hover: <?php echo $secondary_hover; ?>;
+		--global--color-tertiary: <?php echo $tertiary; ?>;
+	}
+
+	<?php
+}
+add_theme_support( 'custom_colors_extra_css', 'seedlet_custom_colors_extra_css' );
+
+/**
+ * Featured Varia/Seedlet Palettes
+ */
+// Light
+add_color_palette(
+	array(
+		'#FFFFFF',
+		'#1D1E1E',
+		'#C8133E',
+		'#4E2F4B',
+		'#F9F9F9',
+	), /* translators: This is the name for a color scheme */
+	'Light'
+);
+// Medium
+add_color_palette(
+	array(
+		'#EEF4F7',
+		'#242527',
+		'#35845D',
+		'#233252',
+		'#F9F9F9',
+	), /* translators: This is the name for a color scheme */
+	'Medium'
+);
+// Dark
+add_color_palette(
+	array(
+		'#1F2527',
+		'#FFFFFF',
+		'#9FD3E8',
+		'#FBE6AA',
+		'#364043',
+	), /* translators: This is the name for a color scheme */
+	'Dark'
+);

+ 13 - 0
blank-page/inc/wpcom-colors.php

@@ -0,0 +1,13 @@
+<?php
+
+require_once __DIR__ . '/wpcom-colors-utils.php';
+
+seedlet_define_color_annotations(
+	array(
+		'background' => '#FFFFFF',
+		'foreground' => '#444444',
+		'primary'    => '#000000',
+		'secondary'  => '#007CBA',
+		'tertiary'   => '#FAFAFA',
+	)
+);

+ 2 - 0
blank-page/inc/wpcom-editor-colors.php

@@ -0,0 +1,2 @@
+<?php
+	require_once 'wpcom-colors.php';

+ 31 - 0
blank-page/page.php

@@ -0,0 +1,31 @@
+<?php
+/**
+ * The template for displaying all single posts
+ *
+ * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
+ *
+ * @package Blank Page
+ * @since 1.0.0
+ */
+
+get_header();
+?>
+
+	<section id="primary" class="content-area">
+		<main id="main" class="site-main" role="main">
+
+			<?php
+			/* Start the Loop */
+			while ( have_posts() ) :
+				the_post();
+
+				get_template_part( 'template-parts/content/content-singular' );
+
+			endwhile; // End of the loop.
+			?>
+
+		</main><!-- #main -->
+	</section><!-- #primary -->
+
+<?php
+get_footer();

+ 33 - 0
blank-page/readme.txt

@@ -0,0 +1,33 @@
+=== Blank Page ===
+Contributors: Automattic
+Requires at least: 5.0
+Tested up to: 5.6
+Requires PHP: 5.6.2
+License: GPLv2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+
+A blank starting point for building your site.
+
+== Description ==
+
+Blank Page is a blank starting point for building your site. 
+
+== Changelog ==
+
+= 1.0 =
+* Initial release 
+
+== Copyright ==
+
+Blank Page WordPress Theme, (C) 2020 Automattic, Inc.
+Blank Page 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
blank-page/screenshot.png


+ 31 - 0
blank-page/single.php

@@ -0,0 +1,31 @@
+<?php
+/**
+ * The template for displaying all single posts
+ *
+ * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
+ *
+ * @package Blank Page
+ * @since 1.0.0
+ */
+
+get_header();
+?>
+
+	<section id="primary" class="content-area">
+		<main id="main" class="site-main" role="main">
+
+			<?php
+			/* Start the Loop */
+			while ( have_posts() ) :
+				the_post();
+
+				get_template_part( 'template-parts/content/content-singular' );
+
+			endwhile; // End of the loop.
+			?>
+
+		</main><!-- #main -->
+	</section><!-- #primary -->
+
+<?php
+get_footer();

+ 84 - 0
blank-page/style.css

@@ -0,0 +1,84 @@
+/*
+Theme Name: Blank Page
+Theme URI: https://github.com/Automattic/themes/blankie
+Author: Automattic
+Author URI: https://automattic.com/
+Description: A blank starting point for building your site.
+Requires at least: 4.9.6
+Tested up to: 5.6
+Requires PHP: 5.6.2
+Version: 1.0
+License: GNU General Public License v2 or later
+License URI: LICENSE
+Template: seedlet
+Text Domain: blank-page
+Tags: one-column, accessibility-ready, custom-colors, editor-style, featured-images, rtl-language-support, sticky-post, translation-ready
+
+Blank Page WordPress Theme, (C) 2021 Automattic, Inc.
+Blank Page 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.
+*/
+
+@import "variables.css";
+
+/* Remove outside padding on single post pages. */
+
+.single .site-main,
+.page .site-main {
+	padding-top: 0;
+	padding-bottom: 0;
+}
+
+/* Remove extra margin from articles on single post pages. */
+
+.single .site-main > article,
+.page .site-main > article {
+	margin-bottom: 0;
+}
+
+/* Add some top padding if the first block on the page is not full-width or a spacer. */
+
+.single .entry-content > *:first-child:not(.alignfull):not(.wp-block-spacer),
+.page .entry-content > *:first-child:not(.alignfull):not(.wp-block-spacer) {
+	padding-top: var(--global--spacing-vertical);
+}
+
+/* Add some top padding for archive pages. */
+
+body:not(.single):not(.page),
+body:not(.single):not(.page) .site-content {
+	padding-top: var(--global--spacing-vertical);
+}
+
+@media screen and (min-width: 580px) {
+
+	body:not(.single):not(.page),
+	body:not(.single):not(.page) .site-content {
+		padding-top: calc(3 * var(--global--spacing-vertical));
+	}
+}
+
+
+/* Remove the top border from the entry-footer. */
+
+.site-main > article > .entry-footer {
+	border-top-width: 0
+}
+
+/* Center-align headers and footers. */
+
+.entry-header,
+.page-title,
+.entry-footer,
+.site-info {
+	text-align: center;
+}

+ 43 - 0
blank-page/template-parts/content/content-singular.php

@@ -0,0 +1,43 @@
+<?php
+/**
+ * Template part for displaying posts
+ *
+ * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
+ *
+ * @package Blank Page
+ * @since 1.0
+ */
+
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+
+	<?php seedlet_post_thumbnail(); ?>
+
+	<div class="entry-content">
+		<?php
+		the_content(
+			sprintf(
+				wp_kses(
+					/* translators: %s: Name of current post. Only visible to screen readers */
+					__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'blank-page' ),
+					array(
+						'span' => array(
+							'class' => array(),
+						),
+					)
+				),
+				get_the_title()
+			)
+		);
+
+		wp_link_pages(
+			array(
+				'before' => '<div class="page-links">' . __( 'Pages:', 'blank-page' ),
+				'after'  => '</div>',
+			)
+		);
+		?>
+	</div><!-- .entry-content -->
+
+</article><!-- #post-${ID} -->

+ 10 - 0
blank-page/variables.css

@@ -0,0 +1,10 @@
+:root {
+	/* Globals */
+	/* Font Family */
+	--global--font-primary: var(--font-headings, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif);
+	--global--font-secondary: var(--font-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif);
+	/* Colors */
+	--global--color-secondary: #007cba;
+	--global--color-secondary-hover: #006ba1;
+	--global--color-tertiary: #FAFAFA;
+}