Skip to content

Instantly share code, notes, and snippets.

@WordBits
WordBits / snippet.php
Created April 23, 2018 03:05
This is the plugin autoloader that I use. Of course, customize it as you see fit.
<?php
// Download this snippet as a plugin and more at: https://wordbits.io/?post_type=snippet&p=527
// Created by: jeffmatson
?>
<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }
function example_autoload( $classname ) {
$class = str_replace( '\\', DIRECTORY_SEPARATOR, str_replace( '_', '-', strtolower( $classname ) ) );
@WordBits
WordBits / snippet.php
Created June 24, 2018 05:24
Quick snippet that prevents cart fragments from being updated in WooCommerce.
<?php
// Download this snippet as a plugin and more at: https://wordbits.localhost/snippet/stopping-cart-fragments-from-updating-in-woocommerce/
// Created by: jeffmatson
?>
<?php
add_action( 'wp_print_scripts', 'nuke_cart_fragments', 100 );
function nuke_cart_fragments() {
wp_dequeue_script( 'wc-cart-fragments' );
@WordBits
WordBits / snippet.php
Created June 24, 2018 05:28
Quick snippet that prevents cart fragments from being updated in WooCommerce.
<?php
// Download this snippet as a plugin and more at: https://wordbits.io/snippet/stop-cart-fragments-from-updating-in-woocommerce/
// Created by: jeffmatson
?>
<?php
add_action( 'wp_print_scripts', 'nuke_cart_fragments', 100 );
function nuke_cart_fragments() {
wp_dequeue_script( 'wc-cart-fragments' );
@WordBits
WordBits / snippet.php
Created June 24, 2018 05:33
Gets the colors being used in the current user's admin color scheme.
<?php
// Download this snippet as a plugin and more at: https://wordbits.io/snippet/get-wordpress-admin-color-scheme/
// Created by: jeffmatson
?>
<?php
function build_admin_colors() {
global $_wp_admin_css_colors;
$current_color_scheme = get_user_meta( get_current_user_id(), 'admin_color', true );
@WordBits
WordBits / snippet.php
Created June 24, 2018 05:37
Completely removes the WordPress Heartbeat by deregistering the script.
<?php
// Download this snippet as a plugin and more at: https://wordbits.io/snippet/completely-remove-the-wordpress-heartbeat/
// Created by: jeffmatson
?>
<?php
// Fire the action on init.
add_action( 'init', 'kill_wp_heartbeat' );
function kill_wp_heartbeat() {
// Deregister the script.
@WordBits
WordBits / snippet.php
Created June 24, 2018 13:49
A test snippet only to explore functionality.
<?php
// Download this snippet as a plugin and more at: https://wordbits.io/snippet/test-snippet/
// Created by: Liam - TEST Dempsey - TEST
?>
<?php
// Test snippet only
@WordBits
WordBits / snippet.php
Created July 18, 2018 03:42
ssssssss
<?php
// Download this snippet as a plugin and more at: https://wordbits.localhost/snippet/tdfadsfadsfasdf/
// Created by: jeffmatson
?>
<?php
sfgsdfgsdfgsdfg
@WordBits
WordBits / snippet.php
Created July 18, 2018 05:22
adsfasdfasdf
<?php
// Download this snippet as a plugin and more at: https://wordbits.localhost/snippet/dsffdf/
// Created by: jeffmatson
?>
<?php
asdfsadfsdf
@WordBits
WordBits / snippet.php
Created July 18, 2018 05:28
sadfasdfas
<?php
// Download this snippet as a plugin and more at: https://wordbits.localhost/snippet/asdfasdf/
// Created by: jeffmatson
?>
<?php
asdfsafsf
@WordBits
WordBits / snippet.php
Created July 18, 2018 05:30
asdfasdfa
<?php
// Download this snippet as a plugin and more at: https://wordbits.localhost/snippet/asdfasdf/
// Created by: jeffmatson
?>
<?php
asdfasdf