Skip to content

Instantly share code, notes, and snippets.

@butchpage
Created January 31, 2014 16:27
Show Gist options
  • Select an option

  • Save butchpage/8735535 to your computer and use it in GitHub Desktop.

Select an option

Save butchpage/8735535 to your computer and use it in GitHub Desktop.
WordPress Custom Post Type Sublime Snippet
<snippet>
<content><![CDATA[
function $1() {
\$labels = array(
'name' => '$2',
'singular_name' => '$3',
'add_new' => 'Add New',
'add_new_item' => 'Add New $3',
'edit_item' => 'Edit $2',
'new_item' => 'New $2',
'all_items' => 'All $2',
'view_item' => 'View $2',
'search_items' => 'Search $2',
'not_found' => 'No $2 Found',
'not_found_in_trash' => 'No $2 found in Trash',
'parent_item_colon' => '$4',
'menu_name' => '$2'
); // end $labels
\$args = array(
'labels' => \$lables,
'public' => ${5:true},
'publicly_queryable' => ${6:true},
'show_ui' => ${7:true},
'show_in_menu' => ${8:true},
'query_var' => ${9:true},
'rewrite' => array( 'slug' => '$10'),
'capability_type' => '${11:post}',
'has_archive' => ${12:true},
'hierarchical' => ${13:false},
'menu_position' => ${14:null},
'supports' => array( '${15:title}', '${16:editor}')
); // end $args
register_post_type( '$17', \$args );
}
add_action( 'init', '$1' );
$0
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>cpt</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment