Template Overrides

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

  1. Create a cp-staff directory in your active theme
  2. Copy the template file you want to customize from the plugin’s templates/ directory
  3. Modify the copy in your theme
  4. 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:

  1. Create the directory structure in your theme:

    yourtheme/cp-staff/parts/
  2. 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
  3. Edit yourtheme/cp-staff/parts/staff-card.php to 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 role
    • email — Email address
    • phone — Phone number
    • social — Social media links array
    • alt_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/title
  • get_post_meta( get_the_ID(), 'social', true ) — Social links
  • get_post_meta( get_the_ID(), 'email', true ) — Email address
  • get_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 department
  • cp_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.

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support
Scroll to Top