Skip to content

Instantly share code, notes, and snippets.

@ingozoell
Created January 11, 2014 20:42
Show Gist options
  • Save ingozoell/8376445 to your computer and use it in GitHub Desktop.
Save ingozoell/8376445 to your computer and use it in GitHub Desktop.
function adjust_admin_bar()
{
global $wp_admin_bar;
if (!is_admin_bar_showing() or !is_admin())
{
return;
}
$form = '<form action="' . esc_url(admin_url('edit.php')) . '" method="get" id="adminbarsearch">';
$form.= '<input class="adminbar-input" name="s" tabindex="1" type="text" value="" maxlength="50" />';
$form.= '<input type="submit" class="adminbar-button" value="' . __('Search') . '"/>';
$form.= '</form>';
/* Suche einbinden */
$wp_admin_bar->add_menu(array(
'parent' => 'top-secondary',
'id' => 'search',
'title' => $form,
'meta' => array(
'class' => 'admin-bar-search'
)
));
}
add_action('wp_before_admin_bar_render', 'adjust_admin_bar');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment