ZX-Spectrum/functions.php

47 lines
1.6 KiB
PHP
Raw Normal View History

2023-01-09 23:36:46 +00:00
<?php
add_theme_support( 'title-tag' );
function zxs_add_themes() {
wp_enqueue_style('zxs_globals', get_stylesheet_directory_uri() . "/style.css", array(), wp_get_theme()->get( 'Version' ), 'all');
wp_enqueue_style('zxs_cubeCSS', get_stylesheet_directory_uri() . "/assets/css/cube.css", array(), wp_get_theme()->get( 'Version' ), 'all');
}
add_action('wp_enqueue_scripts', 'zxs_add_themes');
function zxs_add_class( $classes ) {
$classes = array_diff( $classes, array( 'flow' ) );
if ( ! is_singular() ) {
if ( 'page' !== get_post_type() ) {
$classes[] = 'flow';
}
}
return $classes;
}
add_filter('post_class', 'zxs_add_class');
add_action('after_setup_theme', function() {
// remove SVG and global styles
remove_action('wp_enqueue_scripts', 'wp_enqueue_global_styles');
// remove wp_footer actions which add's global inline styles
remove_action('wp_footer', 'wp_enqueue_global_styles', 1);
// remove render_block filters which adding unnecessary stuff
remove_filter('render_block', 'wp_render_duotone_support');
remove_filter('render_block', 'wp_restore_group_inner_container');
remove_filter('render_block', 'wp_render_layout_support_flag');
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
});
function zxs_remove_block_library_css() {
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wc-blocks-style' ); // Remove WooCommerce block CSS
// wp_dequeue_style( 'classic-theme-styles' );
}
add_action( 'wp_enqueue_scripts', 'zxs_remove_block_library_css', 100 );