ThemeShaper Forums » Thematic


Putting a search box in the menu

(5 posts)
  • Started 10 years ago by neonbible
  • Latest reply from neonbible
  • This topic is resolved


  1. neonbible

    Using WP 3.0 custom menu with Thematic Can it be done?

    I can add an 'item' to the menu using:

    function child_add_menu_items($output) {
        $my_replecement = '<li>Hello World!!</li></ul></div>';
        return str_replace($my_search, $my_replecement, $output);

    however not sure how to put a search box in there.


    Posted 10 years ago #
  2. I had this code lying around, haven't tested or checked in a while but perhaps it still works if you replace wp_page_menu for wp_nav_menu:

    //  Add a dynamic menu using wp_list_pages
    function childtheme_menu() { ?>
         <div class="menu">
              <ul class="sf-menu">
                    <?php wp_list_pages('title_li='); ?>
                        <div id="access-search">
                    <form id="searchform" method="get" action="<?php bloginfo('home') ?>">
                            <input id="s" name="s" type="text" value="Search" onfocus="if (this.value == 'Search InMobi') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search InMobi';}" size="20" tabindex="1" />
                            <input id="searchsubmit" name="searchsubmit" type="submit" value="<?php _e('Go', 'thematic') ?>" tabindex="2" />
    <?php }
    Posted 10 years ago #
  3. neonbible

    I tried this before. It added the search box but then the rest of the menu disappeared.

    EDIT: Sorry, this works perfectly!! Awesome thank you!

    EDIT2: Ok its not working perfectly. Its added the Search box, in the correct position. But the menu has gone back to the default despite specifying wp_nav_menu

    Posted 10 years ago #
  4. neonbible

    I am thinking I could shrink the width of the menu and add in another div next to it to hold the search box.

    Whats the best way to do this? I guess add something into functions.php but I don't know what I would hook it into.

    Posted 10 years ago #
  5. neonbible

    Had to shorten the menu width and add another div in the end.

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.