stage custom.css better
This commit is contained in:
@ -7,17 +7,57 @@ function disable_default_patterns()
|
|||||||
add_action('after_setup_theme', 'disable_default_patterns');
|
add_action('after_setup_theme', 'disable_default_patterns');
|
||||||
|
|
||||||
|
|
||||||
function somos_infinitos_custom_css() {
|
/**
|
||||||
if ( ! is_admin() || is_customize_preview() ) {
|
* Enqueue custom CSS file in block editor only
|
||||||
|
*/
|
||||||
|
function somos_infinitos_block_editor_styles() {
|
||||||
|
// Only load in block editor, not in classic editor
|
||||||
|
if (!is_classic_editor_active()) {
|
||||||
wp_enqueue_style(
|
wp_enqueue_style(
|
||||||
'my-custom-style',
|
'somos-infinitos-block-editor-styles',
|
||||||
get_template_directory_uri() . '/assets/css/custom.css',
|
get_template_directory_uri() . '/assets/css/custom.css',
|
||||||
array(),
|
array(),
|
||||||
'1.0'
|
'1.0'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add_action( 'enqueue_block_assets', 'somos_infinitos_custom_css' );
|
add_action('enqueue_block_editor_assets', 'somos_infinitos_block_editor_styles');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if classic editor is active
|
||||||
|
*/
|
||||||
|
function is_classic_editor_active() {
|
||||||
|
// Check if the classic editor plugin is active
|
||||||
|
if (class_exists('Classic_Editor')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we're on the classic editor screen
|
||||||
|
if (function_exists('get_current_screen')) {
|
||||||
|
$screen = get_current_screen();
|
||||||
|
if ($screen && $screen->is_block_editor() === false && $screen->base === 'post') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue custom CSS file on the frontend
|
||||||
|
*/
|
||||||
|
function somos_infinitos_frontend_styles() {
|
||||||
|
// Don't load in admin
|
||||||
|
if (!is_admin()) {
|
||||||
|
wp_enqueue_style(
|
||||||
|
'somos-infinitos-custom-styles',
|
||||||
|
get_template_directory_uri() . '/assets/css/custom.css',
|
||||||
|
array(),
|
||||||
|
'1.0'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action('wp_enqueue_scripts', 'somos_infinitos_frontend_styles');
|
||||||
|
|
||||||
// enable svg uploads
|
// enable svg uploads
|
||||||
add_filter('wp_check_filetype_and_ext', function ($data, $file, $filename, $mimes) {
|
add_filter('wp_check_filetype_and_ext', function ($data, $file, $filename, $mimes) {
|
||||||
|
|||||||
Reference in New Issue
Block a user