/ Published in: PHP
Example shows how to register post types for :
* Listings (defined as 'mysite_listings' with the rewrite slug 'lookup')
* Then registers the 'usa_states' taxonomy to the mysite_listings post type.
* Listings (defined as 'mysite_listings' with the rewrite slug 'lookup')
* Then registers the 'usa_states' taxonomy to the mysite_listings post type.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// custom post types function create_post_type() { register_post_type( 'mysite_listings', 'name' => __( 'Listings' ), 'singular_name' => __( 'Listing' ) ), 'public' => true, 'menu_position' => 5, ) ); } add_action( 'init', 'create_post_type' ); // taxonomies function listing_taxonomy() { register_taxonomy( 'usa_states', 'mysite_listings', 'hierarchical' => true, 'label' => 'US States', 'query_var' => true, ) ); } // add_action( 'init', 'listing_taxonomy' );
URL: http://codex.wordpress.org/Post_Types