• Resolved taragon

    (@taragon)


    Hello,

    I hope it would be ok to ask this question right away, before properly introducing myself as a first-time poster ??

    I’m currently trying to implement a search form within my twentyten navbar.

    This is what I’m hoping to accomplish:

    <div class="menu-header" id="menu-menu-1">
    	<ul class="menu">
    		<li class="menu-item menu-item-type-  menu-item-object- current-menu-item" id="menu-item-4"><a>About</a></li>
    		<li>...</li>
    		<form id="searchform" name="searchform" method="get" action="<?php echo home_url(); ?>">
    		<div id="search">
    			<input type="text" id="s" name="s" />
    			<input type="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'twentyten' ); ?>" />
    		</div>
    		</form><!-- #end the bit I'm trying to add -->
    	</ul>
    </div>

    Currently I have:

    <div id="access">
    				<div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?></a></div>
    				<?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu-header' ) ) ; ?>
    			</div><!-- #access -->

    and

    <form id="searchform" name="searchform" method="get" action="<?php echo home_url(); ?>">
    		<div>
    			<label for="s"><?php _e( 'Search', 'twentyten' ); ?></label>
    			<input type="text" id="s" name="s" />
    			<input type="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'twentyten' ); ?>" />
    		</div>
        </form>

    not really sure what to do next.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You’ll need to customize the following and make sure that the functions are correct (I’m just writing this from memory so my exact syntax may be off):

    <ul class="menu-header">
        <?php wp_list_pages(); ?>
        <li class="search"><?php get_search_form(); ?></li>
    </ul>

    wp_list_pages() can be customized to pull in info as you need.

    Thread Starter taragon

    (@taragon)

    Thanks Anne, that fixed the issue. Didn’t knew wp worked this way. Much appreciating your help!

    You’re welcome! Happy WPing ??

    Sorry if I’m changing the op but I’m looking to add the rss button and twitter button to the menu is the code similar or should I approach it differently?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding the searchform to the navbar’ is closed to new replies.