ThemeShaper Forums » Thematic

Adding search function to navigation bar

(13 posts)
  • Started 13 years ago by chiakaivalya
  • Latest reply from manlikemalcolm
  • This topic is resolved
  1. Hi guys!

    I'm making a few of my own child themes for various projects, all using thematic. I'm new to this so i hope someone can help me with my current dilemma!

    My question is: How may I add a search form in the navigation bar (#access) (e.g. on the right hand side)?
    I currently have categories, instead of pages, in my navigation menu bar (using catdrop's functions.php code). The bar is in a solid color and goes right across the screen left-to-right.

    i've no idea what code i can use for the search form, and where exactly it ought to go.

    My guess would be in the header.php in the access div. Will this work, even with the changes i made in converting pages->categories?

    <div id="access">
    <div class="skip-link">"><?php _e('Skip to content', 'thematic'); ?></div>
    <?php wp_page_menu('sort_column=menu_order') ?>

    </div><!-- #access -->

    Any tips would be greatly appreciated!!!

    Thanks :)

    Posted 13 years ago #
  2. Hi again guys,

    So i figured that by adding code after <?php wp_page_menu('sort_column=menu_order') ?> and then positioning it with css, i can place things on the right side of my menu. :)

    alternatively, if i want images to be larger than the access bar (height:34px), such that the image pops out of the access bar, i have to add it to my header code. (outside div #access).

    i still have some problems with adding a search form there but i've decided to use one in the sidebar instead. however i am unable to change the code in the sidebar.php such that the search form displays "Search this site..." within the box. Neither can i change the Search <h2> in the sidebar to show something else! Any tips on these matters would be wonderful :)


    Posted 13 years ago #
  3. yeah, you can. add the search widget and then adjust the css. if you need some help, you only have to ask.

    Posted 13 years ago #
  4. Would you please post a sample css setting for moving the search widget to the nav bar, i'm still new to this moving with css, i'd like to try it too in moving feedburner text widget to nav bar.

    Thanks before

    Posted 13 years ago #
  5. nevermind, i found it :)
    i add this code on functions.php to add home, rss button and email updates and search on navbar...
    but nevermind again, i couldn't post it here because the code look weird here

    Posted 13 years ago #
  6. axis

    If someone could post, I'd like to get the search form in the navbar (right side). I've done it, but I had to use a negative top margin and I have to think there's a better way.

    Posted 13 years ago #
  7. You could filter the menu and then add get_search_form() in there.

    Posted 13 years ago #
  8. If someone does indeed filter their menu to add a search form, could you please post an example of the code you added to your functions.php file? Thanks.

    Posted 13 years ago #
  9. aoda

    I'd also like more specifics on how to do this, if possible. Thanks in advance.

    Posted 13 years ago #
  10. So i did something like the following:

    function add_search_form() {
    echo ('
    <form id="searchform" method="get" action="">
    <input id="s" name="s" type="text" value="To search, type and hit enter" size="32" tabindex="1" />
    <input id="searchsubmit" name="searchsubmit" type="submit" value="Search" tabindex="2" />

    seems to work except it removes everything else from 'wp_page_menu' and it also chokes on the single quotes in the default on_blur javaScript.

    is there a better way to do this instead of using echo...seem kind of brutal?

    Thanks, Malcolm

    Posted 13 years ago #
  11. function add_search_form() {

    Ok so I have broken it down to this. I am guessing that wp_page_menu is the wrong hook since this makes all of the pages/nav disappear. Unclear on which hook will place the search bar inside of the div#access.

    Any help would be mucho appreciado!

    Posted 13 years ago #
  12. function add_search_form() {

    this works quite well (not sure why though)
    now I just need a way to get all of that inside of
    and where did all of the on_blur etc JavaScript run off to.

    Should I create a new thread for this since this is "resolved" already?

    Posted 13 years ago #
  13. Cut & paste extravaganza here...

    Posted 13 years ago #

RSS feed for this topic


You must log in to post.