Skip to content

Instantly share code, notes, and snippets.

View zanematthew's full-sized avatar

Zane Matthew zanematthew

View GitHub Profile
$_GLOBALS['task'] = new CustomPostType();
$_GLOBALS['task']->post_type = array(
array(
'name' => 'Task',
'type' => 'task',
'supports' => array(
'title',
'editor',
'author',
'comments'
@zanematthew
zanematthew / gist:1248680
Created September 28, 2011 17:58
Basic Bash Profile
######
#
# NOTE, you must reload your profile for these changes to take effect
# [your name ~] source .bash_profile
# color codes: http://www.funtoo.org/en/articles/linux/tips/prompt/
#
######
######
#
@zanematthew
zanematthew / gist:1218426
Created September 15, 2011 03:08
Template Redirect loopy
foreach( $this->post_type as $wtf ) {
$my_cpt = get_post_types( array( 'name' => $wtf['type']), 'objects' );
if ( is_tax( $wtf['taxonomies'] ) ) {
global $wp_query;
if ( in_array( $wp_query->query_vars['taxonomy'], $wtf['taxonomies'] ) ) {
if ( file_exists( MY_PLUGIN_DIR . 'theme/custom/' . $wtf['type'] . '-taxonomy.php' ) ) {
load_template( MY_PLUGIN_DIR . 'theme/custom/' . $wtf['type'] . '-taxonomy.php' );
} elseif ( file_exists( MY_PLUGIN_DIR . 'theme/default/taxonomy.php' ) ) {
load_template( MY_PLUGIN_DIR . 'theme/default/taxonomy.php' );
@zanematthew
zanematthew / gist:1187330
Created September 1, 2011 21:28
My Git Config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[color]
ui = auto
interactive = true
@zanematthew
zanematthew / Remind me!
Created August 28, 2011 05:05
When entering a directory show the last entered notes that are in Git. This is used as a quick reminder for a forgetful programmer.
#!/bin/bash
if [ ${PWD##*/} == task-tracker ]; then
echo `git notes show`
fi
@zanematthew
zanematthew / Template Redirect Switch
Created August 28, 2011 02:31
Redirecting a template in WordPress using a switch. This is used inside of a plugin when you want to allow default template for a Custom Post Type your template is generating.
case ( is_tax( $my_taxonomies ) ):
global $wp_query;
if ( in_array( $wp_query->query_vars['taxonomy'], $my_taxonomies ) ) {
foreach ( $my_taxonomies as $taxonomy ) {
load_template( MY_PLUGIN_DIR . 'theme/archive-' . $k['type'] . '.php' );
// load_template( MY_PLUGIN_DIR . 'theme/taxonomy-' . $my_taxonomies. '.php' );
}
}
exit;