Skip to content

Instantly share code, notes, and snippets.

View sc0ttkclark's full-sized avatar
🍕
Working hard reviewing and deploying code

Scott Kingsley Clark sc0ttkclark

🍕
Working hard reviewing and deploying code
View GitHub Profile

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 September 25, 2020 18:14
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.
<?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 December 16, 2015 02:58
#pods-dev chat about Loop Fields
[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
@sc0ttkclark
sc0ttkclark / my_merge_tags.php
Created September 3, 2013 14:41
my_merge_tags
<?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 September 4, 2013 22:35
Example custom display
<?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 September 14, 2013 22:44
Work towards supporting multiple post types / taxonomies for RSSeries
<?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 : )
<?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 );
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 ),
<?php
/**
* @package Pods
*/
class PodsAPI {
/**
* @var PodsAPI
*/
static $instance = null;
@sc0ttkclark
sc0ttkclark / wp-db-_insert_replace_helper.php
Created December 5, 2013 21:16
Add bulk insert/replace capability to wpdb::insert / wpdb::replace without adding unnecessary overhead for normal single inserts
<?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