Return to Snippet

Revision: 44039
at June 30, 2011 04:33 by coryschadt


Updated Code
//-----------register custom post type
register_post_type( 'projects',
array(
'labels' => array(
'name' => __( 'Projects' ), 
'singular_name' => __( 'Project' ),
'add_new' => _x('Add New', 'Project'),
'add_new_item' => __('Add New Project'), 
'edit_item' => __('Edit Project'),
'new_item' => __('New Project'),
'view_item' => __('View Projects'),
),
'public' => true,
'show_ui' => true,
'menu_icon' => get_stylesheet_directory_uri() . '/assets/images/icon-project.png',
'hierarchical' => false, //it means we cannot have parent and sub pages
'capability_type' => 'post', //will act like a normal post
'rewrite' => 'projects', //this is used for rewriting the permalinks
'query_var' => false,
'supports' => array( 'title','editor','thumbnail') //the editing regions that will support
)
);

//fixes permalinks issue with custom post types
flush_rewrite_rules();

Revision: 44038
at April 5, 2011 06:59 by coryschadt


Updated Code
//-----------register custom post type
register_post_type( 'projects',
array(
'labels' => array(
'name' => __( 'Projects' ), 
'singular_name' => __( 'Project' ),
'add_new' => _x('Add New', 'Project'),
'add_new_item' => __('Add New Project'), 
'edit_item' => __('Edit Project'),
'new_item' => __('New Project'),
'view_item' => __('View Projects'),
),
'public' => true,
'show_ui' => true,
'menu_icon' => get_stylesheet_directory_uri() . '/assets/images/icon-project.png',
'hierarchical' => false, //it means we cannot have parent and sub pages
'capability_type' => 'post', //will act like a normal post
'rewrite' => 'investment', //this is used for rewriting the permalinks
'query_var' => false,
'supports' => array( 'title','editor','thumbnail') //the editing regions that will support
)
);

Revision: 44037
at April 5, 2011 06:58 by coryschadt


Updated Code
//-----------register custom post type
	register_post_type( 'projects',
	array(
		'labels' => array(
		'name' => __( 'Projects' ), 
		'singular_name' => __( 'Project' ),
		'add_new' => _x('Add New', 'Project'),
		'add_new_item' => __('Add New Project'), 
		'edit_item' => __('Edit Project'),
		'new_item' => __('New Project'),
		'view_item' => __('View Projects'),
		),
		'public' => true,
		'show_ui' => true,
		'menu_icon' => get_stylesheet_directory_uri() . '/assets/images/icon-project.png',
		'hierarchical' => false, //it means we cannot have parent and sub pages
		'capability_type' => 'post', //will act like a normal post
		'rewrite' => 'investment', //this is used for rewriting the permalinks
		'query_var' => false,
		'supports' => array( 'title','editor','thumbnail') //the editing regions that will support
	)
	);

Revision: 44036
at April 5, 2011 06:54 by coryschadt


Initial Code
//-----------register custom post type
	  register_post_type( 'projects',
	    array(
	      'labels' => array(
	        'name' => __( 'Projects' ), 
	        'singular_name' => __( 'Project' ),
			'add_new' => _x('Add New', 'Project'),
			'add_new_item' => __('Add New Project'), 
			'edit_item' => __('Edit Project'),
			'new_item' => __('New Project'),
			'view_item' => __('View Projects'),
	      ),
	      'public' => true,
		  'show_ui' => true,
		  'menu_icon' => get_stylesheet_directory_uri() . '/assets/images/icon-project.png',
		  'hierarchical' => false, //it means we cannot have parent and sub pages
		  'capability_type' => 'post', //will act like a normal post
		  'rewrite' => 'investment', //this is used for rewriting the permalinks
		  'query_var' => false,
		  'supports' => array( 'title','editor','thumbnail') //the editing regions that will support
	    )
	  );

Initial URL

                                

Initial Description

                                

Initial Title
Wordpress - Custom post types

Initial Tags

                                

Initial Language
PHP