Skip to content

Instantly share code, notes, and snippets.

View th3hamburgler's full-sized avatar

Jim Wardlaw th3hamburgler

View GitHub Profile
@th3hamburgler
th3hamburgler / Flexible fixed nav
Last active December 14, 2015 01:19
jQuery function to allow for nav menu's with flexible withs and dropdowns that can 'outgrow' their parent. Usage flexible_fixed_nav('#nav > ul > li');
function flexible_fixed_nav(selector) {
var $items = $(selector);
if (!$items.length) return;
$items
.each(
function (index, parent) {
var parentWidth = $(parent).width();
var childWidth = 0;
var $childList = $(parent).find('> ul');
$childList.show();
@th3hamburgler
th3hamburgler / gist:4605395
Created January 23, 2013 13:10
Wordpress: Save data from post meta box. Ignore pesky revisions.
/**
* Save custom post data meta box
*
* @access function
* @param int
* @return void
*/
function save_post($post_id) {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
if (!wp_verify_nonce( $_POST['my_noncename'], MY_PLUGIN_DIRECTORY)) return;