CP Staff uses a template system that lets you override any template file in your WordPress theme. This gives you full control over how staff members are displayed.
How Template Overrides Work
- Create a
cp-staffdirectory in your active theme - Copy the template file you want to customize from the plugin’s
templates/directory - Modify the copy in your theme
- The plugin automatically uses your version instead of the default
Available Templates
| Template | Plugin Path | Description |
|---|---|---|
| Archive | templates/archive.php |
Staff directory with hierarchical department grouping |
| Single | templates/single.php |
Individual staff member page |
| Staff Card | templates/parts/staff-card.php |
Staff card used in grids and listings |
| Email Modal | templates/parts/email-modal.php |
Contact form modal dialog |
| Info Modal | templates/parts/info-modal.php |
Staff info modal (for modal click action) |
Override Example
To customize the staff card:
-
Create the directory structure in your theme:
yourtheme/cp-staff/parts/ -
Copy the template:
From: wp-content/plugins/cp-staff/templates/parts/staff-card.php To: wp-content/themes/yourtheme/cp-staff/parts/staff-card.php -
Edit
yourtheme/cp-staff/parts/staff-card.phpto customize the output
Template Variables
Staff Card (parts/staff-card.php)
Available in the template scope:
$click_action— Current click action setting (none,link,modal)$args['static']— Whether interactive features are disabled- Post meta via
get_post_meta():title— Staff member’s roleemail— Email addressphone— Phone numbersocial— Social media links arrayalt_image/alt_image_id— Alternate image
Single Staff (single.php)
Uses standard WordPress template tags plus:
get_post_meta( get_the_ID(), 'title', true )— Role/titleget_post_meta( get_the_ID(), 'social', true )— Social linksget_post_meta( get_the_ID(), 'email', true )— Email addressget_post_meta( get_the_ID(), 'alt_image_id', true )— Alternate image attachment ID
Archive (archive.php)
Helper functions available:
cp_staff_display_department( $department_id, $department_name, $heading_level )— Renders staff for a specific departmentcp_staff_display_hierarchical_departments( $parent_id, $depth )— Recursively renders departments and children
Tips
- Always copy a template before modifying — editing plugin files directly will lose changes on update
- Start with small changes and test frequently
- Use your browser’s developer tools to identify which template renders a specific section
For CSS customization without template overrides, see CSS Styling.
