Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shkm/2587167 to your computer and use it in GitHub Desktop.
Save shkm/2587167 to your computer and use it in GitHub Desktop.
register_post_type snippet for Sublime Text 2
<snippet>
<content><![CDATA[
register_post_type('${1:slug}', array(
${2:'labels' => array(
${3:'name' => _x( '${4:Plural Name}', '${5:translation context}', '${6:translation domain}' ),}
${8:'singular_name' => _x( '${9:Singular Name}', '${10:translation context}', '${6:translation domain}' ),}
${11:'add_new' => _x( '${12:Add new}', '$9', '${6:translation domain}' ),}
${13:'add_new_item' => __( '$12 $9', '${6:translation domain}' ),}
${14:'edit_item' => __( 'Edit ${15:$9}', '${6:translation domain}' ),}
${16:'new_item' => __( 'New ${17:$9}', '${6:translation domain}' ),}
${18:'view_item' => __( 'View ${19:$9}', '${6:translation domain}' ),}
${20:'search_items' => __( '${21:Search $4}', '${6:translation domain}' ),}
${22:'not_found' => __( '${24:No $4 found}', '${6:translation domain}' ),}
${25:'not_found_in_trash' => __( '${26:No $4 found in Trash}', '${6:translation domain}' ),}
),}
${28:'description' => __( '${29:Description}' ),}
${30:'public' => ${31:true},}
${32:'publicly_queryable' => ${33:true},}
${34:'exclude_from_search' => ${35:true},}
${36:'show_ui' => ${37:true},}
${38:'show_in_menu' => ${39:true},}
${40:'menu_position' => ${41:null},}
${42:'menu_icon' => '${43:iconurl}',}
${44:'capability_type' => '${45:post}',}
${46:'map_meta_cap' => ${47:false},}
${48:'hierarchial' => ${49:false},}
${50:'supports' => array(${51:'title',}${52: 'editor',}${53: 'author',}${54: 'thumbnail',}${55: 'excerpt',}${56: 'trackbacks',}${57: 'custom-fields',}${58: 'comments',}${59: 'revisions',}${60: 'page-attributes',}${61: 'post-formats',}),}
${62:'register_meta_box_cb' => '${63:}',}
${64:'taxonomies' => array(${65:'category'}),}
${66:'permalink_epmask' => ${67:EP_PERMALINK},}
${68:'has_archive' => ${69:false},}
${70:'rewrite' => ${71:array(
${72:'slug' => '${73:$1}',}
${74:'with_front' => ${75:true},}
${76:'feeds' => ${77:$69},}
${78:'pages' => ${79:true},}
)},}
${80:'query_var' => ${81:true},}
${82:'can_export' => ${83:true},}
${84:'show_in_nav_menus' => ${85:$31},}
));
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>registerposttype</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