Skip to content

Instantly share code, notes, and snippets.

@wpsmith
wpsmith / gist:69b098157391b9eee174
Last active August 25, 2015 20:02 — forked from billerickson/gist:1298344
Full Content in Display Posts Shortcode plugin
<?php
/**
* Full Content in Display Posts Shortcode plugin
* @author Bill Erickson
* @link http://wordpress.org/extend/plugins/display-posts-shortcode/
*
* @param string $output the original markup for an individual post
* @param array $atts all the attributes passed to the shortcode
* @param string $image the image part of the output
* @param string $title the title part of the output
@wpsmith
wpsmith / javascript_resources.md
Created February 3, 2014 16:05 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
add_filter( 'edd_enabled_payment_gateways', 'kws_edd_enabled_payment_gateways');
/**
* Modify the gateways for users who can manage options so that the Test Payment gateway is activated.
* See /easy-digital-downloads/includes/gateways/functions.php
* @see edd_get_enabled_payment_gateways()
* @param array $gateways Existing activated gateways array
* @return array Modified array
*/
function kws_edd_enabled_payment_gateways($gateway_list) {
<?php
// Change /*CUSTOMIZE_THIS*/ to a unique name (two places). Go ahead, make it long.
// Like, your initials, and your full plugin name.
// e.g. MTJ_Some_Awesome_Plugin_Controller
/*CUSTOMIZE_THIS*/_Controller::init();
class /*CUSTOMIZE_THIS*/_Controller {
function init() {
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
<?php
/**
* Database emtpying and file removing class.
*
* Truncates all necessary tables in the defined database and removes
* any files uploaded by the demo user.
*
* @since 1.0.0
*
* @author Thomas Griffin
<?php
/**
* Database emtpying and file removing class.
*
* Truncates all necessary tables in the defined database and removes
* any files uploaded by the demo user.
*
* @since 1.0.0
*
* @author Thomas Griffin
<?php
/**
* Archive Post Class
* @since 1.0.0
*
* Breaks the posts into three columns
* @link http://www.billerickson.net/code/grid-loop-using-post-class
*
* @param array $classes
@wpsmith
wpsmith / post-class.php
Last active August 29, 2015 14:01 — forked from billerickson/gist:2040968
PHP: Query Post Class
<?php
add_filter( 'post_class', 'wps_query_post_class' );
/**
* Archive Post Class
* @since 1.0.0
*
* Breaks the posts into three columns
* @link http://www.billerickson.net/code/grid-loop-using-post-class
*
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person