create custom css file that loads on editor and frontend
This commit is contained in:
parent
289ebea30b
commit
02b9d53f27
0
assets/css/custom.css
Normal file
0
assets/css/custom.css
Normal file
110
functions.php
110
functions.php
@ -1,58 +1,16 @@
|
||||
<?php
|
||||
|
||||
/* Remove default CSS variables that come with Wordpress
|
||||
https://github.com/WordPress/gutenberg/issues/56180#issuecomment-1819222376
|
||||
*/
|
||||
function custom_wp_theme_json_default( $theme_json ) {
|
||||
$new_data = array(
|
||||
'version' => 2,
|
||||
'settings' => array(
|
||||
'color' => array(
|
||||
'palette' => array(),
|
||||
'gradients' => array(),
|
||||
),
|
||||
'shadow' => array(
|
||||
'presets' => array(),
|
||||
),
|
||||
'typography' => array(
|
||||
'fontSizes' => array(),
|
||||
),
|
||||
// 'dimensions' => array(
|
||||
// 'aspectRatios' => array(),
|
||||
// ),
|
||||
// 'spacing' => array(
|
||||
// 'spacingScale' => array(
|
||||
// 'steps' => 0,
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
);
|
||||
return $theme_json->update_with( $new_data );
|
||||
// enqueue custom css on front-end and editor
|
||||
function jett_editor_css() {
|
||||
add_editor_style( get_theme_file_uri('/assets/css/custom.css') );
|
||||
}
|
||||
add_filter( 'wp_theme_json_data_default', 'custom_wp_theme_json_default' );
|
||||
add_action( 'after_setup_theme', 'twentytwentytwo_support' );
|
||||
|
||||
// enable svg uploads
|
||||
add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {
|
||||
|
||||
global $wp_version;
|
||||
if ( $wp_version !== '4.7.1' ) {
|
||||
return $data;
|
||||
function jett_frontend_css() {
|
||||
wp_enqueue_style('jett_css', get_theme_file_uri('/assets/css/custom.css'));
|
||||
}
|
||||
add_action('wp_enqueue_scripts', 'jett_frontend_css');
|
||||
|
||||
$filetype = wp_check_filetype( $filename, $mimes );
|
||||
|
||||
return [
|
||||
'ext' => $filetype['ext'],
|
||||
'type' => $filetype['type'],
|
||||
'proper_filename' => $data['proper_filename']
|
||||
];
|
||||
|
||||
}, 10, 4 );
|
||||
function cc_mime_types($mimes) {
|
||||
$mimes['svg'] = 'image/svg+xml';
|
||||
return $mimes;
|
||||
}
|
||||
add_filter('upload_mimes', 'cc_mime_types');
|
||||
|
||||
// define block styles
|
||||
function jett_block_styles() {
|
||||
@ -133,3 +91,57 @@ function jett_block_styles() {
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'jett_block_styles' );
|
||||
|
||||
/* Remove default CSS variables that come with Wordpress
|
||||
https://github.com/WordPress/gutenberg/issues/56180#issuecomment-1819222376
|
||||
*/
|
||||
function custom_wp_theme_json_default( $theme_json ) {
|
||||
$new_data = array(
|
||||
'version' => 2,
|
||||
'settings' => array(
|
||||
'color' => array(
|
||||
'palette' => array(),
|
||||
'gradients' => array(),
|
||||
),
|
||||
'shadow' => array(
|
||||
'presets' => array(),
|
||||
),
|
||||
'typography' => array(
|
||||
'fontSizes' => array(),
|
||||
),
|
||||
// 'dimensions' => array(
|
||||
// 'aspectRatios' => array(),
|
||||
// ),
|
||||
// 'spacing' => array(
|
||||
// 'spacingScale' => array(
|
||||
// 'steps' => 0,
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
);
|
||||
return $theme_json->update_with( $new_data );
|
||||
}
|
||||
add_filter( 'wp_theme_json_data_default', 'custom_wp_theme_json_default' );
|
||||
|
||||
// enable svg uploads
|
||||
add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {
|
||||
|
||||
global $wp_version;
|
||||
if ( $wp_version !== '4.7.1' ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$filetype = wp_check_filetype( $filename, $mimes );
|
||||
|
||||
return [
|
||||
'ext' => $filetype['ext'],
|
||||
'type' => $filetype['type'],
|
||||
'proper_filename' => $data['proper_filename']
|
||||
];
|
||||
|
||||
}, 10, 4 );
|
||||
function cc_mime_types($mimes) {
|
||||
$mimes['svg'] = 'image/svg+xml';
|
||||
return $mimes;
|
||||
}
|
||||
add_filter('upload_mimes', 'cc_mime_types');
|
||||
|
Loading…
Reference in New Issue
Block a user