Skip to content

Instantly share code, notes, and snippets.

View jbreitenbucher's full-sized avatar

Jon Breitenbucher jbreitenbucher

View GitHub Profile
@jbreitenbucher
jbreitenbucher / classroomstyle
Created December 31, 2011 05:36
Code to return data from multicheck taxonomy field
$styles = get_post_meta($post->ID, 'it_classroom_style_taxonomy',true) ;
echo $styles[0];
$style = get_term_by( 'id', $styles[0], 'style' );//get_term($styles[0], 'style');
print_r($style);
echo $style->name;
@jbreitenbucher
jbreitenbucher / widgets.php
Created January 20, 2012 20:44
Genesis: Customization of Featured Page and Post Widgets
<?php
/** Remove the Genesis Featured Post widget */
add_action( 'widgets_init', 'faculty_unregister_widgets' );
function faculty_unregister_widgets() {
unregister_widget( 'Genesis_Featured_Post' );
unregister_widget( 'Genesis_Featured_Page' );
}
add_action('widgets_init', create_function('', "register_widget('Faculty_Featured_Post');"));
add_action('widgets_init', create_function('', "register_widget('Faculty_Featured_Page');"));
@jbreitenbucher
jbreitenbucher / gist:1996824
Created March 7, 2012 22:44
Genesis: HTML5
#HTML5 DOCTYPE
remove_action( 'genesis_doctype', 'genesis_do_doctype' );
add_action( 'genesis_doctype', create_function( '', 'echo "<!DOCTYPE html><html><head>";' ) );
@jbreitenbucher
jbreitenbucher / gist:1996830
Created March 7, 2012 22:45
WordPress: Custom Post Type Template
<?php
/**
* Post Types
*
* This file registers any custom post types
*
* @package dorman-farrell
* @author The Pedestal Group <kathy@thepedestalgroup.com>
* @copyright Copyright (c) 2012, Dorman Farrell
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
@jbreitenbucher
jbreitenbucher / gist:1996832
Created March 7, 2012 22:46
WordPress: Plugin Header Boilerplate
<?php
error_reporting(E_ALL);
/*
Plugin Name: __pluginname__
Plugin URI: http://orthogonalcreations.com
Description: __description__
Author: Jon Breitenbucher
Author URI: http://orthogonalcreations.com
Version: __version__
@jbreitenbucher
jbreitenbucher / gist:1996837
Created March 7, 2012 22:47
WordPress: Widget Boilerplate
class JB-__Class Name__ extends WP_Widget {
function __construct()
{
$params = array(
'description' => '',
'name' => ''
);
parent::__contruct('','',$params);
@jbreitenbucher
jbreitenbucher / gist:1996840
Created March 7, 2012 22:48
WordPress: Options Page Boilerplate
class __JB_Options__ {
public __construct()
{
}
public add_menu_page()
{
add_options_page('__Menu Name__','__Menu Name___','administrator',__FILE__,array('__JB_Options__','display_options_page');
@jbreitenbucher
jbreitenbucher / gist:2019784
Created March 12, 2012 04:25 — forked from billerickson/gist:1650977
Genesis: Admin Pages - Complete
<?php
/**
* Child Theme Settings
* Requires Genesis 1.8 or later
*
* This file registers all of this child theme's specific Theme Settings, accessible from
* Genesis > Child Theme Settings.
*
* @package BE Genesis Child
* @author Bill Erickson <bill@billerickson.net>
@jbreitenbucher
jbreitenbucher / gist:2586365
Created May 3, 2012 15:11
Code to remove Vary
<FilesMatch "\.(oga | ogg | m4a | ogv | mp4 | m4v | webm)$" >
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
Header append Vary Host env=!dont-vary
Header append Vary Accept-Encoding env=!dont-vary
</IfModule>
</FilesMatch>
@jbreitenbucher
jbreitenbucher / gist:2710977
Created May 16, 2012 14:57
WordPress:Limit Administration Menus by Role
function jb_remove_menus_by_role () {
global $menu;
global $current_user;
$user_roles = $current_user->roles;
$user_role = array_shift($user_roles);
if($user_role == 'xxx') {
$restricted = array(__('Dashboard'), __('Posts'), __('Media'), __('Links'), __('Pages'), __('Appearance'), __('Tools'), __('Users'), __('Settings'), __('Comments'), __('Plugins'));
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);