WP Team

  1. Home
  2. Docs
  3. WP Team
  4. Hooks: Actions and Filters

Hooks: Actions and Filters

A comprehensive guideline on how to use WP Team filter hooks. We have added the following hooks for developers to extend functionalities. Simply add the following custom code to your current theme’s functions.php file. It’s recommended to keep the code in the functions.php file of your child theme. Because you might lose your customizations if the theme is updated. Keeping the modified codes in your parent theme’s child theme is therefore the best practice.

1) How to provide the plugin access to the Editors

2) How to remove the dynamic CSS from the WP Team

3) How to load WP Team dynamic CSS in the header section

4) How to add a custom company name for your team members

 

1) How to provide the plugin access to the Editors   

If you want to give the plugin access to the Editor role users you can do it easily with the help of the following custom code. If you check the code you can see there is an action hook (sp_wp_team_ui_permission) available in the plugin which allows you to modify the plugin’s functionality.

// Give access to the Editors
function sp_wp_team_ui_permission_to_editor($capability){ 
    $capability = 'edit_others_pages'; 
    return $capability; 
} 
add_filter( 'sp_wp_team_ui_permission', 'sp_wp_team_ui_permission_to_editor' );

2) How to remove the dynamic CSS from the WP Team

Suppose you want to remove the dynamic CSS style from the team view. With the custom code below, you can easily do it. If you check the code, you will see there are two filter hooks available (spteam_free_style_load_in_header, and sp_team_free_dynamic_css) in the plugin which allows you to modify the plugin’s functionality.

// To remove WP Team dynamic CSS 
add_filter( 'spteam_free_style_load_in_header', '__return_false' ); 
add_filter( 'sp_team_free_dynamic_css', '__return_false' );

3) How to load WP Team dynamic CSS in the header section

If you want to load the dynamic CSS of WP Team Pro in the header section, you can do it with the custom code below. If you check the code, you will see there is a filter hook (spteam_free_style_load_in_header) available through which you can do this.

// To load WP Team dynamic CSS before team section 
add_filter( 'spteam_free_style_load_in_header', '__return_false' );

4) How to add a custom company name for your team members

Suppose you want to add a custom company name for all of your team members, you can do it with the custom code below. If you check the code, you will see there is a filter hook (sp_team_after_member_job_title) available through which you can do this.

// To add Company Name for all team members 
function sptp_member_company_name(){ 
    $company_name = '<h4 class="sptp-member-company">Company Name</h4>'; 
    echo $company_name; 
}
add_action( 'sp_team_after_member_job_title', 'sptp_member_company_name', 10 );