Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////////////////////////////////////////
- // Register blogs post type
- //////////////////////////////////////////////////////////////////
- add_action( 'init', 'register_blogs_post_type' );
- function register_blogs_post_type() {
- register_post_type( 'blogs',
- array(
- 'labels' => array(
- 'name' => __( 'Blogs' ),
- 'singular_name' => __( 'Blog' ),
- 'add_new' => __( 'Add New' ),
- 'add_new_item' => __( 'Add New Blog' ),
- 'edit' => __( 'Edit' ),
- 'edit_item' => __( 'Edit Blog' ),
- 'new_item' => __( 'New Blog' ),
- 'view' => __( 'View Blog' ),
- 'view_item' => __( 'View Blog' ),
- 'search_items' => __( 'Search blogs' ),
- 'not_found' => __( 'No Blogs found' ),
- 'not_found_in_trash' => __( 'No Blogs found in Trash' ),
- 'parent' => __( 'Parent Blog' ),
- ),
- 'public' => true,
- 'show_ui' => true,
- 'publicly_queryable' => true,
- 'show_in_nav_menus' => false,
- 'exclude_from_search' => false,
- 'hierarchical' => false,
- 'rewrite' => array('slug'=>'blog'),
- 'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'comments', 'author'),
- 'taxonomies' => array('post_tag')
- )
- );
- flush_rewrite_rules();
- }
- //////////////////////////////////////////////////////////////////
- // Register blogs category taxonomy
- //////////////////////////////////////////////////////////////////
- add_action( 'init', 'create_blog_category', 0 );
- function create_blog_category()
- {
- $labels = array(
- 'name' => _x( 'Blog Categories', 'taxonomy general name' ),
- 'singular_name' => _x( 'Blog Category', 'taxonomy singular name' ),
- 'search_items' => __( 'Search Blog Categories' ),
- 'all_items' => __( 'All Blog Categories' ),
- 'parent_item' => __( 'Parent Blog Category' ),
- 'parent_item_colon' => __( 'Parent Blog Category:' ),
- 'edit_item' => __( 'Edit Blog Category' ),
- 'update_item' => __( 'Update Blog Category' ),
- 'add_new_item' => __( 'Add New Blog Category' ),
- 'new_item_name' => __( 'New Blog Category Name' ),
- 'menu_name' => __( 'Categories' ),
- );
- register_taxonomy('blog_category',array('blogs'), array(
- 'hierarchical' => true,
- 'labels' => $labels,
- 'show_ui' => true,
- 'query_var' => true,
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement