Select Page

Since version 3.0 (1.5 for the free version) the plugin uses functions similar to the hooks in WordPress for JavaScript code.

Find more information about all JavaScript hooks on this page. Find more information on the functions for applying filters on this page.

When adding a hook straight away on page load, you need to check whether the functions are available. If they are not available use the berocket_hooks_ready event, which is called immediately after initializing functions.

Example code for replacing the function of unfolding filters:

bapf_custom_smb_open_function = function(use_default, $this) {
    $this.find('.bapf_body').first().show();
    if( $this.find('.bapf_colaps_smb').length ) {
        $this.find('.bapf_colaps_smb').removeClass('fa-chevron-down').addClass('fa-chevron-up');
    }
    return false;
}
if ( typeof(berocket_add_filter) == 'function' ) {
    berocket_add_filter('colaps_smb_open_apply', bapf_custom_smb_open_function);
} else {
    jQuery(document).on('berocket_hooks_ready', function() {
        berocket_add_filter('colaps_smb_open_apply', bapf_custom_smb_open_function);
    });
}