Skip to content

Commit

Permalink
Add all CSS to the editor styles, add a rule to make the post content…
Browse files Browse the repository at this point in the history
… white, and reference the files locally
  • Loading branch information
scruffian committed Feb 18, 2021
1 parent c1384d9 commit 0912a97
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 133 deletions.
4 changes: 4 additions & 0 deletions penscratch-2/css/editor-blocks.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Description: Used to style Gutenberg Blocks in the editor.
1.0 General Typography
--------------------------------------------------------------*/

body {
background: #fff;
}

.block-editor-block-list__block,
.editor-default-block-appender textarea.editor-default-block-appender__content {
font-family: "Roboto Slab", Georgia, Times, serif;
Expand Down
297 changes: 164 additions & 133 deletions penscratch-2/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,113 +6,136 @@
*/

if ( ! function_exists( 'penscratch_2_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 penscratch_2_setup() {

/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Penscratch 2, use a find and replace
* to change 'penscratch-2' to the name of your theme in all the template files
/**
* 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.
*/
load_theme_textdomain( 'penscratch-2', get_template_directory() . '/languages' );
function penscratch_2_setup() {

/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Penscratch 2, use a find and replace
* to change 'penscratch-2' to the name of your theme in all the template files
*/
load_theme_textdomain( 'penscratch-2', get_template_directory() . '/languages' );

// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );

/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );

/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
add_image_size( 'penscratch-2-featured', '656', '300', true );

// This theme uses wp_nav_menu() in one location.
register_nav_menus(
array(
'menu-1' => esc_html__( 'Header', 'penscratch-2' ),
)
);

// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
)
);

/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
// Enable support for custom logo.
add_theme_support(
'custom-logo',
array(
'height' => 400,
'width' => 1200,
'flex-height' => true,
'flex-width' => true,
)
);

/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
add_image_size( 'penscratch-2-featured', '656', '300', true );
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );

// Setup the WordPress core custom background feature.
add_theme_support(
'custom-background',
apply_filters(
'penscratch_2_custom_background_args',
array(
'default-color' => 'eeeeee',
'default-image' => '',
)
)
);

// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'menu-1' => esc_html__( 'Header', 'penscratch-2' ),
) );
// Add support for responsive embeds.
add_theme_support( 'responsive-embeds' );

/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
) );

// Enable support for custom logo.
add_theme_support( 'custom-logo', array(
'height' => 400,
'width' => 1200,
'flex-height' => true,
'flex-width' => true
) );

// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );

// Setup the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'penscratch_2_custom_background_args', array(
'default-color' => 'eeeeee',
'default-image' => '',
) ) );

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

// Add custom colors to Gutenberg
add_theme_support(
'editor-color-palette', array(
array(
'name' => esc_html__( 'Dark Green', 'penscratch-2' ),
'slug' => 'dark-green',
'color' => '#1c7c7c',
),
array(
'name' => esc_html__( 'Dark Gray', 'penscratch-2' ),
'slug' => 'dark-gray',
'color' => '#666',
),
// Add custom colors to Gutenberg
add_theme_support(
'editor-color-palette',
array(
'name' => esc_html__( 'Medium Gray', 'penscratch-2' ),
'slug' => 'medium-gray',
'color' => '#999',
),
array(
'name' => esc_html__( 'Light Gray', 'penscratch-2' ),
'slug' => 'light-gray',
'color' => '#eee',
),
array(
'name' => esc_html__( 'White', 'penscratch-2' ),
'slug' => 'white',
'color' => '#fff',
),
)
);
array(
'name' => esc_html__( 'Dark Green', 'penscratch-2' ),
'slug' => 'dark-green',
'color' => '#1c7c7c',
),
array(
'name' => esc_html__( 'Dark Gray', 'penscratch-2' ),
'slug' => 'dark-gray',
'color' => '#666',
),
array(
'name' => esc_html__( 'Medium Gray', 'penscratch-2' ),
'slug' => 'medium-gray',
'color' => '#999',
),
array(
'name' => esc_html__( 'Light Gray', 'penscratch-2' ),
'slug' => 'light-gray',
'color' => '#eee',
),
array(
'name' => esc_html__( 'White', 'penscratch-2' ),
'slug' => 'white',
'color' => '#fff',
),
)
);

add_theme_support( 'editor-styles' );
add_editor_style( array(
get_theme_file_uri( '/css/editor-blocks.css' ),
penscratch_2_fonts_url()
) );
add_theme_support( 'editor-styles' );
add_editor_style(
array(
'style.css',
'/css/blocks.css',
'/css/editor-blocks.css',
penscratch_2_fonts_url(),
)
);

}
}
endif; // penscratch_2_setup
add_action( 'after_setup_theme', 'penscratch_2_setup' );

Expand Down Expand Up @@ -143,38 +166,46 @@ function penscratch_2_adjust_content_width() {
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
function penscratch_2_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'penscratch-2' ),
'id' => 'sidebar-1',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 1', 'penscratch-2' ),
'id' => 'sidebar-2',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 2', 'penscratch-2' ),
'id' => 'sidebar-3',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 3', 'penscratch-2' ),
'id' => 'sidebar-4',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );
register_sidebar(
array(
'name' => esc_html__( 'Sidebar', 'penscratch-2' ),
'id' => 'sidebar-1',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer 1', 'penscratch-2' ),
'id' => 'sidebar-2',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer 2', 'penscratch-2' ),
'id' => 'sidebar-3',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer 3', 'penscratch-2' ),
'id' => 'sidebar-4',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
)
);
}
add_action( 'widgets_init', 'penscratch_2_widgets_init' );

Expand Down Expand Up @@ -204,17 +235,17 @@ function penscratch_2_scripts() {
* Register Google Fonts
*/
function penscratch_2_fonts_url() {
$fonts_url = '';
$fonts_url = '';

/* Translators: If there are characters in your language that are not
* supported by Roboto Slab, translate this to 'off'. Do not translate
* into your own language.
*/
$robotoslab = esc_html_x( 'on', 'Roboto Slab font: on or off', 'penscratch-2' );

if ( 'off' !== $robotoslab ) {
if ( 'off' !== $robotoslab ) {

$font_families = array();
$font_families = array();
$font_families[] = 'Roboto Slab:300,400,700';

$query_args = array(
Expand Down

0 comments on commit 0912a97

Please sign in to comment.