Skip to content

Instantly share code, notes, and snippets.

View jbreitenbucher's full-sized avatar

Jon Breitenbucher jbreitenbucher

View GitHub Profile
@jbreitenbucher
jbreitenbucher / gist:2948888
Created June 18, 2012 15:22
CMB: MCEDC metabox
<?php
/**
* Metaboxes
*
* This file registers any custom metaboxes
*
* @package mcedc
* @author The Pedestal Group <kathy@thepedestalgroup.com>
* @copyright Copyright (c) 2012, Medina County Economic Development Corporation
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
@jbreitenbucher
jbreitenbucher / order taxonomy
Created July 31, 2012 23:12
WordPress: Order Custom Taxonomy Term page by custom key
/**
* Make sure to order staff on role term pages alphabetically by last name
*
* @author Jon Breitenbucher <jbreitenbucher@wooster.edu>
* @version SVN: $Id$
* @param array $query Default query arguments
* @return array modified query arguments
*
* @since 2.0
*
@jbreitenbucher
jbreitenbucher / gist:3648028
Created September 5, 2012 23:52
WordPress: Load templates from within a plugin
function get_custom_archive_template($template) {
global $wp_query;
$object = $wp_query->get_queried_object();
if ( 'gslstaff' == $object->post_type ) {
$templates = array();
if ( $object->post_type )
$templates[] = "archive-{$object->post_type}.php";
$templates[] = 'archive.php';
@jbreitenbucher
jbreitenbucher / genesis-staff-listing
Last active August 29, 2015 14:07
Code for including page templates from within my Genesis Staff Listing plugin (requires the StudioPress Genesis theme)
<?php
error_reporting(E_ALL);
/*
Plugin Name: Genesis Staff Listing
Plugin URI: http://orthogonalcreations.com
Description: This plugin adds a Staff custom post type and role taxonomy. It also includes templates for displaying the Staff post type.
Author: Jon Breitenbucher
Author URI: http://orthogonalcreations.com
Version: 1.1
@jbreitenbucher
jbreitenbucher / WordPress Custom Function Library
Created October 15, 2014 13:06
Common WordPress custom functions
/* Limit Your Website Excerpt */
function word_limit($string, $max_words){
$post_words = explode(' ', $string);
$count = count($post_words);
$post_words = implode(' ', array_slice($post_words, 0, $max_words));