The following filters enables an additional plugin customization by adding/removing languages and themes. You can add the filter hooks within your Theme's functions.php file or a custom plugin.
NOTICE The filters only affects the UI components (dropdowns, ..) and not the resources!
Description: Filter to modify the internal themes list
// add a custom filter to modify the theme list
add_filter('enlighter_themes', function($themes){
// DEBUG: just display the dataset - uncomment the following line to debug issues
// echo '<pre>', print_r($themes, true), '</pre>';
// unset the theme
unset($themes['godzilla']);
return $themes;
});// add a custom filter to modify the theme list
add_filter('enlighter_themes', function ($themes){
// DEBUG: just display the dataset - uncomment the following line to debug issues
// echo '<pre>', print_r($themes, true), '</pre>';
// just show the Classic + Enlighter Theme
// Add a new custom theme named my_c_theme - shown as 'MyCustom Lalala Themes' in select boxes
// Note: Custom themes CSS has to be loaded separately
return array(
'enlighter' => 'Enlighter',
'godzilla' => 'Godzilla',
'beyond' => 'Beyond',
'classic' => 'Classic'
);
});Description: Filter to modify the internal language list
// add a custom filter to modify the language list
add_filter('enlighter_languages', function($langs){
// DEBUG: just display the dataset - uncomment the following line to debug issues
// echo '<pre>', print_r($langs, true), '</pre>';
unset($langs['java']);
unset($langs['javascript']);
return $langs;
});// add a custom filter to modify the language list
add_filter('enlighter_languages', function ($langs){
// Add a new custom language named mylang - shown as 'MyCustom Lalala Lang' in select boxes
// Note: Custom language JS has to be loaded separately
return array(
'mylang'=> 'MyCustom Lalala Lang',
// html, css, js
'js' => 'Javascript',
'html5' => 'HTML v5',
'css' => 'CSS'
);
});Description: Filter to modify the resource url
// add a custom filter to modify the resource url's
add_filter('enlighter_resource_url', function ($resourceName){
return 'https://mycdn.mydomain.tld/wp-enlighter/' . $resourceName;
}Description: Filter to modify the content sections to which the shortcode processor will be applied (other filters)
function mm_ejs_buddypress($filters){
// add buddypress activity - enable shortcodes here
$filters[] = 'bp_get_activity_content';
return $filters;
}
// add a custom filter to add a custom content section
add_filter('enlighter_shortcode_filters', 'mm_ejs_buddypress');Description: Filter to disable Enlighter on selected pages
Note: This filter is executed on an early setup stage (on WordPress init) - therefore lot of global objects like wpquery are not populated yet!
function mm_ejs_disable_enlighter($enabled){
// compare uri
return ($_SERVER['REQUEST_URI'] != '/codegroup-shortcode.html');
}
// add startup filter
add_filter('enlighter_startup', 'mm_ejs_disable_enlighter');Description: Applied to inline javascript which is injected into the page (mostly used for configuration data)
function mm_ejs_inline_script($script){
// return empty string
return '';
}
// add filter
add_filter('enlighter_inline_javascript', 'mm_ejs_inline_script');Description: Forced enabling/disabling of the frontend editing functions. The default value is created by the condition USER_LOGGED_IN AND (CAN_EDIT_POSTS OR CAN_EDIT_PAGES). Useful to bind editing capabilities to special users/groups
function mm_ejs_frontend_editing($allowed){
return ($allowed && current_user_can('manage_options'));
}
// add filter
add_filter('enlighter_frontend_editing', 'mm_ejs_frontend_editing');function mm_ejs_frontend_editing($allowed){
return is_user_logged_in();
}
// add filter
add_filter('enlighter_frontend_editing', 'mm_ejs_frontend_editing');Description: Filters the codeblock titles. Adds the ability for custom titles
NOTICE: the filter is only triggered if the editor css is re-generated by the plugin (save settings)
// custom prefix
function mm_ejs_title($title, $languageIdentifier, $languageName){
return 'Embedded Sourcecode #' . $languageName;
}
// add filter. priority 10 with 3 arguments passed to the callback
add_filter('enlighter_codeblock_title', 'mm_ejs_title', 10, 3);Description: Filter to modify the internal language list of the editors
// add a custom filter to modify the language list
add_filter('enlighter_editor_languages', function($langs){
// DEBUG: just display the dataset - uncomment the following line to debug issues
// echo '<pre>', print_r($langs, true), '</pre>';
unset($langs['java']);
unset($langs['javascript']);
return $langs;
});Description: Filter to modify the internal themes list of the editors
// add a custom filter to modify the theme list
add_filter('enlighter_editor_themes', function($themes){
// DEBUG: just display the dataset - uncomment the following line to debug issues
// echo '<pre>', print_r($themes, true), '</pre>';
// unset the theme
unset($themes['godzilla']);
return $themes;
});Description: Filter to editor config object
add_filter('enlighter_editor_config', function($config){
// DEBUG: just display the dataset - uncomment the following line to debug issues
// echo '<pre>', print_r($config, true), '</pre>';
return $config;
});