Skip to content

Instantly share code, notes, and snippets.

@BurlesonBrad
Created October 26, 2015 23:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BurlesonBrad/814ca0264199d21cba8a to your computer and use it in GitHub Desktop.
Save BurlesonBrad/814ca0264199d21cba8a to your computer and use it in GitHub Desktop.
FOR MARCO
/* Marco, add all this to your child theme's functions.php file */
/* Bye Emoji :-( */
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' );
/* ...so sad */
/* Lets really optimize this js hooplah */
add_filter('script_loader_tag', 'add_defer_attribute', 10, 2);
function add_defer_attribute($tag) {
// array of scripts to async
$scripts_to_async = array('jquery.js', 'jquery-migrate.min.js', 'jscripts.php', 'navigation.min.js', 'jquery.stellar.min.js', 'counter.js', 'frontend-builder-global-functions.js', 'add-to-cart.min.js', 'jquery.blockUI.min.js', 'woocommerce.min.js', 'jquery.cookie.min.js', 'cart-fragments.min.js', 'custom.js', 'jquery.fitvids.js', 'waypoints.min.js', 'jquery.magnific-popup.js', '' );
foreach($scripts_to_async as $async_script){
if(true == strpos($tag, $async_script ) )
return str_replace( ' src', ' async="async" src', $tag );
}
return $tag;
}
/* End js optimization */
/* Marco, this will open a lot of doors to get to ALL the settings in your dashboard ~ TREAD LIGHTLY!!! */
function all_settings_link() {
add_options_page(__('All Settings'), __('All Settings'), 'administrator', 'options.php');
}
add_action('admin_menu', 'all_settings_link');
/* End All Setting Door */
/* Remove Superfluous info In The Head! */
function remove_header_info() {
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'wp_generator' );
remove_action( 'wp_head', 'start_post_rel_link' );
remove_action( 'wp_head', 'index_rel_link' );
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
}
add_action( 'init', 'remove_header_info' );
/* End Head optimization */
/* Let's remove those pesky script version numbers! */
function wpex_remove_script_version( $src ) {
if ( strpos( $src, 'ver=' ) ) {
$src = remove_query_arg( 'ver', $src );
}
return $src;
}
add_filter( 'script_loader_src', 'wpex_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', 'wpex_remove_script_version', 15, 1 );
/* End Script Version number tweak */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment