Skip to content

Instantly share code, notes, and snippets.

@danielbrinneman
Last active September 26, 2016 23:30
Show Gist options
  • Save danielbrinneman/4dfe6f208e197d739696a1c6143924fe to your computer and use it in GitHub Desktop.
Save danielbrinneman/4dfe6f208e197d739696a1c6143924fe to your computer and use it in GitHub Desktop.
Created November 27, 2012
Custom Post Type
function create_post_type_reservations() {
register_post_type( 'reservations', array(
'labels' => array(
'name' => __( 'Reservations' ),
'singular_name' => __( 'Reservation' ),
'add_new' => __( 'Add New Reservation' ),
'add_new_item' => __( 'Add New Reservation' ),
'edit' => __( 'Edit Reservation' ),
'edit_item' => __( 'Edit Reservation' ),
'new' => __( 'New Reservation' ),
'new_item' => __( 'New Reservation' ),
'view' => __( 'View Reservation' ),
'view_item' => __( 'View Reservation' ),
'search_items' => __( 'Search Reservations' ),
'not_found' => __( 'No Reservations Found' ),
'not_found_in_trash' => __( 'No Reservations found in Trash' ),
),
'public' => true,
'menu_position' => 20,
'rewrite' => array('slug' => 'simple_reservations'),
'supports' => array('title','editor','excerpt','custom-fields'),
'hierarchical' => false,
'description' => __('Take reservations. New feature currently under development.'),
'show_ui' => true,
'publicly_queryable' => true,
'exclude_from_search' => true,
'can_export' => true,
)
);
}
add_action( 'init', 'create_post_type_reservations' );
Custom Taxonomies
function reservations_taxonomy() {
register_taxonomy(
'reservation_locations',
'reservations',
array(
'hierarchical' => true,
'label' => 'Locations',
'query_var' => true,
'rewrite' => array('slug' => 'reservation_locations')
)
);
}
add_action( 'init', 'reservations_taxonomy' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment