ZX-Spectrum/functions.php

59 lines
1.7 KiB
PHP
Raw Permalink 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() . "/assets/css/styles.min.css", array(), wp_get_theme()->get( 'Version' ), 'all');
2023-01-09 23:36:46 +00:00
}
2023-01-09 23:36:46 +00:00
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 adds global inline styles
2023-01-09 23:36:46 +00:00
remove_action('wp_footer', 'wp_enqueue_global_styles', 1);
// remove render_block filters which add unnecessary stuff
2023-01-09 23:36:46 +00:00
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( 'hcb-style' );
wp_dequeue_style( 'hcb-style-inline' );
wp_dequeue_style( 'hcb-coloring' );
wp_dequeue_style( 'semantic-linkbacks' );
2023-01-09 23:36:46 +00:00
}
add_action( 'wp_enqueue_scripts', 'zxs_remove_block_library_css', 100 );
function zxs_register_menus() {
register_nav_menus(
array(
'home' => __( 'Home Menu' ),
)
);
}
add_action( 'init', 'zxs_register_menus' );