+ * Plugin Name: Directory Custom Post Type
+ * Description: Custom Post Type for an employee directory. Requires customization to the active theme to display custom fields.
+// Prevent direct access to this file
+defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
+function pz_employee_custom_post_type() {
+ * Hero Images for the Front Page
+ * Theme will need to be configured using WP Query to use this tool
+ 'singular_name' => 'Employee',
+ 'menu_name' => 'Directory',
+ 'name_admin_bar' => 'Employee',
+ 'add_new' => 'Add an Employee',
+ 'add_new_item' => 'Add an Employee',
+ 'new_item' => 'New Employee',
+ 'edit_item' => 'Edit Employee',
+ 'view_item' => 'View Employee',
+ 'all_items' => 'All Employees',
+ 'search_items' => 'Search Employees',
+ 'parent_item_colon' => 'Parent Employees:',
+ 'not_found' => 'No Employees found.',
+ 'not_found_in_trash' => 'No Employee entries found in Trash.',
+ 'publicly_queryable' => true,
+ 'show_in_menu' => true,
+ 'menu_icon' => 'dashicons-groups',
+ 'rewrite' => array( 'slug' => 'directory' ),
+ 'capability_type' => 'post',
+ 'hierarchical' => true,
+ 'show_in_rest' => true,
+ 'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields', 'page-attributes' ),
+ 'taxonomies' => array( 'category' ),
+register_post_type( 'employees', $args );
+add_action( 'init', 'pz_employee_custom_post_type' );
+// Flush rewrite to add as a permalink slug when plugin is activated or reactiviated.
+function pz_rewrite_flush() {
+ pz_employee_custom_post_type();
+register_activation_hook( __FILE__, 'pz_rewrite_flush' );
+ * Disables Advanced Custom Fields default preference to hide custom fields
+ * This allows the user to add standard custom fields that can be added to the
+ * active theme such as email address, office location etc.
+if ( function_exists('get_field') ) {
+ add_filter('acf/settings/remove_wp_meta_box', '__return_false');