Skip to content

Instantly share code, notes, and snippets.

@tomdevisser
Last active February 9, 2025 22:04
Show Gist options
  • Save tomdevisser/8e0e84f8838f796b9fbce9b38691ae50 to your computer and use it in GitHub Desktop.
Save tomdevisser/8e0e84f8838f796b9fbce9b38691ae50 to your computer and use it in GitHub Desktop.
<?php
// Priority 100 appends it after the default admin nodes.
add_action( 'wp_before_admin_bar_render', 'toms_admin_bar_menu', 100, 1 );
/**
* Adds custom nodes to the WP admin bar menu.
*
* @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance, passed by reference.
* @return void
*/
function toms_admin_bar_menu( WP_Admin_Bar $wp_admin_bar ): void {
$wp_admin_bar->add_node(
array(
'id' => 'get-support',
'title' => __( 'Get support', 'toms' ),
'href' => 'mailto:[email protected]',
'meta' => array(
'target' => '_blank'
)
)
);
$wp_admin_bar->add_node(
array(
'id' => 'get-priority-support',
'parent' => 'get-support',
'title' => __( 'High priority', 'toms' ),
'href' => 'tel:0000000000',
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment