mfwpt/functions.php

88 lines
3.3 KiB
PHP
Raw Normal View History

<?php
// MFWPT - functions.php
// to do: clean this up
2019-11-12 19:01:18 -05:00
function mytheme_enqueue_style() {
wp_enqueue_style( 'style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'mytheme_enqueue_style' );
//set up the menus
2019-11-12 19:01:18 -05:00
2018-11-16 12:42:23 -05:00
function register_my_menus() {
register_nav_menus(
array(
'header-menu' => __( 'Header Menu' ),
'extra-menu' => __( 'Extra Menu' )
)
);
} // register_my_menus
add_action( 'init', 'register_my_menus' );
// remove unused word press features from header
function remove_actions_from_theme() {
// this removes a lot of the extras added in to <HEAD>
// it also probably breaks a lot of things
// remove_action('wp_head', 'rsd_link');
// remove_action('wp_head', 'wp_generator');
// remove_action('wp_head', 'feed_links', 2);
// remove_action('wp_head', 'index_rel_link');
// remove_action('wp_head', 'wlwmanifest_link');
// remove_action('wp_head', 'feed_links_extra', 3);
// remove_action('wp_head', 'start_post_rel_link', 10, 0);
// remove_action('wp_head', 'parent_post_rel_link', 10, 0);
// remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wc-block-style' );
wp_dequeue_style( 'global-styles' );
wp_dequeue_style( 'classic-theme-styles' );
wp_dequeue_style('core-block-supports');
remove_action( 'wp_head', '_wp_render_title_tag', 1);
// remove_action( 'wp_head', 'wp_enqueue_scripts', 1 );
remove_action( 'wp_head', 'wp_resource_hints', 2);
remove_action( 'wp_head', 'feed_links', 2);
remove_action( 'wp_head', 'feed_links_extra', 3);
remove_action( 'wp_head', 'rsd_link');
remove_action( 'wp_head', 'wlwmanifest_link');
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
remove_action( 'wp_head', 'locale_stylesheet');
remove_action( 'wp_head', 'noindex', 1);
remove_action( 'wp_head', 'print_emoji_detection_script', 7);
//remove_action( 'wp_head', 'wp_print_styles', 8 );
remove_action( 'wp_head', 'wp_print_head_scripts', 9);
remove_action( 'wp_head', 'wp_generator');
remove_action( 'wp_head', 'rel_canonical');
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0);
remove_action( 'wp_head', 'wp_custom_css_cb', 101);
remove_action( 'wp_head', 'wp_site_icon', 99);
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
remove_action( 'wp_footer', 'wp_enqueue_global_styles', 1 );
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
} // remove_actions_parent_theme
add_action( 'wp_enqueue_scripts', 'remove_actions_from_theme');
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
add_filter( 'wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2 );
} // disable_emojis
add_action( 'init', 'disable_emojis' );
2018-11-16 12:42:23 -05:00
add_action('wp_footer', function () {
wp_dequeue_style('core-block-supports');
});
?>