ultc_admin_sidebar_try_automator_inner_html
Filters the HTML content displayed within the Automator section of the admin sidebar, allowing for customization.
add_filter( 'ultc_admin_sidebar_try_automator_inner_html', $callback, 10, 1 );
Description
This filter hook allows developers to modify the HTML content of the "Try Uncanny Automator" section in the admin sidebar. Use it to customize the text, add new elements, or completely replace the default HTML for this featured item.
Usage
add_filter( 'ultc_admin_sidebar_try_automator_inner_html', 'your_function_name', 10, 1 );
Parameters
-
$menu_item_text(mixed) - This parameter contains the text that will be displayed for the menu item linking to the Uncanny Automator plugin.
Return Value
The filtered value.
Examples
/**
* Example of modifying the inner HTML for the "Try Automator" sidebar item.
* This example adds an icon before the text.
*
* @param string $inner_html The original inner HTML for the sidebar item.
* @return string The modified inner HTML with an added icon.
*/
add_filter( 'ultc_admin_sidebar_try_automator_inner_html', 'my_custom_automator_sidebar_inner_html', 10, 1 );
function my_custom_automator_sidebar_inner_html( $inner_html ) {
// Check if the original inner_html is just text and we can safely prepend.
// In a real scenario, you might want more robust parsing or checking.
if ( strpos( $inner_html, '<span class="ultc-sidebar-featured-item__text">' ) === 0 ) {
// Prepend an icon (e.g., a dashicons gear) before the existing text.
$icon_html = '<span class="dashicons dashicons-admin-generic ultc-sidebar-featured-item__icon"></span>';
return $icon_html . $inner_html;
}
return $inner_html; // Return original if it's not in the expected format
}
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/includes/install-automator/install-automator.php:118
public function menu_uncanny_automator() {
if ( defined( 'AUTOMATOR_BASE_FILE' ) ) {
return;
}
if ( ! apply_filters( 'ultc_admin_sidebar_try_automator_add', true ) ) {
return;
}
/* translators: Trademarked term */
$menu_item_text = apply_filters( 'ultc_admin_sidebar_try_automator_text', __( 'Automation', 'uncanny-learndash-reporting' ) );
$menu_item_html = '<span class="ultc-sidebar-featured-item">' . apply_filters( 'ultc_admin_sidebar_try_automator_inner_html', '<span class="ultc-sidebar-featured-item__text">' . esc_html( $menu_item_text ) . '</span>' ) . '</span>';
add_submenu_page(
'uncanny-learnDash-reporting',
$menu_item_text,
$menu_item_html,
'manage_options',
'tincanny-install-automator',
array(
$this,
'admin_page_uncanny_automator',
),
6
);
}