Skip to content

Instantly share code, notes, and snippets.

@dgmike
Forked from mannieschumpert/gist:3815767
Created October 2, 2012 02:12
Show Gist options
  • Save dgmike/3815778 to your computer and use it in GitHub Desktop.
Save dgmike/3815778 to your computer and use it in GitHub Desktop.
WordPress Taxonomy Snippet for Sublime Text
<snippet>
<content><![CDATA[
// Create taxonomy
add_action( 'init', 'create_${1:FUNCTION}' );
function create_${1:FUNCTION}() {
$labels = array(
'name' => _x( '${3:PLURAL}', 'taxonomy general name' ),
'singular_name' => _x( '${2:SINGULAR}', 'taxonomy singular name' ),
'search_items' => __( 'Search ${3:PLURAL}' ),
'all_items' => __( 'All ${3:PLURAL}' ),
'parent_item' => __( 'Parent ${2:SINGULAR}' ),
'parent_item_colon' => __( 'Parent ${2:SINGULAR}:' ),
'edit_item' => __( 'Edit ${2:SINGULAR}' ),
'update_item' => __( 'Update ${2:SINGULAR}' ),
'add_new_item' => __( 'Add New ${2:SINGULAR}' ),
'new_item_name' => __( 'New ${2:SINGULAR} Name' ),
);
register_taxonomy('${3:PLURAL}','${4:POST-TYPE}',array(
'hierarchical' => true, // false for tags
'labels' => $labels
));
}
]]></content>
<tabTrigger>wptax</tabTrigger>
<scope>source.php</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment