Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: Custom Code for CLIENT
- Description: Site specific code changes for CLIENT Website
- */
- /* Start Adding Functions Below this Line */
- // Job Creator Role
- function add_career_management_role() {
- add_role('career_manager',
- 'Career Manager',
- array(
- 'read' => true,
- 'edit_posts' => false,
- 'delete_posts' => false,
- 'publish_posts' => false,
- 'upload_files' => true,
- )
- );
- }
- register_activation_hook( __FILE__, 'add_career_management_role' );
- // Our custom post type function
- function create_posttype() {
- register_post_type( 'career',
- // CPT Options
- array(
- 'labels' => array(
- 'name' => __( 'Careers' ),
- 'singular_name' => __( 'Career' )
- ),
- 'public' => true,
- 'show_ui' => true,
- 'has_archive' => true,
- 'rewrite' => array('slug' => 'jobposting'),
- 'capability_type' => array('career','careers'),
- 'map_meta_cap' => true,
- )
- );
- }
- // Hooking up our function to theme setup
- add_action( 'init', 'create_posttype' );
- // Add career role-based functionality
- add_action('admin_init','career_add_role_caps',999);
- function career_add_role_caps() {
- // Add the roles you'd like to administer the custom post types
- $roles = array('editor','administrator','career_manager');
- // Loop through each role and assign capabilities
- foreach($roles as $the_role) {
- $role = get_role($the_role);
- $role->add_cap( 'read' );
- $role->add_cap( 'read_career');
- $role->add_cap( 'read_private_careers' );
- $role->add_cap( 'edit_career' );
- $role->add_cap( 'edit_careers' );
- $role->add_cap( 'edit_others_careers' );
- $role->add_cap( 'edit_published_careers' );
- $role->add_cap( 'publish_careers' );
- $role->add_cap( 'delete_others_careers' );
- $role->add_cap( 'delete_private_careers' );
- $role->add_cap( 'delete_published_careers' );
- }
- }
- /* Stop Adding Functions Below this Line */
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement