Logo Carousel Pro

  1. Home
  2. Docs
  3. Logo Carousel Pro
  4. Hooks: Actions and Filters

Hooks: Actions and Filters

A comprehensive guideline on how to use Logo Carousel Pro 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 add custom fonts in the plugin

3) How to add Custom Google Fonts in the Typography

4) How to remove any Safe Web Fonts from the plugin

 

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_lc_ui_permission) available in the plugin which allows you to modify the plugin’s functionality.

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

2) How to add custom fonts in the plugin

If you want to add any custom font to the plugin. You can do this easily with the custom code below. But your custom font must be enqueued/loaded in your theme or site. Then you just need to write the font name in the function below. If you check the code you will see there is a filter hook available (spftestimonial_field_typography_customwebfonts) in the plugin by which you can easily add custom fonts.

function sp_custom_fonts(){
    $custom_fonts = array(
        'Jupiter SP',
        'Sonar Bangla',
        'Ruposhi Bangla'
    );
    return $custom_fonts;
}
add_filter( 'splogocarousel_field_typography_customwebfonts', 'sp_custom_fonts' );

3) How to add Custom Google Fonts in the Typography

If you want to add any custom font to the plugin. You can do this easily with the custom code below. But your custom font must be enqueued/loaded in your theme or site. Then you just need to write the font name in the function below. If you check the code you will see there is a filter hook available (spftestimonial_field_typography_googlewebfonts) in the plugin by which you can easily add custom fonts.

function sp_custom_google_fonts() {
    $webfonts = array(
        'Jupiter SP',
        'Sonar Bangla',
        'Ruposhi Bangla'
    );
    return $webfonts;
}
add_filter( 'splogocarousel_field_typography_googlewebfonts', 'sp_custom_google_fonts' );

4) How to remove any Safe Web Fonts from the plugin

Suppose you don’t want to use any specific Safe Web Fonts of the plugin, and you don’t want to display them in the Typography section. Then you can do this easily with the following custom code. If you check the code you will see there is a filter hook available (spftestimonial_field_typography_safewebfonts) in the plugin by which you can easily remove the specific font. You just need to put the array key number of the font in the function.

function typography_safewebfonts_remove($safewebfonts) { 
    unset($safewebfonts['0']); 
    // To remove the Arial font 
    return $safewebfonts; 
}
add_filter( 'splogocarousel_field_typography_safewebfonts', 'typography_safewebfonts_remove' );