Last active
May 3, 2021 06:59
-
-
Save Dorf/a9a0867660739a8cfeffb9d47cd47c9f to your computer and use it in GitHub Desktop.
[Roots Sage starting admin functions] add Color Palette, Gutenberg editor styles, and basic Intervention commands #sage #roots #admin #intervention #gutenberg #editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Admin assets | |
*/ | |
add_action('admin_enqueue_scripts', function () { | |
// global $post; | |
// $my_post_type = 'page'; | |
if ( stristr( $_SERVER['REQUEST_URI'], 'post.php' ) !== false // just for the post editor | |
// && is_object( $post ) | |
// && $my_post_type == get_post_type( $post->ID ) | |
) { | |
wp_enqueue_style('custom_bpg_admin_css', asset_path('styles/admin.css'), false); | |
} | |
}, 10); | |
add_action('login_enqueue_scripts', function () { | |
wp_enqueue_style('custom_bpg_admin_css', asset_path('styles/admin.css'), false); | |
}, 10); | |
/** | |
* Registers an editor stylesheet for the current theme. | |
*/ | |
// add_action( 'enqueue_block_assets', function() { | |
// // $morpheusstyles = 'dist/styles/admin.css'; | |
// // $font_url = str_replace( ',', '%2C', '//fonts.googleapis.com/css?family=Lato:300,400,700' ); | |
// // add_editor_style( $morpheusstyles ); | |
// add_editor_style( asset_path('styles/admin.css')); | |
// }); | |
// https://github.com/soberwp/intervention | |
use function \Sober\Intervention\intervention; | |
if (function_exists('\Sober\Intervention\intervention')) { | |
// now you can use the function to call the required modules and their params | |
// intervention('update-label-post', ['Projects', 'Project', 'dashicons-welcome-view-site']); | |
//intervention('add-acf-page', [ | |
// 'page_title' => 'Site & Homepage', | |
// 'menu_title' => 'Site Settings', | |
// 'menu_slug' => 'site-settings' | |
// ], ['admin', 'editor']); | |
intervention('remove-user-roles', ['contributor', 'subscriber']); | |
intervention('remove-widgets', ['calendar', 'links', 'meta', 'tag-cloud']); | |
intervention('remove-howdy'); | |
intervention('remove-emoji'); | |
intervention('remove-menu-items', ['comments', 'setting-disable-comments']); | |
// intervention('remove-taxonomies', ['category', 'tag']); | |
intervention('remove-toolbar-items', ['logo', 'comments', 'updates']); | |
intervention('add-svg-support', ['admin', 'editor']); | |
intervention('update-label-footer', 'Created by bpgagency.com'); | |
} | |
// Adds support for editor color palette in Gutenberg, | |
// https://wordpress.org/gutenberg/handbook/designers-developers/developers/themes/theme-support/ | |
add_theme_support( 'editor-color-palette', array( | |
array( | |
'name' => __( 'Primary Blue', 'themeLangDomain' ), | |
'slug' => 'primary-blue', | |
'color' => '#2281bd', | |
), | |
array( | |
'name' => __( 'Dark Blue', 'themeLangDomain' ), | |
'slug' => 'dark-blue', | |
'color' => '#29516c', | |
), | |
array( | |
'name' => __( 'Light Blue', 'themeLangDomain' ), | |
'slug' => 'Light Blue', | |
'color' => '#8ccff9', | |
), | |
array( | |
'name' => __( 'Base Grey', 'themeLangDomain' ), | |
'slug' => 'base-grey', | |
'color' => '#595959', | |
), | |
array( | |
'name' => __( 'Accent Yellow', 'themeLangDomain' ), | |
'slug' => 'accent-yellow', | |
'color' => '#eaa660', | |
), | |
array( | |
'name' => __( 'Black', 'themeLangDomain' ), | |
'slug' => 'black', | |
'color' => '#000000', | |
), | |
) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment