Skip to content

Instantly share code, notes, and snippets.

View stevegrunwell's full-sized avatar

Steve Grunwell stevegrunwell

View GitHub Profile
@stevegrunwell
stevegrunwell / gist:10011122
Last active August 29, 2015 13:58
Example of restricting shipping to a single state for a single shipping class with WooCommerce, prepared for Evan Thorpe based on my blog post http://stevegrunwell.com/blog/woocommerce-restrict-shipping
public function is_available( $package ) {
// Determine if we have any items in the "In-state" shipping class
$restricted_shipping_class_slug = 'in-state';
$permitted_states_for_restricted_items = array( 'NY' );
$has_restricted_items = false;
foreach ( $package as $pkg ) {
if ( isset( $pkg['contents'] ) ) {
foreach ( $pkg['contents'] as $contents ) {
@stevegrunwell
stevegrunwell / gist:2140325
Created March 20, 2012 19:35
Example usage of conditional comments with wp_enqueue_script() (WordPress)
<?php
wp_enqueue_style('ie7-fixes', get_bloginfo('template_url') . '/css/ie7.css', false, '', 'screen');
global $wp_styles;
$wp_styles->add_data('ie7-fixes', 'conditional', 'lte IE 7');
?>
@stevegrunwell
stevegrunwell / brworkshop-cbus-2012.md
Created July 9, 2012 15:53
Build Responsively Workshop - July 9-10, 2012 - Columbus, OH

Build Responsively - July 9-10, 2012

Responsive Design 101

Semantic grid system: http://semantic.gs/

They'd love to see an analytics script to track how often people are resizing the browser

  • add resize listener to the window, send GA event
  • git://gist.github.com/3076998.git
@stevegrunwell
stevegrunwell / hooked-on-wordpress-actions-and-filters.md
Created July 14, 2012 14:18
Hooked on WordPress Actions and Filters - WordCamp Columbus 2012
@stevegrunwell
stevegrunwell / using-git-for-version-control.md
Created July 14, 2012 14:57
Using Git for Version Control - WordCamp Columbus 2012
@stevegrunwell
stevegrunwell / creating-a-plugin-workshop.md
Created July 14, 2012 18:15
Creating a Plugin Workshop - WordCamp Columbus 2012

Creating a Plugin Workshop

July 14, 2012

Instructor: Nowell VanHoesen (@NowellVanHoesen)

Requirements

Location

@stevegrunwell
stevegrunwell / theme-development-essentials.md
Created July 14, 2012 18:56
Theme Development Essentials - WordCamp Columbus 2012
@stevegrunwell
stevegrunwell / responsible-responsiveness.md
Created July 14, 2012 19:33
Responsible Responsiveness - WordCamp Columbus 2012

Responsible Responsiveness

July 14, 2012

Instructor: John Hartley (@johnbhartley)

Slides: http://forknightdev.com/responsive/#1

"Responsive design is not some magical tool. You can't just pop it in and 'done, it works'." Responsive design requires planning.

@stevegrunwell
stevegrunwell / wordpress-multisite.md
Created July 15, 2012 15:00
WordPress Multisite - WordCamp Columbus 2012

WordPress Multisite

July 15, 2012

Instructor: Angie Meeker (@angiemeeker)

Slides: http://slidesha.re/LZT6T3

Angie's Multisite-mentor: @angela_r

@stevegrunwell
stevegrunwell / .bash_profile
Created September 9, 2015 19:25
Upgrade WordPress plugins via WP-CLI one at a time, committing the results to Git as you go
function wp-upgrade-plugins() {
UPDATES=`wp plugin list --update=available --fields=name,title,update_version --format=csv`
i=1
while IFS="," read -r slug name version
do
test $i -eq 1 && ((i=i+1)) && continue
echo "Upgrading $name to $version..."