adds new functions file to declare gutenberg support

This commit is contained in:
Brian Coords 2021-06-29 15:33:48 -07:00
parent 42cbbc959a
commit 2c4a19f4be
2 changed files with 90 additions and 0 deletions

View File

@ -25,6 +25,7 @@ $understrap_includes = array(
'/custom-comments.php', // Custom Comments file.
'/class-wp-bootstrap-navwalker.php', // Load custom WordPress nav walker. Trying to get deeper navigation? Check out: https://github.com/understrap/understrap/issues/567.
'/editor.php', // Load Editor functions.
'/block-editor.php', // Load Block Editor functions.
'/deprecated.php', // Load deprecated functions.
);

89
inc/block-editor.php Normal file
View File

@ -0,0 +1,89 @@
<?php
/**
* Block editor (gutenberg) specific functionality
*
* @package UnderStrap
*/
add_action( 'after_setup_theme', 'understrap_block_editor_setup' );
if ( ! function_exists( 'understrap_block_editor_setup' ) ) {
/**
* Sets up our default theme support for the WordPress block editor.
*
*/
function understrap_block_editor_setup() {
// Add support for the block editor stylesheet.
add_theme_support( 'editor-styles' );
// Add support for wide alignment.
add_theme_support( 'align-wide' );
/**
* Filters the default bootstrap color palette so it can be overriden by child themes or plugins when we add theme support for editor-color-palette
*
* @param array $color_palette An array of color options for the editor-color-palette setting.
*/
$color_palette = apply_filters(
'understrap_theme_editor_color_palette',
array(
array(
'name' => esc_attr__( 'blue', 'understrap' ),
'slug' => 'blue',
'color' => '#007bff',
),
array(
'name' => esc_attr__( 'indigo', 'understrap' ),
'slug' => 'indigo',
'color' => '#6610f2',
),
array(
'name' => esc_attr__( 'purple', 'understrap' ),
'slug' => 'purple',
'color' => '#5533ff', // Note: See /_theme_variables.scss for our purple override.
),
array(
'name' => esc_attr__( 'pink', 'understrap' ),
'slug' => 'pink',
'color' => '#e83e8c',
),
array(
'name' => esc_attr__( 'red', 'understrap' ),
'slug' => 'red',
'color' => '#dc3545',
),
array(
'name' => esc_attr__( 'orange', 'understrap' ),
'slug' => 'orange',
'color' => '#fd7e14',
),
array(
'name' => esc_attr__( 'yellow', 'understrap' ),
'slug' => 'yellow',
'color' => '#ffc107',
),
array(
'name' => esc_attr__( 'green', 'understrap' ),
'slug' => 'green',
'color' => '#28a745',
),
array(
'name' => esc_attr__( 'teal', 'understrap' ),
'slug' => 'teal',
'color' => '#20c997',
),
array(
'name' => esc_attr__( 'cyan', 'understrap' ),
'slug' => 'cyan',
'color' => '#17a2b8',
),
)
);
// Register our custom colors as options in the editor.
add_theme_support( 'editor-color-palette', $color_palette );
}
}