Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added Gutenberg support
  • Loading branch information
pfefferle committed Aug 24, 2017
1 parent 256a0fa commit b57ada0
Show file tree
Hide file tree
Showing 33 changed files with 89 additions and 131 deletions.
2 changes: 1 addition & 1 deletion archive.php
Expand Up @@ -27,7 +27,7 @@
* If you want to overload this in a child theme then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
get_template_part( 'templates/content', get_post_format() );
?>

<?php endwhile; ?>
Expand Down
12 changes: 0 additions & 12 deletions content-page.php

This file was deleted.

1 change: 0 additions & 1 deletion content.php

This file was deleted.

2 changes: 1 addition & 1 deletion css/editor-style.css

Large diffs are not rendered by default.

24 changes: 0 additions & 24 deletions full-width-page.php

This file was deleted.

24 changes: 20 additions & 4 deletions functions.php
Expand Up @@ -61,7 +61,10 @@ function zenpress_setup() {
// Register custom image size for image post formats.
add_image_size( 'zenpress-image-post', $content_width, 1288 );

// Switches default core markup for search form to output valid .
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support(
'html5',
array(
Expand All @@ -74,6 +77,16 @@ function zenpress_setup() {
)
);

add_theme_support( 'gutenberg', array(
'wide-images' => true,
'colors' => array(
'#0073aa',
'#229fd8',
'#eee',
'#444',
),
) );

// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'zenpress' ),
Expand Down Expand Up @@ -195,6 +208,9 @@ function zenpress_enqueue_scripts() {
// Loads our main stylesheet.
wp_enqueue_style( 'zenpress-style', get_stylesheet_uri() );

wp_dequeue_style( 'gutenbergthemeblocks-style' );
wp_dequeue_style( 'gutenbergtheme-fonts' );

wp_localize_script(
'zenpress',
'vars',
Expand Down Expand Up @@ -422,17 +438,17 @@ function zenpress_get_post_id() {
/**
* Adds the featured image functionality
*/
require( get_template_directory() . '/inc/featured-image.php' );
require( get_template_directory() . '/includes/featured-image.php' );

/**
* Adds some awesome websemantics like microformats(2) and microdata
*/
require( get_template_directory() . '/inc/semantics.php' );
require( get_template_directory() . '/includes/semantics.php' );

/**
* Adds back compat handling for older WP versions
*/
require( get_template_directory() . '/inc/compat.php' );
require( get_template_directory() . '/includes/compat.php' );

/**
* This theme was built with PHP, Semantic HTML, CSS, love, and ZenPress.
Expand Down
4 changes: 2 additions & 2 deletions header.php
Expand Up @@ -55,8 +55,8 @@
<div class="page-banner">
<?php if ( ! is_singular() ) : ?>
<div class="page-branding">
<?php get_template_part( 'partials/page', 'title' ); ?>
<?php get_template_part( 'partials/page', 'description' ); ?>
<?php get_template_part( 'templates/partials/page', 'title' ); ?>
<?php get_template_part( 'templates/partials/page', 'description' ); ?>
</div>
<?php endif; ?>
</div>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -26,7 +26,7 @@
* If you want to overload this in a child theme then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
get_template_part( 'templates/content', get_post_format() );
?>

<?php endwhile; ?>
Expand Down
2 changes: 1 addition & 1 deletion page.php
Expand Up @@ -17,7 +17,7 @@

<?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'content', 'page' ); ?>
<?php get_template_part( 'templates/content', 'single' ); ?>

<?php comments_template( '', true ); ?>

Expand Down
3 changes: 2 additions & 1 deletion sass/_base.scss
Expand Up @@ -132,7 +132,8 @@ hr {
pre {
margin-top: 50px;
margin-bottom: 50px;
background-color: $background-gray;
background-color: #000;
color: #fff;
display: block;
padding: 50px;
white-space: pre-wrap;
Expand Down
6 changes: 4 additions & 2 deletions sass/_media.scss
Expand Up @@ -2,19 +2,21 @@
.alignleft {
display: inline;
float: left;
margin-right: 1em;
margin-right: 1.2em;
margin-top: .3em;
}

.alignright {
display: inline;
float: right;
margin-left: 1em;
margin-left: 1.2em;
margin-top: .3em;
}

.aligncenter,
.alignnone,
.alignfull,
.alignwide,
.wp-post-image {
clear: both;
display: block;
Expand Down
3 changes: 1 addition & 2 deletions sass/_page.scss
Expand Up @@ -6,7 +6,7 @@

.site-branding {
margin: 0 auto;
width: $wide-width;
width: $default-width;

@include clearfix;
}
Expand Down Expand Up @@ -81,7 +81,6 @@
#primary {
display: block;
margin: 0 auto;
width: $wide-width;
}

#colophon {
Expand Down
63 changes: 21 additions & 42 deletions sass/_responsive_wide.scss
@@ -1,10 +1,5 @@
#primary,
.site-navigation,
.site-header .site-branding,
.site-header .page-banner #page-description,
.site-header .page-banner #page-title,
#sidebar {
width: $wide-width;
#primary {
width: 100%;
}

.entry-content > *,
Expand All @@ -14,56 +9,45 @@
#comments,
#nav-above,
#nav-below {
margin-left: $margin;
margin-right: $margin;
}

.entry-content > div,
.entry-content > audio {
margin-left: 0px;
margin-right: 0px;
padding-left: $margin;
padding-right: $margin;
}

.entry-content > table,
.entry-content > pre {
margin-left: 0px;
margin-right: 0px;
width: $default-width;
margin: 1.2em auto;
}

.entry-content,
.entry-summary {
> object,
> embed,
> iframe,
> figure {
margin: 0 auto;
max-width: 100%;
> figure,
> table,
> pre {
width: $wide-width;
}
}

figure {
&.alignleft,
&.alignright {
padding: 0;
margin: 0;
.entry-content,
.entry-summary {
.wp-block-cover-image,
.alignfull {
width: 100%;
}
}

figure {
&.alignleft {
display: inline;
float: left;
margin-right: 1em;
width: $default-width / 2;
margin-top: .3em;
margin-left: $margin;
margin-right: 1.2em;
margin-left: calc( 50% - 350px );
}

&.alignright {
display: inline;
float: right;
margin-left: 1em;
width: $default-width / 2;
margin-top: .3em;
margin-right: $margin;
margin-left: 1.2em;
margin-right: calc( 50% - 350px );
}
}

Expand Down Expand Up @@ -114,8 +98,3 @@ figure {
}
}
}

.wp-audio-shortcode {
margin: 1em $margin !important;
width: $default-width - (2 * $margin) !important;
}
2 changes: 1 addition & 1 deletion single.php
Expand Up @@ -12,7 +12,7 @@

<?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'content', get_post_format() ); ?>
<?php get_template_part( 'templates/content', get_post_format() ); ?>

<?php
// If comments are open or we have at least one comment, load up the comment template
Expand Down
29 changes: 13 additions & 16 deletions style.css
Expand Up @@ -200,7 +200,7 @@ button:active, input[type="button"]:active, input[type="submit"]:active, input[t
.search-form .search-submit { display: none; }

.site-header { display: block; position: relative; width: 100%; border-bottom: 1px solid #d1d5d7; }
.site-header .site-branding { margin: 0 auto; width: 900px; }
.site-header .site-branding { margin: 0 auto; width: 700px; }
.site-header .site-branding:before, .site-header .site-branding:after { content: ' '; display: table; }
.site-header .site-branding:after { clear: both; }
.site-header .custom-logo { margin-top: 25px; margin-right: 5px; vertical-align: top; }
Expand All @@ -213,7 +213,7 @@ button:active, input[type="button"]:active, input[type="submit"]:active, input[t
.site-header .page-banner #page-title { font-size: 2em; font-weight: bold; }
.site-header .search-form { display: inline-block; margin: 20px 0 20px 0; padding: 0; float: right; }

#primary { display: block; margin: 0 auto; width: 900px; }
#primary { display: block; margin: 0 auto; }

#colophon { width: 100%; background-color: #fafafb; margin-top: 100px; }
#colophon:before, #colophon:after { content: ' '; display: table; }
Expand Down Expand Up @@ -397,11 +397,11 @@ table tbody tr:nth-child(odd) td, table tbody tr:nth-child(odd) th { background-

table tbody tr:hover td, table tbody tr:hover th { background-color: #fafafb; }

.alignleft { display: inline; float: left; margin-right: 1em; margin-top: .3em; }
.alignleft { display: inline; float: left; margin-right: 1.2em; margin-top: .3em; }

.alignright { display: inline; float: right; margin-left: 1em; margin-top: .3em; }
.alignright { display: inline; float: right; margin-left: 1.2em; margin-top: .3em; }

.aligncenter, .alignnone, .wp-post-image { clear: both; display: block; margin: 1em auto; text-align: center; max-width: 100%; height: auto; }
.aligncenter, .alignnone, .alignfull, .alignwide, .wp-post-image { clear: both; display: block; margin: 1em auto; text-align: center; max-width: 100%; height: auto; }

.size-auto, .size-full, .size-large, .size-medium, .size-thumbnail { max-width: 100%; height: auto; }

Expand Down Expand Up @@ -477,7 +477,7 @@ h6 { font-size: 1.4em; }

hr { display: block; width: 200px; margin: 40px auto !important; border: 0; border-top: 1px solid #d1d5d7; text-align: center; }

pre { margin-top: 50px; margin-bottom: 50px; background-color: #fafafb; display: block; padding: 50px; white-space: pre-wrap; word-wrap: break-word; }
pre { margin-top: 50px; margin-bottom: 50px; background-color: #000; color: #fff; display: block; padding: 50px; white-space: pre-wrap; word-wrap: break-word; }

.hidden { display: none !important; visibility: hidden; }

Expand All @@ -496,19 +496,16 @@ pre { margin-top: 50px; margin-bottom: 50px; background-color: #fafafb; display:
#nav-below .nav-previous { bottom: 20px; z-index: 1; }
#nav-below .nav-next { bottom: 20px; z-index: 1; } }
@media only screen and (min-width: 800px) { #primary, .site-navigation, .site-header .site-branding, .site-header .page-banner #page-description, .site-header .page-banner #page-title, #sidebar { width: 700px; } }
@media only screen and (min-width: 900px) { #primary, .site-navigation, .site-header .site-branding, .site-header .page-banner #page-description, .site-header .page-banner #page-title, #sidebar { width: 900px; }
.entry-content > *, .entry-summary > *, .entry-header, .entry-footer, #comments, #nav-above, #nav-below { margin-left: 100px; margin-right: 100px; }
.entry-content > div, .entry-content > audio { margin-left: 0px; margin-right: 0px; padding-left: 100px; padding-right: 100px; }
.entry-content > table, .entry-content > pre { margin-left: 0px; margin-right: 0px; }
.entry-content > object, .entry-content > embed, .entry-content > iframe, .entry-content > figure, .entry-summary > object, .entry-summary > embed, .entry-summary > iframe, .entry-summary > figure { margin: 0 auto; max-width: 100%; }
figure.alignleft, figure.alignright { padding: 0; margin: 0; }
figure.alignleft { display: inline; float: left; margin-right: 1em; margin-top: .3em; margin-left: 100px; }
figure.alignright { display: inline; float: right; margin-left: 1em; margin-top: .3em; margin-right: 100px; }
@media only screen and (min-width: 900px) { #primary { width: 100%; }
.entry-content > *, .entry-summary > *, .entry-header, .entry-footer, #comments, #nav-above, #nav-below { width: 700px; margin: 1.2em auto; }
.entry-content > object, .entry-content > embed, .entry-content > iframe, .entry-content > figure, .entry-content > table, .entry-content > pre, .entry-summary > object, .entry-summary > embed, .entry-summary > iframe, .entry-summary > figure, .entry-summary > table, .entry-summary > pre { width: 900px; }
.entry-content .wp-block-cover-image, .entry-content .alignfull, .entry-summary .wp-block-cover-image, .entry-summary .alignfull { width: 100%; }
figure.alignleft { float: left; width: 350px; margin-top: .3em; margin-right: 1.2em; margin-left: calc( 50% - 350px ); }
figure.alignright { float: right; width: 350px; margin-top: .3em; margin-left: 1.2em; margin-right: calc( 50% - 350px ); }
.alignright figcaption { display: block; height: 68px; right: -100px; margin-top: 0px; position: absolute; text-align: left; top: 0px; width: 80px; word-break: break-word; word-wrap: break-word; }
.alignright figcaption:before { width: 25%; margin-right: 75%; border-top: 1px solid #677275; display: block; content: ""; margin-bottom: 10px; }
.alignleft figcaption { display: block; height: 68px; left: -100px; margin-top: 0px; position: absolute; text-align: right; top: 0px; width: 80px; word-break: break-word; word-wrap: break-word; }
.alignleft figcaption:before { width: 25%; margin-left: 75%; border-top: 1px solid rgba(0, 0, 0, 0.15); display: block; content: ""; margin-bottom: 10px; }
.wp-audio-shortcode { margin: 1em 100px !important; width: 500px !important; } }
.alignleft figcaption:before { width: 25%; margin-left: 75%; border-top: 1px solid rgba(0, 0, 0, 0.15); display: block; content: ""; margin-bottom: 10px; } }
/* ========================================================================== Print styles. Inlined to avoid the additional HTTP request: http://www.phpied.com/delay-loading-your-print-css/ ========================================================================== */
@media print { *, *:before, *:after, *:first-letter, *:first-line { background: transparent !important; color: #000 !important; /* Black prints faster:
http://www.sanbeiji.com/archives/953 */ box-shadow: none !important; text-shadow: none !important; }
Expand Down
4 changes: 2 additions & 2 deletions content-aside.php → templates/content-aside.php
Expand Up @@ -10,7 +10,7 @@
?>

<aside <?php zenpress_post_id(); ?> <?php post_class(); ?><?php zenpress_semantics( 'post' ); ?>>
<?php get_template_part( 'partials/content', 'header' ); ?>
<?php get_template_part( 'templates/partials/content', 'header' ); ?>

<?php if ( is_search() ) : // Only display Excerpts for search pages ?>
<div class="entry-summary p-summary entry-title p-name" itemprop="name description articleBody">
Expand All @@ -24,5 +24,5 @@
</div><!-- .entry-content -->
<?php endif; ?>

<?php get_template_part( 'partials/content', 'footer' ); ?>
<?php get_template_part( 'templates/partials/content', 'footer' ); ?>
</aside><!-- #post-<?php the_ID(); ?> -->
4 changes: 2 additions & 2 deletions content-audio.php → templates/content-audio.php
Expand Up @@ -10,7 +10,7 @@
?>

<article <?php zenpress_post_id(); ?> <?php post_class(); ?><?php zenpress_semantics( 'post' ); ?>>
<?php get_template_part( 'partials/content', 'header' ); ?>
<?php get_template_part( 'templates/partials/content', 'header' ); ?>

<?php if ( is_search() ) : // Only display Excerpts for Search ?>
<div class="entry-summary p-summary" itemprop="description articleBody">
Expand All @@ -28,5 +28,5 @@
</div><!-- .entry-content -->
<?php endif; ?>

<?php get_template_part( 'partials/content', 'footer' ); ?>
<?php get_template_part( 'templates/partials/content', 'footer' ); ?>
</article><!-- #post-<?php the_ID(); ?> -->

0 comments on commit b57ada0

Please sign in to comment.