Adding search bar to header
-
Hi there! I’m having trouble adding a search bar to my header/menu area. I’ve looked through a lot of past forum threads, so I’ve been able to get the search bar in the header, but it isn’t aligned with the rest of the menu. I’d even be okay with switching out the regular search box with the simple magnifying glass icon. Suggestions?
Site: ashleighreads.com
Theme: VortexThank you in advance!
-
Here is the current Search Form Widget CSS on the style sheet:
.searchform { width: 100 px; background: #fff; border: solid 1px #e7e7e7; padding: 0; float: right; margin: 0 ; overflow: auto; } .searchform .assistive-text { display: none; } .searchform input[type="text"] { width: 172px; float: left; padding: 6px 0 6px 11px; margin: 0; vertical-align: middle; border: 0; } .searchform input[type="submit"] { width: 33px; height: 33px; background: url(images/zoom.jpg) no-repeat; border: 0; cursor: pointer; text-indent: -9999px; vertical-align: middle; margin: 0; padding: 0; text-transform: capitalize; font-size: 0; display: block; line-height: 0; }And here is the Searchform.php:
<div class="search"> <form method="get" class="searchform" action="<?php echo trailingslashit( home_url() ); ?>"> <label for="s" class="assistive-text"><?php _e( 'Search for:', 'vortex' ); ?></label> <input type="text" class="field" name="s" id="s" value="<?php if ( is_search() ) echo esc_attr( get_search_query() ); else esc_attr_e( 'Search', 'vortex' ); ?>" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" /> <input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'vortex' ); ?>" /> </form> </div><!-- end .search -->Also, is it possible that I need to change something in the Main Index Template? I’m sure this is an easy fix, but I’m not sure where to look, haha.
The problem isn’t really in your search form but the grid system the theme is using. See if these rules help.
#nav .container_16::before, #nav .container_16::after { content: none !important; } #nav .search { float: right; top: -45px; position: relative; }You will want to test them they may not work. didn’t have time to dig very much.
I think they will break the theme and keep it from being responsive. You will probably need to place them in a media query.
Okay, I added the code—it got the search bar up into the menu, but it’s crammed in the menu bar and made the grey menu background cut off…
The topic ‘Adding search bar to header’ is closed to new replies.