Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create the TwentyTwenty Demo Site using Block Templates #5

Merged
merged 24 commits into from
Jan 20, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
83efbf0
Create header and footer parts for 2020
jffng Jan 10, 2020
b855bc2
Keep only what's needed to render the demo using block templates
jffng Jan 13, 2020
ee63a54
Merge branch 'master' into add/block-based-2020
jffng Jan 13, 2020
9e54320
Cleaned up header and footer styles
jffng Jan 14, 2020
05d26ee
Remove unneccessary assets for now
jffng Jan 15, 2020
549f86a
Include the demo site content
jffng Jan 15, 2020
3d7c28e
Remove non-core blocks
jffng Jan 17, 2020
b3c41b9
Rework starter content
jffng Jan 17, 2020
be44225
Make sure theme name is consistent
kjellr Jan 17, 2020
3a7986a
Minor indentation cleanup
kjellr Jan 17, 2020
3dac429
Avoid block stylesheet registration error.
kjellr Jan 17, 2020
b0b6481
Fix typo.
kjellr Jan 17, 2020
a463c09
Fix another typo 🙃
kjellr Jan 17, 2020
e209625
Remove starter content from block templates to make the example clearer
jffng Jan 17, 2020
e57ed3f
Futher simplify templates by moving the blocks for a blog page into s…
jffng Jan 17, 2020
c472488
Add Inter fonts and sample images.
kjellr Jan 20, 2020
c5b5f38
Remove about page template.
kjellr Jan 20, 2020
c0e10f0
Add post title to index.html
kjellr Jan 20, 2020
23e941d
Adopt starter content from the original Twenty Twenty.
kjellr Jan 20, 2020
71bcaea
Clean up page header styles.
kjellr Jan 20, 2020
7f8816f
Add white background behind page titles.
kjellr Jan 20, 2020
f46311c
Fix Latest Posts demo content.
kjellr Jan 20, 2020
776f088
Stylesheets cleanup.
kjellr Jan 20, 2020
eca2896
Update readme
kjellr Jan 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions twentytwenty-blocks/block-styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
.is-style-header-nav {
font-size: 1.8rem;
font-weight: 500;
letter-spacing: -0.0277em;
margin: -0.8rem 0 0 -1.6rem;
text-decoration: none;
}

.is-style-header-nav .wp-block-navigation-link {
margin: 0;
}

.is-style-header-nav .wp-block-navigation-link__content {
padding: 0;
margin: 0 16px 8px;
}

.is-style-header-site-title {
display: inline-block;
font-size: 2.4rem;
font-weight: 700;
line-height: 1;
margin-right: 2rem;
}

.entry-content > .is-style-landing-page-columns.alignfull,
.entry-content > .is-style-landing-page-columns.alignfull h1 {
margin: 0;
}

@media ( min-width: 700px ){
.entry-content > .is-style-landing-page-columns.alignfull h1 {
margin: 12rem 0 5rem;
}
}

.is-style-featured-media-home::before {
background: #fff;
content: "";
display: block;
position: absolute;
bottom: 50%;
left: 0;
right: 0;
top: 0;
}

.is-style-header-cover.wp-block-cover.alignfull {
align-items: flex-end;
background-attachment: fixed;
margin: 0;
min-height: 100vh;
}

.is-style-header-cover.wp-block-cover.alignfull .wp-block-cover__inner-container {
padding: 6rem 0;
}
79 changes: 79 additions & 0 deletions twentytwenty-blocks/block-template-parts/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<!-- wp:columns {"align":"wide","className":"footer-top"} -->
<div class="wp-block-columns alignwide footer-top"><!-- wp:column {"width":63} -->
<div class="wp-block-column" style="flex-basis:63%"><!-- wp:list {"className":"footer-menu reset-list-style"} -->
<ul class="footer-menu reset-list-style"><li><a href="/">Home</a></li><li><a href="/exhibitions">Exhibitions</a></li><li><a href="/about">About Us</a></li><li><a href="http://news">News</a></li></ul>
<!-- /wp:list --></div>
<!-- /wp:column -->

<!-- wp:column {"width":37} -->
<div class="wp-block-column" style="flex-basis:37%"><!-- wp:social-links {"align":"right","className":"social-icons footer-social"} -->
<ul class="wp-block-social-links alignright social-icons footer-social"><!-- wp:social-link-wordpress {"url":""} /-->

<!-- wp:social-link-facebook {"url":"facebook.com/wordpress"} /-->

<!-- wp:social-link-twitter {"url":"twitter.com/wordpress"} /-->

<!-- wp:social-link-instagram {"url":"https://www.instagram.com/explore/tags/wordcamp/"} /-->

<!-- wp:social-link-mail {"url":"mailto:[email protected]"} /-->

<!-- wp:social-link-mail /--></ul>
<!-- /wp:social-links --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

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

<!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide"><!-- wp:column {"className":"widget_text"} -->
<div class="wp-block-column widget_text"><!-- wp:heading {"level":3} -->
<h3>About the UMOMA</h3>
<!-- /wp:heading -->

<!-- wp:paragraph {"className":"widget-content widget-text"} -->
<p class="widget-content widget-text">In seven floors of striking architecture UMoMA shows exhibitions of international contemporary art, sometimes along with art historical retrospectives. Existential, political and philosophical issues are intrinsic to our programme. As visitor you are invited to guided tours, artist talks, lectures, film screenings and other events with free admission.</p>
<!-- /wp:paragraph -->

<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button {"textColor":"accent","customBackgroundColor":"#ffffff","className":"is-style-outline"} -->
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link has-text-color has-accent-color has-background" style="background-color:#ffffff">Read More</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons --></div>
<!-- /wp:column -->

<!-- wp:column {"className":"widget_text"} -->
<div class="wp-block-column widget_text"><!-- wp:heading {"level":3} -->
<h3>Find Us</h3>
<!-- /wp:heading -->

<!-- wp:paragraph {"className":"widget-content"} -->
<p class="widget-content"><strong>Address</strong><br>123 Main Street<br>New York, NY 10001</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"className":"widget-content"} -->
<p class="widget-content"><strong>Hours</strong><br>Monday—Friday: 9:00AM–5:00PM<br>Saturday &amp; Sunday: 11:00AM–3:00PM</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

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

<!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide"><!-- wp:column {"width":66.66,"className":"footer-credits"} -->
<div class="wp-block-column footer-credits" style="flex-basis:66.66%"><!-- wp:paragraph -->
<p><strong>© 2020</strong> <a href="https://combative-cheetah.jurassic.ninja/">TwentyTwenty</a></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"className":"powered-by-wordpress"} -->
<p class="powered-by-wordpress"><a href="https://wordpress.org">Powered by WordPress</a></p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"width":33.33} -->
<div class="wp-block-column" style="flex-basis:33.33%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->
26 changes: 26 additions & 0 deletions twentytwenty-blocks/block-template-parts/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!-- wp:columns {"align":"full"} -->
<div class="wp-block-columns alignfull"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:group -->
<h1 class="is-style-header-site-title">Twenty Twenty</h1>
<!-- /wp:heading -->

<!-- wp:paragraph {"className":"site-description"} -->
<p class="site-description">Just another WordPress site</p>
<!-- /wp:paragraph -->
<!-- /wp:group --></div>
<!-- /wp:column -->

<!-- wp:column -->
<div class="wp-block-column"><!-- wp:navigation {"className":"is-style-header-nav","itemsJustification":"right"} -->
<!-- wp:navigation-link {"label":"Home","title":"/the-new-umoma","type":"page","id":2,"url":"/the-new-umoma"} /-->

<!-- wp:navigation-link {"label":"Exhibitions","title":"Exhibitions","type":"page","id":57,"url":"http://twentytwenty.local/exhibitions/"} /-->

<!-- wp:navigation-link {"label":"About Us","title":"/about","type":"page","id":13,"url":"/about"} -->
<!-- wp:navigation-link {"label":"Contact","title":"/contact","url":"/contact"} /-->
<!-- /wp:navigation-link -->

<!-- wp:navigation-link {"label":"News","title":"News","type":"page","id":15,"url":"http://twentytwenty.local/blog/"} /-->
<!-- /wp:navigation --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->
11 changes: 11 additions & 0 deletions twentytwenty-blocks/block-templates/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<header class="site-header">
kjellr marked this conversation as resolved.
Show resolved Hide resolved
<!-- wp:template-part {"slug":"header","theme":"twentytwenty"} /-->
</header>

<main class="site-content">
<!-- wp:post-content /-->
</main>

<footer id="site-footer" class="site-footer">
<!-- wp:template-part {"slug":"footer","theme":"twentytwenty"} /-->
</footer>
11 changes: 11 additions & 0 deletions twentytwenty-blocks/block-templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<header class="site-header">
<!-- wp:template-part {"slug":"header","theme":"twentytwenty"} /-->
</header>

<main class="site-content">
<!-- wp:post-content /-->
</main>

<footer id="site-footer" class="site-footer">
<!-- wp:template-part {"slug":"footer","theme":"twentytwenty"} /-->
</footer>
178 changes: 178 additions & 0 deletions twentytwenty-blocks/functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
<?php
if ( ! function_exists( 'twentytwentyblocks_theme_support' ) ) :
function twentytwentyblocks_theme_support() {
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );

// Add support for Block Styles.
add_theme_support( 'wp-block-styles' );

// Add support for full and wide align images.
add_theme_support( 'align-wide' );

// Add support for editor styles.
add_theme_support( 'editor-styles' );

// Enqueue editor styles.
add_editor_style( 'twentytwenty-styles/style-editor.css' );

// Add custom editor font sizes.
add_theme_support(
'editor-font-sizes',
array(
array(
'name' => __( 'Small', 'twentytwenty' ),
'shortName' => __( 'S', 'twentytwenty' ),
'size' => 19.5,
'slug' => 'small',
),
array(
'name' => __( 'Normal', 'twentytwenty' ),
'shortName' => __( 'M', 'twentytwenty' ),
'size' => 22,
'slug' => 'normal',
),
array(
'name' => __( 'Large', 'twentytwenty' ),
'shortName' => __( 'L', 'twentytwenty' ),
'size' => 36.5,
'slug' => 'large',
),
array(
'name' => __( 'Huge', 'twentytwenty' ),
'shortName' => __( 'XL', 'twentytwenty' ),
'size' => 49.5,
'slug' => 'huge',
),
)
);

// Editor color palette.
add_theme_support(
'editor-color-palette',
array(
array(
'name' => __( 'Primary', 'twentytwenty' ),
'slug' => 'primary',
'color' => '#0073AA',
),
array(
'name' => __( 'Secondary', 'twentytwenty' ),
'slug' => 'secondary',
'color' => '#005177',
),
array(
'name' => __( 'Dark Gray', 'twentytwenty' ),
'slug' => 'dark-gray',
'color' => '#111',
),
array(
'name' => __( 'Light Gray', 'twentytwenty' ),
'slug' => 'light-gray',
'color' => '#767676',
),
array(
'name' => __( 'White', 'twentytwenty' ),
'slug' => 'white',
'color' => '#FFF',
),
)
);

// Add support for responsive embedded content.
add_theme_support( 'responsive-embeds' );

// Starter content
add_theme_support('starter-content', [
// Static front page set to Home, posts page set to Blog
'options' => [
'show_on_front' => 'page',
'page_on_front' => '{{home}}',
'page_for_posts' => '{{blog}}',
],
// Starter pages to include
'posts' => [
'home' => [
'post_content' => '<!-- wp:template-part {"slug":"home","theme":"twentytwentyblocks"} -->'
],
'about' => [
'post_content' => '<!-- wp:template-part {"slug":"about","theme":"twentytwentyblocks"} -->'
],
'contact' => [
'post_content' => '<!-- wp:template-part {"slug":"contact","theme":"twentytwentyblocks"} -->'
],
'blog'
]
]);

register_block_style_variations();
}

add_action( 'after_setup_theme', 'twentytwentyblocks_theme_support' );
endif;

/**
* Register and Enqueue Styles.
*/
function register_block_style_variations() {
/**
** Register stylesheet
**/
wp_register_style(
'block-styles-stylesheet',
get_template_directory_uri() . '/block-styles.css',
array(),
'1.1'
);

register_block_style(
'core/heading',
array(
'name' => 'header-site-title',
'label' => 'Header',
'style_handle' => 'block-styles-stylesheet',
)
);

register_block_style(
'core/columns',
array(
'name' => 'landing-page-columns',
'label' => 'Landing Page',
'style_handle' => 'block-styles-stylesheet',
)
);

register_block_style(
'core/image',
array(
'name' => 'featured-media-home',
'label' => 'Home',
'style_handle' => 'block-styles-stylesheet',
)
);

register_block_style(
'core/navigation',
array(
'name' => 'header-nav',
'label' => 'Header',
'style_handle' => 'block-styles-stylesheet',
)
);

register_block_style(
'core/cover',
array(
'name' => 'header-cover',
'label' => 'Header',
'style_handle' => 'block-styles-stylesheet',
)
);
}

function twentytwentyblocks_register_styles() {
$theme_version = wp_get_theme()->get( 'Version' );
wp_enqueue_style( 'twentytwentyblocks-style', get_stylesheet_uri(), array(), $theme_version );
}
add_action( 'wp_enqueue_scripts', 'twentytwentyblocks_register_styles' );
1 change: 1 addition & 0 deletions twentytwenty-blocks/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// this can be empty
Loading