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
View GitHub Profile
View ahhhhh.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;
sc0ttkclark / delete-orphan-gf-entry-data.sql
Created Feb 16, 2015
Delete all GF lead data if lead has been deleted
View delete-orphan-gf-entry-data.sql
wp_rg_lead_detail AS lead_detail
wp_rg_lead AS lead ON = lead_detail.lead_id
View podscast-2-demo.php
// Setup Speakers pod
$speaker = pods( 'speaker' );
// Find all Speakers
// with Lessons that are in the Series "That Series"
// or that have a Lesson "Awesome Lesson"
$params = array(
'where' => '
lessons.series.post_title = "That Series"
sc0ttkclark / gistify497541.buddypress-separate-bbpress-forums-site.php
Last active Sep 12, 2015
Code to enable having the main bbPress forums on a separate sub-site. Requires: WP Multisite, BuddyPress on main site and network-activated, bbPress on main site and sub-site
View gistify497541.buddypress-separate-bbpress-forums-site.php
* Remove and add a custom function for bbPress' BuddyPress activity filter
function custom_bbp_notifications_fix() {
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
sc0ttkclark / sort-by-term-name.php
Created Oct 23, 2015
Example PHP of how to enable sorting by term name. `orderby=term_name` and `orderby_tax={taxonomy_name}`
View sort-by-term-name.php
* Filter EP args to add support for orderby term_name
* @param array $formatted_args
* @param array $args
function ep_add_term_name_sort_support( $formatted_args, $args ) {
// Handle meta_value / meta_value_num sort
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 / 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
add_action( 'init', 'add_my_related_objects' );
function add_my_related_objects () {
$options = array(
'data' => array(
1 => 'Option 1',
2 => 'Option 2'
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
[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>
[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
function my_merge_tags ( $text ) {
if ( is_user_logged_in() ) {
global $user_ID, $user_login;
$user = (array) get_user_meta( $user_ID );
$userdata = array();
You can’t perform that action at this time.