Skip to content

Instantly share code, notes, and snippets.

View BurlesonBrad's full-sized avatar
🎯
Focusing

Brad Griffin BurlesonBrad

🎯
Focusing
View GitHub Profile
@BurlesonBrad
BurlesonBrad / WordPress .htaccess
Created December 23, 2013 06:22
Ultimate htaccess file for WordPress
# BEGIN Cache_Assistance
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f
<?php
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
<?php
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
@BurlesonBrad
BurlesonBrad / Default Quantity NOT changed
Created April 13, 2015 05:27
Modified quantity added to themes/theonepager-child/woocommerce/checkout/add-to-cart
<?php
/**
* Product quantity input
*
* Extends the WooCommerce quantity input template to include the add_to_cart data attribute.
*
* @package WooCommerce-One-Page-Checkout/Templates
* @version 1.0
*/
@BurlesonBrad
BurlesonBrad / gist:de5b1ca4644d2b58a10f
Created May 1, 2015 16:08
Full Potential of Schema and WooCommerce
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="name">Kenmore White 17" Microwave</span>
<img src="kenmore-microwave-17in.jpg" alt='Kenmore 17" Microwave' />
<div itemprop="aggregateRating"
itemscope itemtype="http://schema.org/AggregateRating">
Rated <span itemprop="ratingValue">3.5</span>/5
based on <span itemprop="reviewCount">11</span> customer reviews
</div>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<!--price is 1000, a number, with locale-specific thousands separator
<?php
/**
* Admin new order email
*
* @author WooThemes
* @package WooCommerce/Templates/Emails/HTML
* @version 2.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@BurlesonBrad
BurlesonBrad / Border Control
Created May 27, 2015 18:49
Block Everything But the United States
This file has been truncated, but you can view the full file.
# BLOCK COUNTRY BY IP RANGE
# IncrediBILL's HTACCESS Tools
# http://incredibill.me
<Limit GET POST HEAD>
order allow,deny
#
# Block from AFGHANISTAN (AF)
#
deny from 27.116.56.0/22
deny from 43.231.131.0/24
@BurlesonBrad
BurlesonBrad / Line 374 of wc-template-functions.php
Created May 28, 2015 15:59
Add html to WooCommerce Storewide Notice
echo apply_filters( 'woocommerce_demo_store', '<p class="demo_store">' . '<a href ="https://www.facebook.com/groups/advanced.woocommerce/permalink/1087929507888134/">' . $notice .'</a>' . '</p>' );
@BurlesonBrad
BurlesonBrad / Manja
Created July 7, 2015 22:07
For Manja
// Our hooked in function - $fields is passed via the filter!
function dropdown( $fields ) {
$fields['billing']['dropdown'] = array(
'label' => __('Howdy Manja. Would You Like Your Order Gift Wrapped for Free?', 'woocommerce'),
'placeholder' => _x('dropdown', 'placeholder', 'woocommerce'),
'required' => false,
'class' => array('form-row-wide'),
'clear' => true,
'type' => 'select',
'options' => array(
function woo_custom_wp_mail_from() {
global $woocommerce;
return html_entity_decode( 'daves.email@daves-favorite-spot-on-the-innerwebs.com' );
}
add_filter( 'wp_mail_from', 'woo_custom_wp_mail_from', 99 );