Search bar in adminbar

BP Profile Search Search bar in adminbar

  • Author
    Post
  • #7627 Reply
    Yeon
    Guest

    Hey 🙂

    Is it somehow possible to have the search bar implemented in the admin bar?

    I tried to implement:
    <?php do_action (‘bps_display_form’, ID); ?>
    or:
    [bps_display form=ID]
    but the only way I could add something to the adminbar was with this method:

    
    add_action('admin_bar_menu', 'nebula_admin_bar_menus', 800);
    function nebula_admin_bar_menus($wp_admin_bar){
        $wp_admin_bar->add_node(array(
            'id' => 'nebula-github',
            'title' => 'Nebula Github',
            'href' => 'https://github.com/chrisblakley/Nebula',
            'meta' => array('target' => '_blank')
        ));
    
        $wp_admin_bar->add_node(array(
            'parent' => 'nebula-github',
            'id' => 'nebula-github-issues',
            'title' => 'Issues',
            'href' => 'https://github.com/chrisblakley/Nebula/issues',
            'meta' => array('onclick' => 'exampleFunction(); return false;') //JavaScript function trigger just as an example.
        ));
    }  
    

    As I see there is only href or onclick…

    Thank you soo much

    #7628 Reply
    andrea
    Plugin Author

    Hello Yeon,

    Yes, you can only add links to your toolbar. I suggest you create a new page, and add it to the toolbar, following the instructions here:

    https://codex.wordpress.org/Function_Reference/add_node#Add_a_Page_to_the_Toolbar

    Then, in the new page you created, insert the shortcode of your search form (take the shortcode from the Users => Profile Search settings page, after you create your form).

Reply to: Search bar in adminbar
My Information