joseph-dickson.com/upgrading-kubrick-for-gutenberg
Upgrading Kubrick for Gutenberg
• Joseph Dickson• Twitter: @joe4ska• Website: joseph-dickson.com• Web Developer at Pitzer College• Inland Empire WordPress Meetup• Loves WordPress
joseph-dickson.com/upgrading-kubrick-for-gutenberg
The “Kubrick” Theme
joseph-dickson.com/upgrading-kubrick-for-gutenberg
The “Kubrick” Theme
• Michael Heilemann• WordPress 1.2 – 2.9• Default Theme from
2006-2010• Succeeded by the
TwentyTen Theme
joseph-dickson.com/upgrading-kubrick-for-gutenberg
2006
joseph-dickson.com/upgrading-kubrick-for-gutenberg
2006
joseph-dickson.com/upgrading-kubrick-for-gutenberg
The “Kubrick” Theme
• Easy to use• Clean design• Simple layout• Modern
joseph-dickson.com/upgrading-kubrick-for-gutenberg
The “Kubrick” Theme
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Things to Consider
• Would Gutenberg be beneficial?
• Would a redesign be easier?
• Are you ready to train new users?
• Blocks are quick to deploy.
• A new theme might solve old problems.
• Gutenberg has a strange workflow.
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Default Post Editor
• The default post editor is okay.
• What if it looked more like the live theme?
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Matching the Editor with the Theme
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Enqueue Block Styles
// Hook the enqueue functions into the editor
add_action( 'enqueue_block_editor_assets','block_editor_assets' );
// Hook the enqueue functions into the frontend and editor
add_action( 'enqueue_block_assets', 'editor-frontend-css' );
// Hook the enqueue functions into the frontend only
add_action( 'wp_enqueue_scripts', 'enqueue_theme_assets' );
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Enqueue Block Styles
// Enqueue theme CSS in Editor only.
function enqueue_block_editor_assets() {
wp_enqueue_style(
'gutenberg-editor-css',
get_stylesheet_directory_uri() . '/css/editor.css',
null,
time() // Change for production
);
}
add_action( 'enqueue_block_editor_assets', 'enqueue_block_editor_assets' );
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Default Block Styles
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Override the Post/Page Title
/* Block Title */
.editor-post-title__block .editor-post-title__input {
font-family: "Liberation Sans", sans-serif;
line-height: 1.4em;
}
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Override the Editor Width
/* Block Defaults and Width */
.wp-block {
font-family: "Liberation Sans", sans-serif;
line-height: 1.4em;
max-width: 480px;
}
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Override the Paragraph Block
/* Paragraph Block */
.editor-styles-wrapper p {
font-size: 13px !important;
line-height: 1.4 !important;
}
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Override the List Block
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Override the List Block
/* List Block */
.editor-styles-wrapper .mce-content-body {
line-height: 1.3 !important;
}
.block-library-list .editor-rich-text__tinymce {
font-size: 13px;
margin: 0;
padding: 0;
}
.block-library-list ol.editor-rich-text__tinymce {
margin: 0;
padding-left: 50px;
}
block-library-list ul.editor-rich-text__tinymce {
list-style: none;
margin-left: 0px;
padding: 0 0 0 30px;
padding-left: 10px;
text-indent: -10px;
}
.editor-block-list__block ul li {
list-style-type: none;
margin: 7px 0 8px 10px;
}
.editor-block-list__block ul li::before {
content: "\00BB \0020";
}
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Override the Blockquote
/* Quote Block */
.wp-block-quote:not(.is-large):not(.is-style-large) {
border-left: 5px solid #ddd;
margin: 15px 30px 0 10px;
padding-left: 20px;
color: #777;
}
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Block Inspection
• Unfortunately, there’s a lot of ‘Trial & Error’
• Some blocks force inline CSS in the editor and you’ll need to override them using !important
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Testing CSS Overrides
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Before & After
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Before & After
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Possible Next Steps
• Try customizing the width of the editor by overriding the class tag .wp-block
• Visit the Gutenberg Handbook
• Watch 2001: A Space Odyssey while coding
joseph-dickson.com/upgrading-kubrick-for-gutenberg
Upgrading Kubrick for Gutenberg
• Joseph Dickson• Twitter: @joe4ska• Website: joseph-dickson.com• Web Developer at Pitzer College• Inland Empire WordPress Meetup• Loves WordPress