Skip to content

Instantly share code, notes, and snippets.

@Kobe
Last active January 25, 2018 16:15
Show Gist options
  • Save Kobe/2b87a6175715124e8775 to your computer and use it in GitHub Desktop.
Save Kobe/2b87a6175715124e8775 to your computer and use it in GitHub Desktop.
deactivate anything in wp_head
<?php
// add theme support for
add_theme_support('html5');
add_theme_support('menus');
add_theme_support('post-formats', array(
'aside',
'image',
'link',
'status'
));
add_theme_support('post-thumbnails', array(
'page',
'post'
));
add_theme_support('title-tag');
// deactivate anything in wp_head
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
remove_action('wp_head', 'feed_links');
remove_action('wp_head', 'feed_links_extra');
remove_action('wp_head', 'index_rel_link' );
remove_action('wp_head', 'locale_stylesheet');
remove_action('wp_head', 'noindex');
remove_action('wp_head', 'parent_post_rel_link');
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_head', 'rest_output_link_wp_head');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'start_post_rel_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'wp_oembed_add_discovery_links');
remove_action('wp_head', 'wp_print_head_scripts');
remove_action('wp_head', 'wp_print_styles');
remove_action('wp_head', 'wp_shortlink_wp_head');
// deactivate misc stuff
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('admin_print_styles', 'print_emoji_styles');
remove_filter('comment_text_rss', 'wp_staticize_emoji');
remove_filter('the_content_feed', 'wp_staticize_emoji');
remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
remove_action('wp_print_styles', 'print_emoji_styles');
// deactivate filters
add_filter('login_errors', '__return_false');
add_filter('show_admin_bar','__return_false');
add_filter('the_generator', '__return_false');
add_filter('use_default_gallery_style', '__return_false');
// deactivate cookies
remove_action('set_comment_cookies', 'wp_set_comment_cookies');
// register menus
if (function_exists('register_nav_menus')) {
register_nav_menus(
array(
'navigation' => 'navigation',
'footer' => 'sub_navigation'
)
);
}
// favicons
function favicons() {
echo '
<link rel="apple-touch-icon" sizes="57x57" href="' . get_bloginfo('template_url') . '/images/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="' . get_bloginfo('template_url') . '/images/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="' . get_bloginfo('template_url') . '/images/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="' . get_bloginfo('template_url') . '/images/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="' . get_bloginfo('template_url') . '/images/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="' . get_bloginfo('template_url') . '/images/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="' . get_bloginfo('template_url') . '/images/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="' . get_bloginfo('template_url') . '/images/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="' . get_bloginfo('template_url') . '/images/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="' . get_bloginfo('template_url') . '/images/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="' . get_bloginfo('template_url') . '/images/favicons/favicon-194x194.png" sizes="194x194">
<link rel="icon" type="image/png" href="' . get_bloginfo('template_url') . '/images/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="' . get_bloginfo('template_url') . '/images/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="' . get_bloginfo('template_url') . '/images/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="' . get_bloginfo('template_url') . '/images/favicons/manifest.json">
<link rel="shortcut icon" href="' . get_bloginfo('template_url') . '/images/favicons/favicon.ico">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="' . get_bloginfo('template_url') . '/images/favicons/mstile-144x144.png">
<meta name="theme-color" content="#ffffff">
';
}
add_action('wp_head', 'favicons');
// remove the unsightly 'jump' from the read-more link
if (!function_exists('remove_more_jump_link')) :
function remove_more_jump_link($link) {
$offset = strpos($link, '#more-');
if ($offset) {
$end = strpos($link, '"',$offset);
}
if ($end) {
$link = substr_replace($link, '', $offset, $end-$offset);
}
return $link;
}
add_filter('the_content_more_link', 'remove_more_jump_link');
endif;
// import aqua image resizer
require_once('lib/aq_resizer.php');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment