Skip to content

Instantly share code, notes, and snippets.

View zanematthew's full-sized avatar

Zane Matthew zanematthew

View GitHub Profile
@zanematthew
zanematthew / gist:1970585
Created March 4, 2012 03:46
WordPress Ajax Login -- Target Div snippet
<?php
/**
* Target div for login form and container for dialog.
*
* This could easily be hooked into wp_footer() or just pasted into footer.php
* We have out parent div which is the dom element that jQuery UI modal is
* being attached to. The child div is our target element for our ajax
* requested form.
*/
?>
@zanematthew
zanematthew / login.js
Created March 4, 2012 03:43
JavaScript used for the WordPress Ajax Login form
/**
* JavaScript file for loading the custom login form.
* Note we are using jQuery in "no conflict mode".
*/
jQuery(document).ready(function( $ ){
/**
* Set-up our default dialog box with the following
* parameters.
*/
@zanematthew
zanematthew / Login.php
Created March 4, 2012 03:42
WordPress Login Form
<?php
/**
* Template for login form.
*
* Submission is handled via ajax, see @package zm-wordpress-helpers for
* server side code. See the function call in zm_register_login_submit()
* for form processing.
*
* @uses zm_register_login_submit()
* @uses wp_lostpassword_url()
<?php
// Sample data
$taxonomies = array(
'editorial' => array(
'book',
'magazines',
'new',
'newspaper',
'website',
jQuery(document).ready(function( $ ){
$("a.toggle_handle").on( "click", function( event ){
event.preventDefault
items = $( this ).attr("data-items");
$( "tr." + items ).toggle();
});
$(".item_handle").on("click", function( event ){
taxonomy = $(this).attr('data-taxonomy');
@zanematthew
zanematthew / gist:1554712
Created January 3, 2012 12:14
Builds a option list of Custom Taxonomies for use in WordPress
/**
* Build an option list of Terms based on a given Taxonomy.
*
* @package helper
* @uses zm_base_get_terms to return the terms with error checking
* @param string $taxonomy
* @param mixed $value, the value to be used in the form field, can be term_id or term_slug
*/
if ( ! function_exists( 'zm_base_build_options' ) ) :
function zm_base_build_options( $taxonomy=null, $value=null ) {
@zanematthew
zanematthew / gitconfig user and email
Created December 9, 2011 15:35
Syntax for adding your name and email to a gitconfig
[user]
name = Zane M. Kolnik
email = [email protected]
@zanematthew
zanematthew / gist:1268641
Created October 6, 2011 20:51
Sample class
class CustomPostType extends CustomPostTypeBase {
/**
* Every thing that is "custom" to our CPT goes here.
*/
public function __construct() {
$this->dependencies['script'] = array(
'jquery',
'jquery-ui-core',
public function registerPostType( $args=NULL ) {
foreach ( $this->post_type as $post_type ) {
if ( !empty( $post_type['taxonomies'] ) )
$taxonomies = $post_type['taxonomies'];
.
.
.
.
interface ICustomPostType {
public function registerPostType( $param=array() );
public function registerTaxonomy( $param=array() );
// @todo http://codex.wordpress.org/Function_Reference/locate_template
public function templateRedirect();
public function regsiterActivation();
// public function regsiterDeactivation();
// public function baseStyleSheet( $param=array() );