Thrive Themes products come with a set of helpful hooks that allow developers to extend functionality, modify data, and trigger custom logic during specific events.
1. Action Hooks
Actions provide a way to run a function at a specific point in the execution of WordPress Core, plugins, and themes.
Implementation Example
function custom_logic_after_campaign_start($data) {
// Add your custom logic here
}
add_action('thrive_ultimatum_evergreen_campaign_start', 'custom_logic_after_campaign_start');
Supported Products & Key Hooks
| Product | Hook ID | Description |
|---|---|---|
| Thrive Dashboard | thrive_core_user_login | Fired when a user logs in. |
| Thrive Architect | thrive_core_lead_signup | Fired when a lead is captured via a Lead Generation form. |
| Thrive Apprentice | thrive_apprentice_lesson_completed | Fired when a student completes a lesson. |
| Thrive Ultimatum | thrive_ultimatum_campaign_start | Fired when a campaign starts for a user. |
2. Filter Hooks
Filters allow you to intercept and modify data before it is processed or displayed.
Featured Example: Social Meta Data Filter
The tha_social_meta filter allows you to modify the Open Graph and Twitter metadata generated by your theme.
Filter Definition:
$meta = apply_filters('tha_social_meta', $meta);
Usage Example:
Add this to your child theme’s functions.php to override the og:url data:
add_filter("tha_social_meta", "modify_og_url");
function modify_og_url($meta) {
$url = 'https://yourcustomurl.com';
$meta['og:url']['content'] = $url;
return $meta;
}
Metadata Structure:
The $meta array contains unique IDs for each tag, allowing for precise overrides of og:type, og:url, twitter:card, and more.
3. Parameter Reference
When hooking into Thrive events, the following data objects are commonly passed to your functions:
- User Data: Includes
WP_Userobject, Username, and Email. - Form Data: Raw data submitted through Lead Generation or Contact Forms.
- Apprentice Data: Lesson IDs, Course IDs, and Module structures.
- Campaign Data: Thrive Ultimatum campaign IDs and settings.
4. Best Practices
- Use Child Themes: Always add custom hooks to a child theme’s
functions.phpor a site-specific plugin to prevent changes from being lost during updates. - Prefix Functions: Prefix your function names (e.g.,
tt_oryourprefix_) to avoid conflicts with WordPress core or other plugins. - Reference GitHub: For more advanced hook examples, visit our Developer GitHub Repository.