Action
uncanny-automator
automator_admin_logs_list_table_extra_nav_after
Fires after the navigation menu is displayed on the Automator admin logs list table.
add_action( 'automator_admin_logs_list_table_extra_nav_after', $callback, 10, 1 );
Description
Fires after the primary navigation for the Automator logs list table. Developers can use this hook to add custom navigation elements, such as additional filter buttons or custom search fields, to the top or bottom of the logs table view.
Usage
add_action( 'automator_admin_logs_list_table_extra_nav_after', 'your_function_name', 10, 1 );
Examples
<?php
/**
* Add a custom button next to the default filters in the Uncanny Automator logs table.
*
* This function will be hooked into the 'automator_admin_logs_list_table_extra_nav_after' action.
* It demonstrates how to add custom HTML content after the default navigation elements
* in the Uncanny Automator admin logs list table.
*/
add_action(
'automator_admin_logs_list_table_extra_nav_after',
function ( $which ) {
// Ensure this hook only runs for the 'top' navigation part of the table.
if ( 'top' !== $which ) {
return;
}
// Add a simple button that, when clicked, would potentially trigger a custom action.
// In a real-world scenario, this button might open a modal, trigger an AJAX request,
// or link to another admin page.
?>
<span class="automator-custom-nav-item">
<button class="button button-secondary" onclick="alert('Custom action triggered!');">
<?php esc_html_e( 'Perform Custom Action', 'uncanny-automator' ); ?>
</button>
</span>
<?php
},
10, // Priority: 10 is the default, used here for clarity.
1 // Accepted Args: The hook passes $which, so we accept 1 argument.
);
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/core/admin/admin-logs/wp-list-table/class-logs-list-table.php:1027
src/core/admin/admin-logs/wp-list-table/class-logs-list-table.php:1034
protected function extra_tablenav( $which ) {
if ( 'top' === $which ) {
do_action( 'automator_admin_logs_list_table_extra_nav_before' );
// Use PRO filters if available.
if ( class_exists( 'uncanny_automator_proPro_Filters' ) ) {
echo Pro_Filters::activities_filters_html( $this->tab ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
do_action( 'automator_admin_logs_list_table_extra_nav_after' );
return;
}
// Otherwise, use placeholder.
include Utilities::automator_get_view( 'admin-logs/filters.php' );
do_action( 'automator_admin_logs_list_table_extra_nav_after' );
return;
}
}