steveosoule
10/16/2014 - 12:53 AM

WordPress Custom Post Types

WordPress Custom Post Types

<?
// FROM: http://www.webdesignerdepot.com/2014/10/how-to-take-your-wordpress-sites-to-the-next-level-with-custom-post-types/


// Append the following code to WordPress's "functions.php" file
add_action( 'init', 'register_movie' );

function register_movie() {

	$labels = array(
		'name' => 'Movies',
		'singular_name' => 'Movie',
		'add_new' => 'Add New',
		'add_new_item' => 'Add New Movie',
		'edit_item' => 'Edit Movie',
		'new_item' => 'New Movie',
		'view_item' => 'View Movie',
		'search_items' => 'Search Movies',
		'not_found' => 'No movies found',
		'not_found_in_trash' => 'No movies found in Trash',
		'menu_name' => 'Movies',
	);

	$args = array(
		'labels' => $labels,
		'hierarchical' => false,
		'description' => 'Here you will add all the movies for the database',
		'supports' => array( 'title', 'editor', 'thumbnail' ),
		'taxonomies' => array( 'genre', 'movies', 'year' ),
		'public' => true,
		'show_ui' => true,
		'show_in_menu' => true,
		'menu_position' => 5,
		//'menu_icon' => '/path/to/icon.png',
		'show_in_nav_menus' => true,
		'publicly_queryable' => true,
		'exclude_from_search' => false,
		'has_archive' => true,
		'query_var' => true,
		'can_export' => true,
		'rewrite' => true,
		'capability_type' => 'post'
	);

	register_post_type( 'movie', $args );
}
?>