Last active
June 9, 2017 11:53
-
-
Save BurlesonBrad/7033b03415b76787119638cf1a5ef0be to your computer and use it in GitHub Desktop.
For Nick at http://www.doomtree.net
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Tons Of Fun for Nick | |
* Plugin URI: https://yourmom.com | |
* Description: A Drop In Plugin That'll speed the sh_t outta your site. No options, just ACTIVE or INCACTIVE :-) | |
* Version: 1 | |
* Author: Brad | |
* Author URI: https://yourmom.com | |
* Requires at least: 4.5 | |
* Tested up to: 4.5 | |
**/ | |
/* Nick this Kills of Admin Ajax */ | |
/* It's gonna completely kill off any and all admin-ajax.php options */ | |
/* Autosave & Locking Live Edits to Only ONE person will be disabled */ | |
/* If you know you ain't ever gonna need those two options, leave 'em DISABLED & leave this plugin ACTIVE */ | |
add_action( 'init', 'stop_the_dang_heartbeat_permanently', 1 ); | |
function stop_the_dang_heartbeat_permanently() { | |
wp_deregister_script('heartbeat'); | |
} | |
/* End Heartbeat */ | |
/* Nick, if for some unknown reason, you really like those stupid emojis, simply add the forward slash and the asterisks */ | |
/* 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 */ | |
/* Customize All Text */ | |
/* Simply drop this file into your plugins folder via FTP or add the code to your child themes functions.php */ | |
/* See the pattern below? Take the text you want to change & put in between the single quote right after the word case */ | |
/* Now add the NEW text that you want on the next line between the single quotes */ | |
function bkg_text_strings( $translated_text, $text, $domain ) { | |
switch ( $translated_text ) { | |
case 'Cart Totals' : | |
$translated_text = __( 'Here are your items!', 'woocommerce' ); | |
break; | |
} | |
switch ( $translated_text ) { | |
case 'Billing Details' : | |
$translated_text = __( 'Lets Talk About You', 'woocommerce' ); | |
break; | |
} | |
switch ( $translated_text ) { | |
case 'Your order' : | |
$translated_text = __( 'Sweetness! Here Are Your Items!', 'woocommerce' ); | |
break; | |
} | |
switch ( $translated_text ) { | |
case 'Shop' : | |
$translated_text = __( 'Grab Whatever You Need!', 'woocommerce' ); | |
break; | |
} | |
switch ( $translated_text ) { | |
case 'Add To Cart' : | |
$translated_text = __( 'Heck Yeah!', 'woocommerce' ); | |
break; | |
} | |
switch ( $translated_text ) { | |
case 'No products in the cart.' : | |
$translated_text = __( 'Awww. Look at that lonely Cart. It seems so Empty!', 'woocommerce' ); | |
break; | |
} | |
switch ( $translated_text ) { | |
case 'Your cart is currently empty.' : | |
$translated_text = __( 'Your Cart Seems So Empty. Lets fill it Up!', 'woocommerce' ); | |
break; | |
} | |
switch ( $translated_text ) { | |
case 'Continue to payment' : | |
$translated_text = __( 'Great Job! Now Click Here To Finish!', 'woocommerce' ); | |
break; | |
} | |
return $translated_text; | |
} | |
/* Seriously Nick. Your database is gonna have enough rows. You really do NOT need to store a gazillion post revisions */ | |
/* BEGIN stop storing post revisions */ | |
define( 'WP_POST_REVISIONS', -1 ); | |
/* END stop storing post revisions */ | |
/* https://bradgriffin.me/proceed-to-checkout */ | |
/* Move Proceed to Checkout button on cart page */ | |
add_action( 'woocommerce_cart_actions', 'move_proceed_button' ); | |
function move_proceed_button( $checkout ) { | |
echo '<a href="' . esc_url( WC()->cart->get_checkout_url() ) . '" class="checkout-button button alt wc-forward" >' . __( 'Proceed to Checkout', 'woocommerce' ) . '</a>'; | |
} | |
/* END Move Proceed to Checkout button on cart page */ | |
/** | |
* Optimize WooCommerce Scripts | |
* This will stop any WooCommerce from loading and running when your NOT on a WooCommerce page or product post type. | |
*/ | |
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 ); | |
function child_manage_woocommerce_styles() { | |
//remove generator meta tag | |
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) ); | |
//first check that woo exists to prevent fatal errors | |
if ( function_exists( 'is_woocommerce' ) ) { | |
//dequeue scripts and styles | |
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) { | |
wp_dequeue_style( 'woocommerce_frontend_styles' ); | |
wp_dequeue_style( 'woocommerce_fancybox_styles' ); | |
wp_dequeue_style( 'woocommerce_chosen_styles' ); | |
wp_dequeue_style( 'woocommerce_prettyPhoto_css' ); | |
wp_dequeue_style( 'woocommerce-general' ); | |
wp_dequeue_style( 'woocommerce-layout' ); | |
wp_dequeue_style( 'woocommerce-smallscreen' ); | |
wp_dequeue_script( 'wc_price_slider' ); | |
wp_dequeue_script( 'wc-single-product' ); | |
wp_dequeue_script( 'wc-add-to-cart' ); | |
wp_dequeue_script( 'wc-cart-fragments' ); | |
wp_dequeue_script( 'wc-checkout' ); | |
wp_dequeue_script( 'wc-add-to-cart-variation' ); | |
wp_dequeue_script( 'wc-single-product' ); | |
wp_dequeue_script( 'wc-cart' ); | |
wp_dequeue_script( 'wc-chosen' ); | |
wp_dequeue_script( 'woocommerce' ); | |
wp_dequeue_script( 'prettyPhoto' ); | |
wp_dequeue_script( 'prettyPhoto-init' ); | |
wp_dequeue_script( 'jquery-blockui' ); | |
wp_dequeue_script( 'jquery-placeholder' ); | |
wp_dequeue_script( 'fancybox' ); | |
wp_dequeue_script( 'jqueryui' ); | |
} | |
} | |
} | |
/* End WooCommerce Scripts Wonderful Code */ | |
/* 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' ); // for WordPress >= 3.0 | |
} | |
add_action( 'init', 'remove_header_info' ); | |
/* End Cleaning up the head */ | |
/* Let's remove those pesky script version numbers! */ | |
function bkg_remove_script_version( $src ) { | |
if ( strpos( $src, 'ver=' ) ) { | |
$src = remove_query_arg( 'ver', $src ); | |
} | |
return $src; | |
} | |
add_filter( 'script_loader_src', 'bkg_remove_script_version', 15, 1 ); | |
add_filter( 'style_loader_src', 'bkg_remove_script_version', 15, 1 ); | |
/* End script version number removal */ | |
/* Nick, 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 */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment