Skip to content

Instantly share code, notes, and snippets.

View wturnerharris's full-sized avatar

Wes Turner-Harris wturnerharris

View GitHub Profile
@wturnerharris
wturnerharris / em-speaker.php
Created November 13, 2013 04:17
Added a new taxonomy for Events Manager, which facilitates adding Event Speakers to events. The taxonomy includes the title, description, and an image.
<?php
if( defined('EM_TAXONOMY_CATEGORY') ) {
define('EM_TAXONOMY_SPEAKER','event-speakers');
define('EM_TAXONOMY_SPEAKER_SLUG', 'event/speakers');
function parse_event_cat_query( ){
global $wp_query, $post;
if( is_tax(EM_TAXONOMY_SPEAKER)||is_tax(EM_TAXONOMY_CATEGORY) ){
unset($wp_query->query_vars['meta_query']);
@wturnerharris
wturnerharris / gateway-braintree.php
Created November 13, 2013 04:02
BrainTree extensions for Events Manager Pro Requires Braintree PHP libraries available via composer or direct download: https://www.braintreepayments.com/assets/client_libraries/php/braintree-php-2.23.1.tar.gz
<?php
if ( class_exists('EM_Gateway') ) :
class BraintreeGateway extends EM_Gateway {
var $gateway = 'braintree';
var $title = 'BrainTree';
var $status = 4;
var $status_txt = 'Processing (BrainTree)';
var $button_enabled = false;
var $supports_multiple_bookings = true;
@wturnerharris
wturnerharris / class-backend-tables.php
Created November 11, 2013 14:29
This is an example of extending the default class for tables in the admin section, WP_List_Table. It does take some setup arguments, but works and looks seamlessly within WordPress.
<?php
if(!class_exists('WP_List_Table')) require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
/**
* Extended class for displaying a list of items in an HTML table.
*
* @usage
* // be sure to modify the display_rows function to customize the output of the rows
* $args = array(
@wturnerharris
wturnerharris / class-rewrite-rules.php
Created November 11, 2013 13:52
This class is an example of how to add rewrite rules and the actions to take should the rewrite be matched.
<?php
/**
* WP_Theme_Rewrites Class for WordPress.
*
*/
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
exit("Do not access this file directly.");
class WP_Theme_Rewrites {
@wturnerharris
wturnerharris / class-membership.php
Last active February 15, 2019 12:46
Class to make things members-only in WordPress.--This class depends on a custom capability called 'is_approved_member' for user member access and the custom post meta key '_members_only' as a post-level custom field.
<?php
/**
* Custom class for WP_Membership routines.
*
*
* @package WP_Membership
* @since WP_Membership 0.1
*/
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
@wturnerharris
wturnerharris / deploy.php
Last active December 24, 2015 10:08
Auto-deployment script for php, github, apache.
<?php
/**
* Auto Deployment Script for GitHub and Apache.
*
*
* @since deploy 0.1
*/
$auth = md5('SECRET_PHRASE'); // set a private hash to validate against
if ( empty($_REQUEST['auth']) || $_REQUEST['auth'] != $auth) exit;
<link rel="icon" type="image/x-icon" href="<?php bloginfo('template_url'); ?>/im/favicon.png"/>
<!--[if IE]><link rel="shortcut icon" href="path/to/favicon.ico"><![endif]-->