Skip to content

Instantly share code, notes, and snippets.

🍕
Working hard reviewing and deploying code

Scott Kingsley Clark sc0ttkclark

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
@sc0ttkclark
sc0ttkclark / debug-ep.php
Created Feb 26, 2019
ElasticPress debugging code for mu-plugins
View debug-ep.php
<?php
/**
* @param string $type
*
* @return bool
*/
function debug_ep_is_debug( $type = 'normal' ) {
if ( ! empty( $_GET['epdebug'] ) || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
@sc0ttkclark
sc0ttkclark / custom-pods-shortcode-total-text.php
Last active Dec 9, 2018
Custom `[pods]` shortcode handling for total text.
View custom-pods-shortcode-total-text.php
<?php
/*
* Ensure total_found() gets calculated right away, because in the [pods] shortcode
* it does other queries after the initial find().
*/
add_filter( 'pods_data_auto_calculate_total_found', '__return_true' );
/**
* Add custom shortcode handling for total text.
@sc0ttkclark
sc0ttkclark / import-example.php
Created Aug 29, 2017
Pods import csv example
View import-example.php
<?php
/**
* Import CSV example for Pods
*
* @param string $file File location
*
* @return true|WP_Error Returns true on success, WP_Error if there was a problem
*/
function my_import_csv( $file ) {
@sc0ttkclark
sc0ttkclark / prospress-command.php
Created Jul 18, 2017
Prospress command example for WP-CLI
View prospress-command.php
<?php
/**
* Prospress command for CLI actions.
*/
class Prospress_Command extends WP_CLI_Command {
/**
* Run scheduler
*
@sc0ttkclark
sc0ttkclark / tribe-fix-pods-handlebars-conflict.php
Created May 11, 2017
Fix for extending The Events Calendar content types in Pods (fixed in Pods 2.7 but it's not released yet)
View tribe-fix-pods-handlebars-conflict.php
<?php
add_action( 'admin_enqueue_scripts', 'tribe_fix_pods_handlebars_conflict', 16 );
/**
* The Events Calendar uses a newer version of Handlebars that conflicts
* when Pods tries to load it's outdated version of Handlebars.
*
* This removes the Pods handlebars
*/
function tribe_fix_pods_handlebars_conflict() {
@sc0ttkclark
sc0ttkclark / userscript.js
Created Oct 7, 2016
Papertrail JSON formatter (with addStyle fix)
View userscript.js
// ==UserScript==
// @name Papertrail JSON formatter
// @namespace https://papertrailapp.com/
// @version 0.1
// @description Format and colorize JSON log messages in Papertrail
// @match https://papertrailapp.com/*events*
// @copyright 2014+, Papertrail (http://wiki.creativecommons.org/Public_domain)
// @grant GM_addStyle
// ==/UserScript==
View class-wp-curie.php
<?php
/**
* WP_Curie class
*/
class WP_Curie {
/**
* @var string Prefix
*/
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 26, 2019 — 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 / my-db-cli.php
Created May 18, 2016
Custom DB CLI command to query a database that you can customize to set the default connection info or pass additional associative arguments to override Host, Database, User, Password, and/or Charset used.
View my-db-cli.php
<?php
/**
* Custom DB CLI command
*/
class My_DB_CLI extends \WP_CLI_Command {
/**
* Execute a MySQL query against a custom database.
*
* Executes an arbitrary MySQL query using `DB_HOST`, `DB_NAME`, `DB_USER`
You can’t perform that action at this time.