Skip to content

Instantly share code, notes, and snippets.

<?php
/* Register custom post types on the 'init' hook. */
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 0.1.0
* @access public
var tabbableElements = 'a[href], area[href], input:not([disabled]),' +
'select:not([disabled]), textarea:not([disabled]),' +
'button:not([disabled]), iframe, object, embed, *[tabindex],' +
'*[contenteditable]';
var keepFocus = function (context) {
var allTabbableElements = context.querySelectorAll(tabbableElements);
var firstTabbableElement = allTabbableElements[0];
var lastTabbableElement = allTabbableElements[allTabbableElements.length - 1];
@elusiveunit
elusiveunit / debounce-resize.js
Last active December 17, 2015 09:09
If more debouncing (or throttling) is needed, there is this plugin: https://github.com/cowboy/jquery-throttle-debounce
var resized = null;
$(window).resize(function() {
clearTimeout(resized);
resized = setTimeout(function() {
// Do stuff
}, 250);
});
@elusiveunit
elusiveunit / sticky-footer.html
Last active December 17, 2015 06:18
Sticky footer with table display
<?php
// Define the 'Portfolio' post type. This is used to represent galleries
// of photos. This will be our top-level custom post type menu
$args = array(
'labels' => array(
'all_items' => 'Gallery',
'menu_name' => 'Portfolio',
'singular_name' => 'Gallery',
'edit_item' => 'Edit Gallery',