Created
January 11, 2014 20:42
-
-
Save ingozoell/8376445 to your computer and use it in GitHub Desktop.
Suchfeld in Admin-Bar
From http://fastwp.de/snippets/suchfeld-in-admin-bar/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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