Skip to content

Instantly share code, notes, and snippets.


Chris Olbekson c3mdigital

  • WebDev Studios
  • Houston, TX
View GitHub Profile
View wp-chosen-tax-metabox.php
* WordPress Chosen Taxonomy Metabox
* Author: Helen Hou-Sandi
* Use Chosen for a replacement taxonomy metabox in WordPress
* Useful for taxonomies that aren't changed much on the fly and are
* non-hierarchical in nature, as Chosen is for flat selection only.
* You can always use the taxonomy admin screen to add/edit taxonomy terms.
* Categories need slightly different treatment from the rest in order to
c3mdigital / class-simple-local-avatars.php
Created Jun 24, 2012
Upload custom avatars for users to override gravatar for comments and author_meta
View class-simple-local-avatars.php
Plugin Name: Custom WordPress Avatars
Plugin URI:
Description: Adds a custom avatar uploader in the user profile to replace gravatars with a custom avatar
Version: 1.0
Author: Chris Olbekson
Author URI:
License: GPL v2
View plugin.php
/* Plugin Name: Damn Vulnerable WordPress Plugin
* Description: Intentionally vulnerable plugin for plugin author education
* Version: 0.1
* Plugin URI:
* Author: Jon Cave
* Author URI:
* License: GPLv2+
c3mdigital / cacheable-ajax.php
Last active Jan 30, 2021
Example of how to cache fronted ajax requests in WordPress. This will allow you to use ajax and page caching like varnish or redis. Where ajax requests would normally not be cached using the built in wp_ajax_action method.
View cacheable-ajax.php
add_filter( 'rewrite_rules_array', 'cache_frontend_ajax_rules' );
* Rewrite rules filter to add rules for front end ajax calls
* @param array $rewrite_rules
* @return array
c3mdigital / class-microcache-purge.php
Created Nov 16, 2012
WordPress Nginx Multisite Configuration with Nginx Microcahing
View class-microcache-purge.php
* Micro Cache Purge PHP Class
* Sends a request header to nginx to purge the microcache when post are created or updated
* Include this file at plugins_loaded or in theme functions.php
new Micro_Cache_Purge();
class Micro_Cache_Purge {
c3mdigital / multiple-post-query.php
Created May 11, 2012
Custom $wp_query loop to show 3 posts from 3 different post types using only 1 query
View multiple-post-query.php
$args = array(
'post_type' => array( 'type1', 'type2', 'type3' ),
'posts_per_page' => -1
$myquery = new WP_Query( $args );
$type1 = 0; $type2 = 0; $type3 = 0; $count = 0;
while ( $myquery->have_posts() ) : $myquery->the_post();
View gist:2032898
* WordPress Query Comprehensive Reference
* Compiled by luetkemj -
* Source:
$args = array(
c3mdigital /
Created May 1, 2014
Vagrant Provisioning Script
# This file is specified in Vagrantfile and is loaded by Vagrant as the primary
# provisioning script whenever the commands `vagrant up`, `vagrant provision`,
# or `vagrant reload` are used. It provides all of the default packages and
# configurations included with Varying Vagrant Vagrants.
# By storing the date now, we can calculate the duration of provisioning at the
c3mdigital /
Last active May 16, 2016
Git pseudo post-push hook for updating supermodel when changes are made and pushed to submodule

Git post push hook for updating supermodule when submodule is updated

  • Create file named git-push-wh with the following content and add it to your path

GIT_DIR_="$(git rev-parse --git-dir)"

BRANCH="$(git rev-parse --symbolic --abbrev-ref $(git symbolic-ref HEAD))"
View VagrantFile
# -*- mode: ruby -*-
# vi: set ft=ruby :
dir = Dir.pwd
vagrant_dir = File.expand_path(File.dirname(__FILE__))
Vagrant.configure("2") do |config|
# Store the current version of Vagrant for use in conditionals when dealing
# with possible backward compatible issues.