Return to Snippet

Revision: 52084
at October 13, 2011 00:10 by maxxscho


Initial Code
	// creating (registering) the custom type
	$labels = array(
		'name'				=> _x('Custom Types', 'post type general name', 'big_bang'),	//This is the title of the group
		'singular_name'		=> _x('Custom Post', 'post type singular name', 'big_bang'),	//This is the individual type
		'add_new'			=> _x('Add New', 'custom post type item', 'big_bang'),	//The add new menu item
		'add_new_item'		=> __('Add New Custom Type', 'big_bang'),	// Add new Display Title
		'all_items'			=> __('All Custom Types', 'big_bang'),	// The All Items in the Menu
		'edit'				=> __('Edit', 'big_bang'),	//Edit Dialog
		'edit_item'			=> __('Edit Custom Type', 'big_bang'), //Edit Display Title
		'new_item'			=> __('New Custom Type', 'big_bang'),	//New Display Title
		'view_item'			=> __('View Custom Type', 'big_bang'),	//View Display Title
		'search_items'		=> __('Search Custom Post Type', 'big_bang'),	//Search Custom Type Title
		'not_found'			=> __('Nothing found in the Database.', 'big_bang'), //This displays if there are no entries yet
		'not_found_in_trash'=> __('Nothing found in Trash', 'big_bang'),	//This displays if there is nothing in the trash
		'parent_item_colon'	=> ''
	);
	$args = array(
		'labels'				=> $labels,
		'description'			=> __('This is an example custom post type.', 'big_bang'),	//Custom Type Description
		'public'				=> true,
		'publicly_queryable'	=> true,
		'exclude_from_search'	=> false,
		'show_ui'				=> true,
		'query_var'				=> true,
		'menu_position'			=> 8,	//This is what order you want it to appear in on the left hand side menu
		'menu_icon'				=> get_stylesheet_directory_uri() . '/images/custom-post-icon.png',	//the icon for the custom post type menu
		'rewrite'				=> true,
		'capability_type'		=> 'post',
		'hierachical'			=> false,
		// the next one is important, it tells what's enabled in the post editor
		'supports'				=> array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'sticky')
	);
	
	register_post_type(	'custom_type', $args); // (http://codex.wordpress.org/Function_Reference/register_post_type)

Initial URL

                                

Initial Description

                                

Initial Title
Wordpress register custom post type

Initial Tags
post, wordpress

Initial Language
PHP