Advertisement
valuser

Making Global Unified search for BuddyPress to work with Wor

Sep 24th, 2012
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1.  
  2. Original at http://buddydev.com/
  3.  
  4.  
  5.  
  6. function remove_wp_adminbar_search_menu(){
  7.  
  8. //remove the search from from adminbar menu
  9. remove_action('admin_bar_menu', 'wp_admin_bar_search_menu', 4 );
  10. }
  11. add_action('init','remove_wp_adminbar_search_menu');
  12.  
  13.  
  14.  
  15. function custom_admin_bar_search_menu( $wp_admin_bar ) {
  16.  if ( is_admin() )
  17.  return;
  18. //we have just changed the form url
  19.  
  20.  $form = '<form action="' . esc_url( bp_search_form_action() ) . '" method="get" id="adminbarsearch">';
  21.  $form .= '<input class="adminbar-input" name="s" id="adminbar-search" tabindex="10" type="text" value="" maxlength="150" />';
  22.  $form .= '<input type="submit" class="adminbar-button" value="' . __('Search') . '"/>';
  23.  $form .= '</form>';
  24.  
  25. $wp_admin_bar->add_menu( array(
  26.  'parent' => 'top-secondary',
  27.  'id' => 'search',
  28.  'title' => $form,
  29.  'meta' => array(
  30.  'class' => 'admin-bar-search',
  31.  'tabindex' => -1,
  32.  )
  33.  ) );
  34. }
  35. add_action( 'admin_bar_menu', 'custom_admin_bar_search_menu', 4 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement