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
@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
<?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,
),
<?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,
),
@sc0ttkclark
sc0ttkclark / gist:8661802
Created January 28, 2014 03:23
Give all admins access to pods_is_admin
<?php
function access_for_all_admins( $access ) {
if ( !$access && current_user_can( 'manage_options' ) ) {
$access = true;
}
return $access;
}
@sc0ttkclark
sc0ttkclark / pods-alternative-cache.php
Last active January 4, 2016 21:39
Pods Alternative Cache
<?php
/*
Plugin Name: Pods Alternative Cache
Plugin URI: http://pods.io/
Description: Alternative caching engine for Pods for large sites on hosts with hard limits on how much you can cache
Version: 1.0
Author: The Pods Framework Team
Author URI: http://pods.io/
*/
@sc0ttkclark
sc0ttkclark / class-fieldmanager-readonly.php
Created February 18, 2016 01:52
A class you can drop-in to enable readonly text fields that can't be changed, but optionally you can set `'can_edit_capability' => 'manage_options'` to any capability you'd like to restrict editing to. If user has that capability, a basic text field will be used.
<?php
/**
* Read only text field, optionally allows for specific users to edit
* @package Fieldmanager
*/
class Fieldmanager_ReadOnly extends Fieldmanager_TextField {
/**
* The capability a user must have to be able to edit normally
*