ult_admin_sidebar_try_automator_text
Filters the text displayed for the "Automation" link in the Uncanny Automator sidebar menu.
add_filter( 'ult_admin_sidebar_try_automator_text', $callback, 10, 1 );
Description
This filter allows developers to modify the text displayed for the "Try Automator" menu item in the Uncanny Toolkit admin sidebar. Developers can change the default "Automation" text to anything they prefer, useful for branding or localization. It fires before the menu item is rendered.
Usage
add_filter( 'ult_admin_sidebar_try_automator_text', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Example: Modify the text displayed for the 'Try Automator' sidebar item.
*
* This filter allows developers to change the default text 'Automation'
* to something else, perhaps to include a dynamic element or a different CTA.
*
* @param string $menu_item_text The default menu item text.
* @return string The modified menu item text.
*/
add_filter( 'ult_admin_sidebar_try_automator_text', function( $menu_item_text ) {
// Check if a specific user role should see a different text
if ( current_user_can( 'administrator' ) ) {
return __( 'Unlock Powerful Automations', 'your-text-domain' );
}
// Otherwise, return the default text (or a slightly modified version)
return $menu_item_text . ' (Featured)';
}, 10, 1 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/install-automator.php:41
public function add_try_automator_page() {
// Check if Automator is already installed
if ( defined( 'AUTOMATOR_BASE_FILE' ) ) {
return;
}
// Check if we have to render the item
if ( ! apply_filters( 'ult_admin_sidebar_try_automator_add', true ) ) {
return;
}
// Get the item text
$menu_item_text = apply_filters( 'ult_admin_sidebar_try_automator_text', __( 'Automation', 'uncanny-learndash-toolkit' ) );
// Create the link content
$menu_item_html = '<span class="ult-sidebar-featured-item">' . apply_filters( 'ult_admin_sidebar_try_automator_inner_html', '<span class="ult-sidebar-featured-item__text">' . $menu_item_text . '</span>' ) . '</span>';
// Add the subpage menu
add_submenu_page(
'uncanny-toolkit',
$menu_item_text,
$menu_item_html,
'manage_options',
'install-automator',
array( $this, 'install_automator_page' ),
1
);
}