Skip to content

Instantly share code, notes, and snippets.

Avatar
🍕
Working hard reviewing and deploying code

Scott Kingsley Clark sc0ttkclark

🍕
Working hard reviewing and deploying code
View GitHub Profile
View pods-help.php
<?php
//pods: https://imgur.com/a/MflzgtI
$search = sanitize_text_field( $search );
$query = array();
$query[] = 'brand.meta_value = ' . absint( $_REQUEST['brand_id'] );
$query[] = '
d.asset_name LIKE "%' . pods_sanitize_like( $search ) . '%"
OR product_d.sku like "%' . pods_sanitize_like( $search ) . '%"
View pods-persist-and-deploy.php
<?php
/**
* Plugin Name: Pods_Persist_And_Deploy
* Description: Allows locking down Pods on deployment allowing version control of Pods post types, taxonomies and fields.
*/
//
//add_action( 'plugins_loaded', array( 'Pods_Deploy', 'on_load' ), 5 );
/*
@sc0ttkclark
sc0ttkclark / add-product-to-cart.php
Last active Mar 5, 2020 — forked from kloon/gist:2376300
WooCommerce Automatically add product to cart on site visit
View add-product-to-cart.php
<?php
/*
* This code goes into theme functions.php or a custom plugin
*/
/**
* Add product to cart on page load
*/
function add_product_to_cart() {
@sc0ttkclark
sc0ttkclark / 0_reuse_code.js
Created Sep 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View ahhhhh.php
<?php
function slug_tax_update_PRE( $pieces, $is_new_item, $id ) {
if ( 0 < $id ) {
$term = (int) $pieces[ 'fields' ][ 'tax' ][ 'value' ];
wp_set_object_terms( $id, $term, 'ant', false );
}
return $pieces;
View 1-after.php
<?php
//**Most Commented On Posts Loop same as before**/
$args = array(
'date_query' => array(
//set date ranges with strings!
'after' => '1 week ago',
'before' => 'today',
//allow exact matches to be returned
'inclusive' => true,
),
View PodsAPI.php
<?php
/**
* @package Pods
*/
class PodsAPI {
/**
* @var PodsAPI
*/
static $instance = null;
View gist:6784315
var custom_zip_search = '<div class="zip-search">'
+ '<label class="alignleft">Enter Zip:<span class="help alignright"></span></label>'
+ '<input type="text" name="zip_code_ZIPID" />'
+ '<div class="add-zip alignleft"><span class="green-arrow"></span> <span class="available">Available</span> For You To Represent.'
+ '<p><a href="#" class="add-another">Add another zip code for $100 annually</a></p>'
+ '</div></div>';
$( '.checkout-2 .gfield_checkbox li' ).each( function() {
var $this = $( this ),
$checkbox = $( 'input[type="checkbox"]', $this ),
View gist:6784248
<?php
function enhanceins_zip_code_check( $result, $value, $form, $field ) {
global $wpdb;
if ( !$result[ 'is_valid' ] ) {
return $result;
}
if ( !is_array( $value ) ) {
$value = explode( ',', $value );
View gist:4665815

Use Case

We’re building a site for Golf Courses in a state. We need:

  1. Properties
  • taxonomies: Type (private/public), State, County
  1. Courses
    • taxonomies: bunkers (light, medium, heavy), features (sand trap, putting practice), rate tier ($, $$, $$$), Course Rating (*, **, ***)
  2. Holes
    • Holes have tees (black tee, white tee) each with different par/handicap/yards
You can’t perform that action at this time.