Skip to content

Instantly share code, notes, and snippets.

View conschneider's full-sized avatar
🐼
Relax. Nothing is under control.

Con Schneider conschneider

🐼
Relax. Nothing is under control.
View GitHub Profile
@conschneider
conschneider / wp-query-ref.php
Created December 31, 2016 21:15 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@conschneider
conschneider / wc-hide-coupons-cart-checkout.php
Created January 14, 2017 16:35 — forked from maxrice/wc-hide-coupons-cart-checkout.php
WooCommerce - hide the coupon form on the cart or checkout page, but leave coupons enabled for use with plugins like Smart Coupons and URL Coupons
<?php
// hide coupon field on cart page
function hide_coupon_field_on_cart( $enabled ) {
if ( is_cart() ) {
$enabled = false;
}
return $enabled;
@conschneider
conschneider / woocommerce-simple-or-variable.php
Last active January 22, 2017 17:09 — forked from patrickgilmour/woocommerce-simple-or-variable.php
WooCommerce conditional to test if a Product is Simple or Variable.
<?php
/**
* Is a WooCommerce Product Simple or Variable
*
* see http://wordpress.org/support/topic/condition-to-check-if-product-is-simple-or-variable
*/
//get product right first to access methods of WC_Product()
$product = wc_get_product( get_the_ID() );
@conschneider
conschneider / Woocommerce Bookings Dropdown + handles Resources
Created February 20, 2017 15:55 — forked from LiamBailey/Woocommerce Bookings Dropdown + handles Resources
Changes date-picker fields for dropdown of available dates, and refreshes dropdown if resource dropdown is changed
<?php
/*
Plugin Name: Woocommerce Bookings Dropdown
Description: Swaps the date picker for a dropdown of dates
Version: 1.0.0
Author: Webby Scots
Author URI: http://webbyscots.com/
*/
add_action('wp_ajax_wswp_refresh_dates','wswp_refresh_dates');
add_action('wp_ajax_nopriv_wswp_refresh_dates','wswp_refresh_dates');
@conschneider
conschneider / docker-wordpress.sh
Last active June 15, 2017 15:43 — forked from tatemz/docker-wordpress.sh
A quick way to get a WordPress installation up and running with Docker. Mounts the WordPress root folder as well for exchange between host and Docker container.
#!/bin/bash
mkdir wordpress-site && cd wordpress-site
touch docker-compose.yml
cat > docker-compose.yml <<EOL
version: "2"
services:
my-wpdb:
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@conschneider
conschneider / edit-woocommerce-checkout-template.php
Created June 27, 2017 10:15 — forked from bekarice/edit-woocommerce-checkout-template.php
Add content and notices to the WooCommerce checkout - sample code
/**
* Each of these samples can be used - note that you should pick one rather than add them all.
*
* How to use WC notices: https://github.com/woothemes/woocommerce/blob/master/includes/wc-notice-functions.php#L96
* Tutorial: http://www.skyverge.com/blog/edit-woocommerce-templates/
**/
/**
* Add a content block after all notices, such as the login and coupon notices.
*
@conschneider
conschneider / update-mysql56.sh
Created July 18, 2017 09:00 — forked from technosailor/update-mysql56.sh
Updates VVV MySQL 5.5 to 5.6 -- Ubuntu 14.04
#!/bin/bash
# Usage: ./update-mysql56.sh
# Backup of all databases... JUST IN CASE
mysqldump --all-databases --single-transaction --events --user=root --password > ~/all_database_backup.sql
# Remove MySQL 5.5
sudo apt-get remove mysql-server
sudo apt-get autoremove
@conschneider
conschneider / wp_mail.md
Created August 3, 2017 19:17 — forked from johnbillion/wp_mail.md
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This is accurate as of WordPress 4.8, and includes some upcoming changes in WordPress 4.9.

There are a few TODOs left. Please bear with me.

@conschneider
conschneider / Query
Created July 9, 2019 08:25 — forked from lukecav/Query
MySQL script to get all WooCommerce orders including metadata
select
p.ID as order_id,
p.post_date,
max( CASE WHEN pm.meta_key = '_billing_email' and p.ID = pm.post_id THEN pm.meta_value END ) as billing_email,
max( CASE WHEN pm.meta_key = '_billing_first_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_first_name,
max( CASE WHEN pm.meta_key = '_billing_last_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_last_name,
max( CASE WHEN pm.meta_key = '_billing_address_1' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_1,
max( CASE WHEN pm.meta_key = '_billing_address_2' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_2,
max( CASE WHEN pm.meta_key = '_billing_city' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_city,
max( CASE WHEN pm.meta_key = '_billing_state' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_state,