-
-
Save robbiegod/97de76a7b47fedd520bf3ccdbd0d6127 to your computer and use it in GitHub Desktop.
Register Post Type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
class Skubbs_Post_Types { | |
public static function init() { | |
add_action( 'init', array( __CLASS__, 'register_post_types' ), 5 ); | |
} | |
public static function register_post_types() { | |
register_post_type( 'bike_shops', | |
array( | |
'labels' => array( | |
'name' => 'Bike Shops', | |
'singular_name' => 'Bike Shop', | |
'menu_name' => 'Bike Shops', | |
'add_new' => 'Add Bike Shop', | |
'add_new_item' => 'Add New Bike Shop', | |
'edit' => 'Edit', | |
'new_item' => 'New Bike Shop', | |
'view' => 'View Bike Shop', | |
'search_item' => 'Search Bike Shops', | |
'not_found' => 'No Bike Shops found', | |
'not_found_in_trash' => 'No Bike Shops found in trash', | |
'parent' => 'Parent Bike Shop' | |
), | |
register_taxonomy( 'bike_shops_cat', 'bike_shops', | |
array( | |
'hierarchical' => true, | |
'label' => 'Category', | |
'rewrite' => array( 'slug' => 'bike_shops_cat' ), | |
'query_var' => true | |
) | |
), | |
'description' => 'This is where you can add new Bike Shops.', | |
'public' => true, | |
'show_ui' => true, | |
'capability_type' => 'page', | |
'publicly_queryable' => true, | |
'hierarchical' => false, | |
'rewrite' => array( 'slug' => 'bike_shops' ), | |
'query_var' => true, | |
'supports' => array( 'title' ), | |
'has_archive' => true, | |
'show_in_nav_menus' => true | |
) | |
); | |
} | |
} | |
Skubbs_Post_Types::init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment