Skip to content

Instantly share code, notes, and snippets.

View BurlesonBrad's full-sized avatar
🎯
Focusing

Brad Griffin BurlesonBrad

🎯
Focusing
View GitHub Profile
/** Robin, you can add these lines to your child theme's functions.php file
* If you're NOT using a child theme, please copy / paste this link
* https://github.com/woothemes/theme-customisations/archive/master.zip
* and use that plugin to make custimizations like this one to your theme
* Best wishes Robin
**/
add_filter ('woocommerce_add_to_cart_redirect', 'woo_redirect_to_checkout');
function woo_redirect_to_checkout() {
$checkout_url = WC()->cart->get_checkout_url();
@BurlesonBrad
BurlesonBrad / dropzonejs-wp-rest-api.js
Created January 29, 2016 03:21 — forked from soderlind/dropzonejs-wp-rest-api.js
DropzoneJS & WordPress REST API
/*
Uploading images is a two step process (from https://github.com/WP-API/WP-API/issues/1768#issuecomment-160540932):
POST the data to /wp/v2/media - this can either be as the request body, or in multipart format. This will upload the file, and give you a 201 Created response with a Location header. This header points to the post object for the attachment that has just been created.
PUT the post data to the endpoint returned in the Location header (which will look something like /wp/v2/media/{id}).
I do step 2 (PUT), if POST is a success, in myDropzone.on("success", function(file, response){}
*/
// dropzoneWordpressRestApiForm is the configuration for the element that has an id attribute
@BurlesonBrad
BurlesonBrad / toggle-admin-ajax.php
Last active February 27, 2016 23:33
Phil Kills off Admin Ajax via a Plugin
<?php
/**
* Plugin Name: Phil Kills of Admin Ajax via a Plugin
* Plugin URI: https://yourmom.com
* Description: A Drop In Plugin That'll kill off admin-ajax.php. 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
@BurlesonBrad
BurlesonBrad / prev-next-same-category.php
Created March 7, 2016 23:59
Christopher Roy's Plugin
<?php
/**
* Plugin Name: Christopher's Plugin
* Description: Pucker, Pray, and hope that I didn't miss anything. Should make prev & next stay within the same category! *SHOULD* ;-)
* Version: 1.0.0
* Author: Brad Griffin
* Author URI: https://bradgriffin.me
*/
/** Christopher: Download this file, then upload it via FTP into your /plugins folder.
@BurlesonBrad
BurlesonBrad / functions.php
Created March 10, 2016 21:34 — forked from TimBHowe/functions.php
Reduce or remove WooCommerce 2.5 minimum password strength requirement for creating a user account. Warning: Use at your own risk.
<?php
/**
*Reduce the strength requirement on the woocommerce password.
*
* Strength Settings
* 3 = Strong (default)
* 2 = Medium
* 1 = Weak
* 0 = Very Weak / Anything
*/
@BurlesonBrad
BurlesonBrad / woocommerce-overrides.php
Created March 10, 2016 21:34 — forked from TimBHowe/woocommerce-variation-grid-add-cart.php
Include this in your theme to allow WooCommerce variable products to be displayed in a grid format with each variation having there own quantity and add to cart button, rather then the drop-down options. This should be include in your themes function file.
<?php
/******************************************************************************
* Variation Grid
*
* The following function allow for the theme to display product variations in a grid format.
* This code could be moved to a plugin but is in the theme function file as it used the
* themes grid system.
*
* @reference: http://www.eggplantstudios.ca/woocommerce-product-variation-add-cart-grid/
* ******************************************************************************/
@BurlesonBrad
BurlesonBrad / gist:03eb675ad1deadf43251
Created March 10, 2016 21:56
Get rid of the subtotal line
add_filter( 'woocommerce_get_order_item_totals', 'adjust_woocommerce_get_order_item_totals' );
function adjust_woocommerce_get_order_item_totals( $totals ) {
unset($totals['cart_subtotal'] );
return $totals;
}
@BurlesonBrad
BurlesonBrad / dashboard-tab-settings.php
Last active March 23, 2016 14:21
Add field for image, display name, and welcome message
<?php
$affiliate_id = affwp_get_affiliate_id();
$user_email = affwp_get_affiliate_email( $affiliate_id );
$payment_email = affwp_get_affiliate_payment_email( $affiliate_id, $user_email ); // Fallback to user_email
?>
<div id="affwp-affiliate-dashboard-profile" class="affwp-tab-content">
<h4><?php _e( 'Profile Settings', 'affiliate-wp' ); ?></h4>
@BurlesonBrad
BurlesonBrad / terms.php
Created March 24, 2016 12:54
Add TOS Condition for Wholesalers
<?php
/**
* Checkout terms and conditions checkbox
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.5.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
<?php
/*
* Plugin Name: Brad Gives to Usability Dynamics
* Plugin URI: https://bradgriffin.me
* Description: Look at your pageflow. After a user adds anything Invoice related to my cart, redirect the user to another Invoice related product. Same concept with the Property products. Almost immediately, you're total per transaction amount will go up #whoop!
* Author: Brad Griffin
* Author URI: https://bradgriffin.me
* Version: 1.0
* License: GPL 2.0
* Text Domain: woocommerce