Skip to content

Instantly share code, notes, and snippets.

🍕
Working hard reviewing and deploying code

Scott Kingsley Clark sc0ttkclark

🍕
Working hard reviewing and deploying code
Block or report user

Report or block sc0ttkclark

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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
@sc0ttkclark
sc0ttkclark / gist:5071618
Last active Dec 14, 2015
In Pods 2.3, you can now add custom relationship objects quickly and easily. Add predefined lists, integrate with other plugins and their data, or do whatever you want just about! The custom relationships will appear in the 'Relate to' options for a Relationship Field. This is a simple example meant for basic key/value data.
View gist:5071618
<?php
add_action( 'init', 'add_my_related_objects' );
function add_my_related_objects () {
$options = array(
'data' => array(
1 => 'Option 1',
2 => 'Option 2'
)
);
@sc0ttkclark
sc0ttkclark / gist:5366044
Last active Dec 16, 2015
#pods-dev chat about Loop Fields
View gist:5366044
[10:52:04 AM on 04/11/13] <@sc0ttkclark> bing bang boom
[10:59:29 AM on 04/11/13] <@curtismchale> looks like 4 of us
[10:59:44 AM on 04/11/13] <@curtismchale> this is the ticket https://github.com/pods-framework/pods/issues/1174
[10:59:57 AM on 04/11/13] <@curtismchale> #109 is the most related for today's discussion
[11:00:06 AM on 04/11/13] <@curtismchale> https://github.com/pods-framework/pods/issues/109
[11:01:28 AM on 04/11/13] <@sc0ttkclark> lol
[11:01:29 AM on 04/11/13] <@sc0ttkclark> yep
[11:03:32 AM on 04/11/13] <@curtismchale> army: you going to join in?
[11:03:50 AM on 04/11/13] <@curtismchale> sc0ttkclark: is this logged anywhere so we can link it on the ticket?
[11:03:57 AM on 04/11/13] <@curtismchale> in case others want to see what was up
View my_merge_tags.php
<?php
function my_merge_tags ( $text ) {
if ( is_user_logged_in() ) {
global $user_ID, $user_login;
get_currentuserinfo();
$user = (array) get_user_meta( $user_ID );
$userdata = array();
@sc0ttkclark
sc0ttkclark / example.php
Created Sep 4, 2013
Example custom display
View example.php
<?php
$ui[ 'fields' ][ 'manage' ][ 'my_custom_field' ] = array(
'label' => 'My Custom Field',
'custom_display' => 'my_custom_field_pods_value'
);
function my_custom_field_pods_value( $row, $obj, $value, $field, $attributes ) {
$value = $row[ 'a_number_field' ] + $row[ 'another_number_field' ];
return $value;
@sc0ttkclark
sc0ttkclark / really-simple-series.php
Created Sep 14, 2013
Work towards supporting multiple post types / taxonomies for RSSeries
View really-simple-series.php
<?php
/*
Plugin Name: Really Simple Series
Plugin URI: http://krogsgard.com/2012/simple-wordpress-series-plugin
Description: This plugin changes the default order of selected categories used to ascending (oldest first). It also lists all posts in the selected categories at the bottom of each post in the series.
Version: 0.2
Author: Brian Krogsgard & Pippin Williamson
Author URI: http://krogsgard.com
Contributors: krogsgard, mordauk
Thanks: Tom McFarlin, and Ryan Imel for your help, even though you don't know it : )
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: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 PodsAPI.php
<?php
/**
* @package Pods
*/
class PodsAPI {
/**
* @var PodsAPI
*/
static $instance = null;
@sc0ttkclark
sc0ttkclark / wp-db-_insert_replace_helper.php
Created Dec 5, 2013
Add bulk insert/replace capability to wpdb::insert / wpdb::replace without adding unnecessary overhead for normal single inserts
View wp-db-_insert_replace_helper.php
<?php
/**
* Helper function for insert and replace.
*
* Runs an insert or replace query based on $type argument.
*
* @access private
* @since 3.0.0
* @see wpdb::prepare()
* @see wpdb::$field_types
You can’t perform that action at this time.