Created
October 3, 2013 16:48
-
-
Save bonsak/6813031 to your computer and use it in GitHub Desktop.
Sublime Text WP Register Post Type Snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <snippet> | |
| <content><![CDATA[ | |
| // Register Custom Post Type | |
| function ${1:custom_post_type}() { | |
| \$labels = array( | |
| 'name' => _x( '${2:post_type}s', 'Post Type General Name', '${3:text_domain}' ), | |
| 'singular_name' => _x( '${2:post_type}', 'Post Type Singular Name', '${3:text_domain}' ), | |
| 'menu_name' => __( '${2:post_type}', '${3:text_domain}' ), | |
| 'parent_item_colon' => __( 'Parent ${2:post_type}:', '${3:text_domain}' ), | |
| 'all_items' => __( 'All ${2:post_type}s', '${3:text_domain}' ), | |
| 'view_item' => __( 'View ${2:post_type}', '${3:text_domain}' ), | |
| 'add_new_item' => __( 'Add New ${2:post_type}', '${3:text_domain}' ), | |
| 'add_new' => __( 'New ${2:post_type}', '${3:text_domain}' ), | |
| 'edit_item' => __( 'Edit ${2:post_type}', '${3:text_domain}' ), | |
| 'update_item' => __( 'Update ${2:post_type}', '${3:text_domain}' ), | |
| 'search_items' => __( 'Search ${2:post_type}s', '${3:text_domain}' ), | |
| 'not_found' => __( 'No ${2:post_type}s found', '${3:text_domain}' ), | |
| 'not_found_in_trash' => __( 'No ${2:post_type}s found in Trash', '${3:text_domain}' ), | |
| ); | |
| \$args = array( | |
| 'label' => __( '${2:post_type}', '${3:text_domain}' ), | |
| 'description' => __( '${2:post_type} information pages', '${3:text_domain}' ), | |
| 'labels' => $labels, | |
| 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes', 'post-formats', ), | |
| 'taxonomies' => array( 'category', 'post_tag' ), | |
| 'hierarchical' => false, | |
| 'public' => true, | |
| 'show_ui' => true, | |
| 'show_in_menu' => true, | |
| 'show_in_nav_menus' => true, | |
| 'show_in_admin_bar' => true, | |
| 'menu_position' => 5, | |
| 'menu_icon' => '', | |
| 'can_export' => true, | |
| 'has_archive' => true, | |
| 'exclude_from_search' => false, | |
| 'publicly_queryable' => true, | |
| 'capability_type' => 'page', | |
| ); | |
| register_post_type( '${2:post_type}', $args ); | |
| // Hook into the 'init' action | |
| add_action( 'init', '${1:custom_post_type}', 0 ); | |
| } | |
| ]]></content> | |
| <!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
| <tabTrigger>register_post</tabTrigger> | |
| <!-- Optional: Set a scope to limit where the snippet will trigger --> | |
| <!-- <scope>source.python</scope> --> | |
| </snippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment