Working with People Extension
The People extension (t2/people) provides a complete solution for managing and displaying team members, employees, or any people-based content in WordPress. It registers a custom post type with taxonomies and custom fields specifically designed for person profiles.
For End Users
What Does This Extension Do?
The People extension allows you to:
- Create and manage person profiles with dedicated fields for contact information
- Organize people by role and department using built-in taxonomies
- Display people in grids using the Featured Content block
- Show contact details using the People Meta block
- Control single post pages with optional per-person visibility settings
Features Available
Post Type: Person
- Custom post type for individual people/employees
- Featured image support for profile photos
- Custom fields for contact information
- Integration with WordPress block editor
Taxonomies
- Role: Job titles or positions (e.g., "Developer", "Designer")
- Department: Organizational units (e.g., "Engineering", "Marketing")
Contact Information Fields
- Email address
- Phone number
- Mobile number (optional)
- Bio/description (optional)
Custom Blocks
- People Meta Block (
t2/people-meta): Displays person's contact information and taxonomies
How to Use
-
Enable the Extension
- Go to WordPress Admin → T2 Settings
- Enable the "People" extension
- Or add to your theme's
t2.json:"mu-extensions": ["t2/people"]
-
Create People Entries
- Navigate to "People" in the WordPress admin menu
- Click "Add new"
- Fill in the person's name (post title)
- Add a featured image for their photo
- Select their role(s) and department(s)
- Add email, phone, and other contact details in the sidebar
-
Display People on Your Site
- Use the Featured Content Layout block to display people in grids
- Add the People Meta block inside person single posts to show contact info
- The extension automatically creates a custom card template for the Featured Content block
-
Configure Options
- Edit your theme's
t2.jsonfile to customize behavior - See Configuration Options section below
- Edit your theme's
Screenshots & Examples
Default Card View: Shows featured image, name, role, department, email, and phone
Extended Card View: Includes mobile number and bio when enabled
Edit View: Custom meta boxes for all person fields in the WordPress editor
For Developers
Architecture
File Structure
packages/extension-library/src/people/
├── block-library/
│ └── people-meta/ # Block for displaying person metadata
│ ├── block.json
│ ├── block.php
│ └── editor.js
├── extension.json # Extension metadata
├── extension.php # Entry point
├── namespace.php # Core functionality
├── constants.js # JS constants
├── index.js # Frontend JS initialization
├── view.js # Frontend interactions
└── style.css # Frontend styles
Registration Pattern
The extension follows T2's standard pattern:
extension.phploadsnamespace.phpnamespace.phpcallsboot()which hooks into WordPress- Post type, taxonomies, and meta are registered on
inithook - Blocks are auto-discovered via
load_blocks_in_extension('people')
Configuration Options
All configuration is done via t2.json in your theme root:
{
"version": 1,
"mu-extensions": ["t2/people"],
"t2/people": {
"postTypeKey": "person",
"features": {
"hasArchive": false,
"rewriteSlug": "people",
"hasSinglePost": false,
"hasRole": true,
"hasDepartment": true,
"hasEmail": true,
"hasPhone": true,
"hasMobile": false,
"hasBio": false
}
}
}
Configuration Reference
| Key | Type | Default | Description |
|---|---|---|---|
postTypeKey |
string | "person" |
Custom post type slug |
features.hasArchive |
boolean | false |
Enable post type archive page |
features.rewriteSlug |
string|false | false |
Custom URL slug (e.g., "team") |
features.hasSinglePost |
boolean | false |
Enable single post pages with per-post visibility control |
features.hasRole |
boolean | true |
Enable Role taxonomy |
features.hasDepartment |
boolean | true |
Enable Department taxonomy |
features.hasEmail |
boolean | true |
Enable email field |
features.hasPhone |
boolean | true |
Enable phone field |
features.hasMobile |
boolean | false |
Enable mobile phone field |
features.hasBio |
boolean | false |
Enable bio/description field |
Post Meta Keys
The extension registers the following post meta fields (based on feature flags):
people_email(string): Email addresspeople_phone(string): Phone numberpeople_mobile(string): Mobile phone number (if enabled)people_bio(string): Biography/description (if enabled)people_single_post(boolean): Whether single post is enabled for this person (ifhasSinglePostis true)
All meta fields are exposed via REST API (show_in_rest: true).
Taxonomy Keys
The extension registers two taxonomies:
- Role: Non-hierarchical taxonomy for job titles/positions
- Department: Non-hierarchical taxonomy for organizational units
Both default keys can be overridden via filters (see Hooks & Filters section).
Hooks & Filters
Filters
t2/extension/people/key_role
Override the role taxonomy key (default: "role"):
add_filter( 't2/extension/people/key_role', function( $key ) {
return 'job_title'; // Use 'job_title' instead of 'role'
} );
t2/extension/people/key_department
Override the department taxonomy key (default: "department"):
add_filter( 't2/extension/people/key_department', function( $key ) {
return 'team'; // Use 'team' instead of 'department'
} );
t2/extension/people/post_meta
Modify or add custom post meta fields:
add_filter( 't2/extension/people/post_meta', function( $meta_fields ) {
$meta_fields['people_linkedin'] = [
'type' => 'string',
'description' => 'LinkedIn Profile URL',
'single' => true,
'default' => '',
'show_in_rest' => true,
];
return $meta_fields;
} );
t2/extension/people/card_inner_blocks
Customize the inner blocks displayed in people cards when using Featured Content:
add_filter( 't2/extension/people/card_inner_blocks', function( $blocks ) {
// Modify the default blocks structure
return $blocks;
} );
t2/post_featured_image/fallback (Replaces deprecated filter)
Provide a fallback image for people without featured images:
add_filter( 't2/post_featured_image/fallback', function( $media_fallback, $post_id, $post_type, $site_id ) {
if ( 'person' === $post_type ) {
return '<img src="https://example.com/default-avatar.jpg" alt="Default avatar" />';
}
return $media_fallback;
}, 10, 4 );
Featured Content Integration
The People extension automatically registers a card template for use with the Featured Content Layout block. The template includes:
- Featured image (with fallback support)
- Post title (person's name)
- Role taxonomy terms
- Department taxonomy terms
- Email (linked as mailto:)
- Phone
- Mobile (if enabled)
- Bio (if enabled)
SEO & Sitemap Behavior
The extension integrates with Yoast SEO and WordPress core sitemaps:
When hasSinglePost is false (default):
- Entire post type is excluded from sitemaps
- Single posts return 404
When hasSinglePost is true:
- Post type is included in sitemaps
- Individual posts can be excluded via the
people_single_postmeta field - Template redirects excluded posts to 404
Development Tips
- Always run build after changes:
npm run buildcompiles both JS and CSS - Meta fields are conditional: Check feature flags before accessing meta fields
- Use helper functions:
get_post_type_key(),get_taxonomy_role(),get_taxonomy_department() - Test with different configs: Verify behavior with various feature flag combinations
Common Use Cases
Adding Custom Social Media Fields
// In your theme's functions.php
add_filter( 't2/extension/people/post_meta', function( $meta_fields ) {
$meta_fields['people_twitter'] = [
'type' => 'string',
'description' => 'Twitter Handle',
'single' => true,
'show_in_rest' => true,
];
return $meta_fields;
} );
Customizing Archive Queries
add_action( 'pre_get_posts', function( $query ) {
if ( $query->is_post_type_archive( 'person' ) && $query->is_main_query() ) {
$query->set( 'orderby', 'title' );
$query->set( 'order', 'ASC' );
}
} );
Dependencies
- T2 Core Packages:
blocks,extensions,config - WordPress: 6.2+, PHP 7.4+
- Featured Content Block: Required for displaying people grids
Known Limitations
- Role and Department taxonomies are non-hierarchical by default
- Single post functionality requires manual theme template creation
- Image fallback works globally via filter, not per-person configuration