/** * Runs on the page load. Checks if we're viewing the project post type and adds * the appropriate actions/filters for the page. * * @since 1.0.0 * @access public * @return void */ public function load() { $screen = get_current_screen(); $project_type = ccp_get_project_post_type(); // Bail if not on the projects screen. if (empty($screen->post_type) || $project_type !== $screen->post_type) { return; } // Custom action for loading the edit project screen. do_action('ccp_load_project_edit'); // Load the fields manager. require_once ccp_plugin()->dir_path . 'admin/fields-manager/class-manager.php'; // Create a new project details manager. $this->manager = new CCP_Fields_Manager('project_details'); // Enqueue scripts and styles. add_action('admin_enqueue_scripts', array($this, 'enqueue')); // Output the project details box. add_action('edit_form_after_editor', array($this, 'project_details_box')); // Add/Remove meta boxes. add_action('add_meta_boxes', array($this, 'add_meta_boxes')); // Add custom option to the publish/submit meta box. add_action('post_submitbox_misc_actions', array($this, 'submitbox_misc_actions')); // Save metadata on post save. add_action('save_post', array($this, 'update')); // Filter the post author drop-down. add_filter('wp_dropdown_users_args', array($this, 'dropdown_users_args'), 10, 2); }
$role->add_cap('manage_portfolio_tags'); // Post type caps. $role->add_cap('create_portfolio_projects'); $role->add_cap('edit_portfolio_projects'); $role->add_cap('edit_others_portfolio_projects'); $role->add_cap('publish_portfolio_projects'); $role->add_cap('read_private_portfolio_projects'); $role->add_cap('delete_portfolio_projects'); $role->add_cap('delete_private_portfolio_projects'); $role->add_cap('delete_published_portfolio_projects'); $role->add_cap('delete_others_portfolio_projects'); $role->add_cap('edit_private_portfolio_projects'); $role->add_cap('edit_published_portfolio_projects'); } } } /** * Gets the instance of the `CCP_Plugin` class. This function is useful for quickly grabbing data * used throughout the plugin. * * @since 1.0.0 * @access public * @return object */ function ccp_plugin() { return CCP_Plugin::get_instance(); } // Let's do this thang! ccp_plugin();
/** * Registers admin styles. * * @since 1.0.0 * @access public * @return void */ function ccp_admin_register_styles() { $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_register_style('ccp-admin', ccp_plugin()->css_uri . "admin{$min}.css"); }