Building a Staff Directory Plugin for WordPress

Posted on 21st June 2023

As a website owner, you may want to display a list of your staff on your site. This can be useful for visitors who want to know who works for your company and what their role is.

There are a few ways to go about adding a staff directory to your WordPress site. You could use a theme that has this functionality built-in, or you could use a plugin.

In this article, we will show you how to easily create a staff directory in WordPress using a plugin.

Why Use a Plugin for Your Staff Directory?

There are a few reasons why you may want to use a plugin rather than a theme to create your staff directory.

First, using a plugin will give you more control over the layout and design of your staff directory. This can be important if you want to match the directory to the rest of your site’s design.

Second, using a plugin will allow you to add additional features to your staff directory, such as social media links, headshots, and bios.

Third, using a plugin will make it easier to add and update your staff directory. This is because you will be able to do it all from within the WordPress admin area.

Fourth, using a plugin will make it easier to add your staff directory to multiple pages or posts on your site. This can be done by using a shortcode or a widget.

Finally, using a plugin will give you the ability to easily export your staff directory as a CSV file. This can be useful if you ever need to move your staff directory to another site.

Now that we have covered some of the reasons why you may want to use a plugin for your staff directory, let’s take a look at some of the best plugins available.

The Best Staff Directory Plugins for WordPress

There are a few great staff directory plugins available for WordPress. Below, we will highlight some of the best options and show you how to use them.

Employee Directory Plugin

The Employee Directory Plugin is a great option for creating a staff directory in WordPress. It comes with a number of features, including the ability to add headshots, social media links, and bios.

The plugin also includes a searchable directory, shortcodes, and the ability to export your directory as a CSV file.

Simple Staff List

Simple Staff List is a lightweight plugin that allows you to easily create a staff directory in WordPress. It comes with a number of features, including the ability to add headshots, social media links, and bios.

The plugin also includes shortcodes, making it easy to add your staff directory to any post or page on your site.

WP Staff List

WP Staff List is another great option for creating a staff directory in WordPress. It comes with all of the features you would expect, such as the ability to add headshots, social media links, and bios.

The plugin also includes shortcodes, making it easy to add your staff directory to any post or page on your site.

How to Use a Plugin to Create Your Staff Directory

Now that we have covered some of the best plugins available for creating a staff directory in WordPress, let’s take a look at how to use them.

For this example, we will be using the Employee Directory Plugin.

First, you will need to install and activate the plugin. For more information, see our guide on how to install a WordPress plugin.

Once the plugin is activated, you will need to create a new directory. To do this, click on the “Add New” link under the “Employee Directory” menu item.

On the next screen, you will need to enter a name for your directory and then click on the “Add Directory” button.

Once you have created your directory, you will need to add your employees to it. To do this, click on the “Add Employee” link under the “Employee Directory” menu item.

On the next screen, you will need to enter the employee’s name, job title, bio, and headshot. Once you have entered all of the information, click on the “Add Employee” button.

Repeat this process for each employee you want to add to your directory.

Once you have added all of your employees, you are ready to display your staff directory on your WordPress site.

To do this, you will need to use a shortcode. The shortcode for the Employee Directory plugin is [employeedirectory].

You can add this shortcode to any post or page on your site. Simply edit the post or page and then add the shortcode to the content area.

Once you have added the shortcode, save your post or page and then preview it to see your staff directory in action.

That’s all there is to it! You can now easily create a staff directory in WordPress using a plugin.

Assuming you have a basic knowledge of PHP and WordPress plugin development, let’s look at how to build a staff directory plugin for WordPress.

The first thing you need to do is create a new directory for your plugin in the /wp-content/plugins/ directory. For our example, we’ll call our plugin ‘staff-directory’.

Next, you need to create a file called ‘staff-directory.php’ in your new plugin directory. This will be the main plugin file.

At the top of your new plugin file, you need to add a plugin header. This is required by WordPress in order for your plugin to be recognized. The plugin header for our example looks like this:

<?php
/**
* Plugin Name: Staff Directory
* Plugin URI: https://example.com/staff-directory
* Description: A plugin to create a staff directory.
* Version: 1.0
* Author: John Doe
* Author URI: https://example.com
* License: GPL2
*/

Now that we have our plugin file and plugin header set up, we can start adding our plugin code.

The first thing we need to do is create a custom post type for our staff members. This can be done with the register_post_type() function.

_x( ‘Staff Members’, ‘Post Type General Name’, ‘text_domain’ ),
‘singular_name’ => _x( ‘Staff Member’, ‘Post Type Singular Name’, ‘text_domain’ ),
‘menu_name’ => __( ‘Staff Directory’, ‘text_domain’ ),
‘name_admin_bar’ => __( ‘Staff Member’, ‘text_domain’ ),
‘archives’ => __( ‘Staff Archives’, ‘text_domain’ ),
‘attributes’ => __( ‘Staff Attributes’, ‘text_domain’ ),
‘parent_item_colon’ => __( ‘Parent Staff:’, ‘text_domain’ ),
‘all_items’ => __( ‘All Staff’, ‘text_domain’ ),
‘add_new_item’ => __( ‘Add New Staff Member’, ‘text_domain’ ),
‘add_new’ => __( ‘Add New’, ‘text_domain’ ),
‘new_item’ => __( ‘New Staff Member’, ‘text_domain’ ),
‘edit_item’ => __( ‘Edit Staff Member’, ‘text_domain’ ),
‘update_item’ => __( ‘Update Staff Member’, ‘text_domain’ ),
‘view_item’ => __( ‘View Staff Member’, ‘text_domain’ ),
‘view_items’ => __( ‘View Staff’, ‘text_domain’ ),
‘search_items’ => __( ‘Search Staff’, ‘text_domain’ ),
‘not_found’ => __( ‘Not found’, ‘text_domain’ ),
‘not_found_in_trash’ => __( ‘Not found in Trash’, ‘text_domain’ ),
‘featured_image’ => __( ‘Featured Image’, ‘text_domain’ ),
‘set_featured_image’ => __( ‘Set featured image’, ‘text_domain’ ),
‘remove_featured_image’ => __( ‘Remove featured image’, ‘text_domain’ ),
‘use_featured_image’ => __( ‘Use as featured image’, ‘text_domain’ ),
‘insert_into_item’ => __( ‘Insert into staff member’, ‘text_domain’ ),
‘uploaded_to_this_item’ => __( ‘Uploaded to this staff member’, ‘text_domain’ ),
‘items_list’ => __( ‘Staff list’, ‘text_domain’ ),
‘items_list_navigation’ => __( ‘Staff list navigation’, ‘text_domain’ ),
‘filter_items_list’ => __( ‘Filter staff list’, ‘text_domain’ ),
);
$args = array(
‘label’ => __( ‘Staff Member’, ‘text_domain’ ),
‘description’ => __( ‘A post type for staff members’, ‘text_domain’ ),
‘labels’ => $labels,
‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’ ),
‘taxonomies’ => array( ‘category’, ‘post_tag’ ),
‘hierarchical’ => false,
‘public’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘menu_position’ => 5,
‘show_in_admin_bar’ => true,
‘show_in_nav_menus’ => true,
‘can_export’ => true,
‘has_archive’ => true,
‘exclude_from_search’ => false,
‘publicly_queryable’ => true,
‘capability_type’ => ‘page’,
);
register_post_type( ‘staff_member’, $args );

}
add_action( ‘init’, ‘custom_post_type’, 0 );
?>

This code registers a new post type called ‘staff_member’. We’ve also set up some labels and arguments for our post type. For more information on custom post types, please see the WordPress Codex.

Next, we need to create a custom taxonomy for our staff members. This will allow us to categorize our staff members. We can do this with the register_taxonomy() function.

_x( ‘Staff Categories’, ‘Taxonomy General Name’, ‘text_domain’ ),
‘singular_name’ => _x( ‘Staff Category’, ‘Taxonomy Singular Name’, ‘text_domain’ ),
‘menu_name’ => __( ‘Staff Categories’, ‘text_domain’ ),
‘all_items’ => __( ‘All Staff Categories’, ‘text_domain’ ),
‘parent_item’ => __( ‘Parent Staff Category’, ‘text_domain’ ),
‘parent_item_colon’ => __( ‘Parent Staff Category:’, ‘text_domain’ ),
‘new_item_name’ => __( ‘New Staff Category Name’, ‘text_domain’ ),
‘add_new_item’ => __( ‘Add New Staff Category’, ‘text_domain’ ),
‘edit_item’ => __( ‘Edit Staff Category’, ‘text_domain’ ),
‘update_item’ => __( ‘Update Staff Category’, ‘text_domain’ ),
‘view_item’ => __( ‘View Staff Category’, ‘text_domain’ ),
‘separate_items_with_commas’ => __( ‘Separate staff categories with commas’, ‘text_domain’ ),
‘add_or_remove_items’ => __( ‘Add or remove staff categories’, ‘text_domain’ ),
‘choose_from_most_used’ => __( ‘Choose from the most used’, ‘text_domain’ ),
‘popular_items’ => __( ‘Popular Staff Categories’, ‘text_domain’ ),
‘search_items’ => __( ‘Search Staff Categories’, ‘text_domain’ ),
‘not_found’ => __( ‘Not Found’, ‘text_domain’ ),
‘no_terms’ => __( ‘No staff categories’, ‘text_domain’ ),
‘items_list’ => __( ‘Staff Categories list’, ‘text_domain’ ),
‘items_list_navigation’ => __( ‘Staff Categories list navigation’, ‘text_domain’ ),
);
$args = array(
‘labels’ => $labels,
‘hierarchical’ => true,
‘public’ => true,
‘show_ui’ => true,
‘show_admin_column’ => true,
‘show_in_nav_menus’ => true,
‘show_tagcloud’ => true,
);
register_