Skip to content

Instantly share code, notes, and snippets.

@chipbennett
chipbennett / breadcrumb.navigation.php
Last active August 29, 2015 13:58
Breadcrumb Navigation
<?php
/**
* Add navigation breadcrumb
*/
function wp_nav_breadcrumb( $args = array() ) {
$defaults = array(
'wrapper' => 'div',
'wrapper_id' => 'breadcrumbs',
@chipbennett
chipbennett / jeffro-site-favicon.php
Created February 1, 2014 15:23
Jeffro's Favicon Site Functionality Plugin
/**
* Plugin Name: Jeffro's Site Favicon
*/
/**
* Hook favicon link into document head
*/
function jeffro_site_favicon() {
?>
<!– HTML Code goes here –>
@chipbennett
chipbennett / control-automatic-updates.php
Created January 25, 2014 16:37
WordPress Automatic Update Filters
<?php
/*
* Plugin Name: Site Plugin - Control Automatic Updates
* Description: Site Plugin to add filters to control automatic updates
*/
/**
* To disable all automatic updates, use this filter
*/
//add_filter( 'auto_updater_disabled', '__return_true', 1 );
@chipbennett
chipbennett / gist:7628079
Created November 24, 2013 14:52
Bumblebee Fix for Ubuntu 13.10
sudo ln -s /usr/lib/i386-linux-gnu/libturbojpeg.so.0 /usr/lib/i386-linux-gnu/libturbojpeg.so
via:
http://www.webupd8.org/2013/10/fix-bumblebee-libturbojpegso-issue-in.html
@chipbennett
chipbennett / gist:6173596
Created August 7, 2013 12:23
Reusable add_meta_box()
// Add the Meta Box
function add_custom_meta_box() {
// Post
add_meta_box(
'cram_post_meta_box', // $id
'Additional information for the post', // $title
'add_custom_meta_box_callback', // $callback
'post', // $page
'normal', // $context
'high' // $priority
@chipbennett
chipbennett / gist:3874106
Created October 11, 2012 17:29
siiimple_single_meta in single.php
/**
Assuming 'no-sidebar' is the fallback/default template to use.
Also, replacing TEMPLATEPATH with get_template_part()
**/
<div class="row">
<?php if ( ! empty( $enable_single ) ) { ?>
<?php get_template_part( '/framework/includes/' . $enable_single ); ?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php bloginfo( 'charset' ); ?>" />
<!-- Meta -->
@chipbennett
chipbennett / gist:1864068
Created February 19, 2012 14:29
How to install PAE headers for Ubuntu Linux kernel, for Bumblebee Nvidia/Optimus
sudo apt-get install -f
sudo apt-get clean
sudo apt-get update
sudo apt-get install linux-headers-$(uname -r)
sudo dkms autoinstall -k $(uname -r)
sudo apt-get --purge --reinstall install nvidia-current
sudo modprobe -v -r nouveau
sudo restart bumblebeed
@chipbennett
chipbennett / get_search_form_draft.php
Created December 13, 2011 01:29
Draft proposed update for get_search_form() - rev 2 of Trac-submitted patch
<?php
/**
* Display search form.
*
* This function is primarily used by themes that want to hardcode the search
* form into the sidebar and also by the search widget in WordPress.
*
* Will first attempt to locate the searchform.php file in either the child or
* the parent, then load it. If it doesn't exist, then the default search form
* will be displayed. The default search form is HTML, which will be displayed.
@chipbennett
chipbennett / WCTOR.codingstandard.1.php
Created November 3, 2011 02:25
WCTOR.codingstandard.1
<?php
// If the decoded json data has content, prepare the data
// to be output.
if ( 'issues' == $context ) {
// $reportdate is used as a table column header
$reportdate = ( 'open' == $status ? 'Reported' : 'Closed' );
// $reportobject is used to return the appropriate timestamp
$reportobject = ( 'open' == $status ? 'created_at' : 'closed_at' );
} else if ( 'commits' == $context ) {
// $reportdate is used as a table column header