Overview

Use this tool to create custom code for Toolbar (previously known as Admin Bar) with WP_Admin_Bar class.

Usage

  • Fill in the user-friendly form.
  • Click the “Update Code” button.
  • Copy the code to your project.
  • Or save it as a snippet and share with the community.

Examples

If you are still learning how to use this tool, check out the following examples:

The function used in the code.
Translation file Text Domain. Optional.
The ID of the menu. The ID of the parent menu.
Text/HTML shown in the Toolbar. The 'href' attribute for the link. If none set the menu will be a text menu.
Group menu items together into distinct sections using add_group().
The HTML used for the menu. The class attribute for the list item containing the link or text.
The target attribute for the link. Will be set if 'href' is present. The onclick attribute for the link. Will be set if 'href' is present.
The title attribute. Will be set to the link or a div containing a text node. The tabindex attribute. Will be set to the link or a div containing a text node.
The ID of the menu. The ID of the parent menu.
Text/HTML shown in the Toolbar. The 'href' attribute for the link. If none set the menu will be a text menu.
Group menu items together into distinct sections using add_group().
The HTML used for the menu. The class attribute for the list item containing the link or text.
The target attribute for the link. Will be set if 'href' is present. The onclick attribute for the link. Will be set if 'href' is present.
The title attribute. Will be set to the link or a div containing a text node. The tabindex attribute. Will be set to the link or a div containing a text node.
The ID of the menu. The ID of the parent menu.
Text/HTML shown in the Toolbar. The 'href' attribute for the link. If none set the menu will be a text menu.
Group menu items together into distinct sections using add_group().
The HTML used for the menu. The class attribute for the list item containing the link or text.
The target attribute for the link. Will be set if 'href' is present. The onclick attribute for the link. Will be set if 'href' is present.
The title attribute. Will be set to the link or a div containing a text node. The tabindex attribute. Will be set to the link or a div containing a text node.

  Save Snippet
// Add Toolbar Menus
function custom_toolbar() {
	global $wp_admin_bar;

}

// Hook into the 'wp_before_admin_bar_render' action
add_action( 'wp_before_admin_bar_render', 'custom_toolbar', 999 );