How to Add Search Box in Thesis Theme Navigation Bar

by Pascal on December 28, 2009

Thesis users or upcoming thesis users, in this Video tutorial I am going to show, How to add search box in Thesis navigation bar. Mostly bloggers put search box in sidebar. Why? Because it is by default available as a widget in wordpress. So they are just putting in sidebar only. But in thesis have option to put your search box anywhere in your site. So lot of people like  to put search box in navigation bar. So I write about, How to add search box in Thesis navigation bar.

Ok. Come to my point. For doing this process, first you have to add two types of codes in your wordpress admin. That means you have to put codes in Thesis Custom_function.php and Cutom.css.

Watch Below video tutorial to add  search box in thesis navigation bar.

If you got any trouble to watch video follow below steps.

  • First you have to go your wordpress admin.
  • In wordpress admin, go to thesis option.
  • After that, go to thesis option. In thesis option click Custom File Editor, then paste below code in Custom.css. Now you can save your custom.css and go to your site. Then you can see search box in thesis navigation bar as per below screen short.
/* search box in navigation*/

.custom .search{

width:21em;

margin-left:77em;

margin-top:-3.5em;

border:2px solid #ddd;

background-color: #2F65C2;

}

.custom .nav_container {
width: 78%; }
.custom div.nav_container #s {

font-size:1.3em;

padding:0.308em;

width:15.385em;

}
  • In thesis option, go to custom file editor-> click Custom_funtion.php and paste below code or use FTP and put below code in custom_function.php(Why I prefer FTP. At the time of accessing Custom_funtion.php via your wordpress admin, it is showing some warning message. That’s why I prefer FTP)
//paste in custom_function.php

//search box in navigation

//remove thesis navigation

remove_action('thesis_hook_before_header', 'thesis_nav_menu');

//custom Nav

function custom_nav() {

echo '<div id="nav">';

echo '<div class="nav_container">';

thesis_nav_menu(); //this is default navigation

echo '<div class="search">';

thesis_search_form(); // add thesis search box

echo '</div>';

echo '</div>';

echo '</div>';

}

//place my custom nav above the header

add_action('thesis_hook_before_header', 'custom_nav');

Before Adding Search Box

Before adding search box

After Adding Search Box

After adding search box

If you got any problem about above process, write in comment box. I will help you. If it is useful for you, share your experience in comment box.

Related Tutorials:

  1. How to add Background Image in Thesis Theme Navigation Menu
  2. How to Add Google Custom Search Box in Navigation Menu
  3. How to Change the Header Image Above nav Menu in Thesis Theme?
  4. How to add additional navigation menu in thesis theme?
  5. Seven tips for changing color in Thesis Theme

{ 49 comments… read them below or add one }

Jaydip Parikh December 29, 2009 at 9:28 AM

If I want to add Google Search blog not this Search box. How to do that ? I also want to know how we can add FeedBurner feed count in Nav Menu ?

Reply

Pascal December 29, 2009 at 3:56 PM

Hi Jaydip,

I think , you want to add google custom search box in navigation. ok. i will come with a post about that shortly. And for feedburner count button also.

Reply

Pascal December 30, 2009 at 1:20 AM

Update:

Hi Jaydip,

Here i have posted tutorial for adding google cse in thesis nav bar. http://fourblogger.com/how-to-add-google-custom-search-in-navigation-menu/

and another one for adding feedburner feed reader count button in thesis nav bar http://fourblogger.com/how-to-add-feedburner-feed-reader-count-button-in-thesis-nav-bar/

Check the two tutorials and leave a comment if you need any help in doing this.

Reply

Jaydip Parikh December 30, 2009 at 10:44 AM

Hey Pascal,

You Rocks man !!

Thanks for wonderful article. I am still having one request for you. Can we change order of Trackback and Comments.

I mean to say in default thesis you will first find Trackbacks and then Comments. but I would like to have First Comments and then Trackback.

How can I do that. Bye the way your blog is very cool and really impressive. Concept for Video help is really unique.

Thanks for all man.

Reply

Pascal December 30, 2009 at 11:08 AM

Hi Jaydip, Thanks for the kind words.

Thanks for another request also. I am ready to solve any issue with thesis and wordpress.

But i am not sure how long it is going to take figure out this. Soon i will come with the answer.

Reply

Pascal December 30, 2009 at 11:47 PM

Hey Jaydip, Here is the answer for your question. It was very simple.
http://fourblogger.com/how-to-display-track-backs-after-comments-in-wordpress-thesis-theme/

Keep on reading. subscribe to our youtube video channel.

Reply

Tanmoy January 29, 2010 at 10:11 AM

This tips help me to earn 5 USD :)

Reply

Pascal January 30, 2010 at 12:48 AM

Hi Tanmoy, Glad our tips help you to earn also. :)

Reply

Tony February 2, 2010 at 4:22 AM

Hi Pascal — was unable to use the code for a Google CSE (left comment on that post), so am trying this one. I use a minimalist design, and need just the search box without any border styles. When I remove the border styles from your code, the nav bottom border does not continue under the Search box. Can you suggest how to fix this?

Tony

Reply

Pascal February 2, 2010 at 11:52 AM

hi tony for your query, you can remove nav_container width and set search box margin-left 77em in custom.css. after finishing this process you can get navigation menu border as per your wish. if u got any problem contact us via g-talk. our g-talk id is admin@fourblogger.com

Reply

Tony February 2, 2010 at 7:14 PM

Worked great!

thanks
Tony

Reply

Pascal February 4, 2010 at 4:23 PM

Glad it worked.

Reply

Jacky Liang February 4, 2010 at 7:47 AM

I set the according instructions, but I can’t click on the Search Box…

Reply

Pascal February 4, 2010 at 4:22 PM

You may missed any part of the javascript.

Reply

Tia June 22, 2010 at 8:21 PM

I, too, followed the instructions precisely and the search box is not clickable. Only difference is where I placed the navigation (below instead of above header). Thoughts?

// Remove Thesis Navigation
remove_action(‘thesis_hook_before_header’, ‘thesis_nav_menu’);

// Custom Nav
function custom_nav() {
echo ”;
echo ”;
thesis_nav_menu(); //this is default navigation
echo ”;
thesis_search_form(); // add thesis search box
echo ”;
echo ”;
echo ”;
}

// Place my custom nav below the header
add_action(‘thesis_hook_after_header’, ‘custom_nav’);

Reply

Tia June 22, 2010 at 8:21 PM

Sorry… code below.

// Remove Thesis Navigation
remove_action('thesis_hook_before_header', 'thesis_nav_menu');

// Custom Nav
function custom_nav() {
echo '';
echo '';
thesis_nav_menu(); //this is default navigation
echo '';
thesis_search_form(); // add thesis search box
echo '';
echo '';
echo '';
}

// Place my custom nav below the header
add_action('thesis_hook_after_header', 'custom_nav');

Reply

Tia June 22, 2010 at 8:22 PM

I don’t know why the /div isn’t showing up but trust me it is in there.

http://testsite.bizchickblogs.com/gl/

I am trying in the meantime to find solutions.

Reply

Tia June 22, 2010 at 8:27 PM

Found it!! The key is to reduce the width of the nav bar so the search form doesn’t lose focus. Phew.

http://diythemes.com/forums/basic-support/12974-search-bar-navigation.html#post65796

Reply

Pascal June 22, 2010 at 9:05 PM

Hi TIa, I am glad you found the solution in minutes.

Reply

brat45 February 4, 2010 at 10:06 PM

Hi Pascal

I’am pretty sure that i did all your instruction but my search box is unclickable. Any know how it happen and how to solve this problem?

Thanks in advance.

Here’s my site if you want to see it http://kickurl.com/50718/

Reply

Pascal February 4, 2010 at 11:19 PM

Hi brat,

Once again copy and paste the code. You will now get click-able search box.

Reply

Greg Friese February 7, 2010 at 9:03 AM

I was able to follow your tutorial to add the search box to the nav bar. I needed to do some adjusting of the top margin to make the search box align with the other tabs. But once I figured that out I am very pleased. Thanks!

Reply

Pascal February 7, 2010 at 9:37 AM

.custom .search { margin-top:-2.7em; } in this code change -2.7 into -3em

Reply

David Centeno, Esq. February 17, 2010 at 12:41 PM

I am also having the same problem as brat… My search box is not clickable, meaning you cannot enter a search text query???

Any idea why?

Reply

Pascal February 17, 2010 at 12:54 PM

I saw your site, there is no search box. If it is available, we can check otherwise we can’t check.

Reply

Jacky Liang February 24, 2010 at 7:26 AM

The Search Box is being covered by the Navigation Bar. The only way is to put the code which I cannot find, because BlueHost sucks and corrupted my CSS files, but it’s 78% for the navigation bar as i remember… and uhms, also the search might require a border unless pascal finds a fix for this… :) still thanks for the help you did for my website. you help me learn more into css code, without you my site would have been trashed.

Reply

Suresh February 24, 2010 at 9:58 PM

hai jacky,

I saw your site which is not in live.. when its come to live i will check it..

Reply

David Centeno, Esq. February 17, 2010 at 1:02 PM

you can visit yourwinningwebsite.com, another site of mine to check it out. thanks for the quick reply, like lightening!

Reply

Suresh February 17, 2010 at 2:38 PM

hai david,
Reduce your menu width. add this below line in custom.css file
.custom .menu {width: 77.5%} then your search box will working fine..
if you need border-bottom full width use border-bottom in .nav_container css code..

Reply

David Centeno, Esq. February 19, 2010 at 1:40 AM

Thank you, would you be able to tell me what the code would look like, i am a beginner. thank you so much!

Reply

Suresh February 19, 2010 at 11:02 AM

hai david,

I saw your site. In your custom.css there is no code available for search box style thats why your search box appear too small. you should add css code for search box. and also in your custom.css menu code you have .custom .menu   {}

this code remove    in menu code..then it is working fine..

Reply

Jacky Liang March 3, 2010 at 4:19 AM

Pascal. Is there a way that I can change the Thesis Search Box Text. For Example, “To Search, type and hit enter” to something else? Make a Tutorial on that. :)

Reply

Pascal March 4, 2010 at 3:32 PM

i will put post soon.

Reply

anonymous March 26, 2010 at 8:07 AM

did this ever happen? i’d like to learn how to change the text, the text color, background, etc.

i learned a lot already from this tutorial, so thanks

Reply

Suresh March 26, 2010 at 3:52 PM

hai,

This tutorial may help you to get an idea to add background color , text font change and etc..

Reply

Brian March 18, 2010 at 5:51 AM

This is exactly what I’m looking for. Although I have the navigation placed below the header, which has been put through some other changes as well (I don’t know php at all – code is copied).

Is there a way to tweak my existing solution with your code – as it is now it won’t work. Some kind of conflict I guess.

The blog hasn’t been launched yet but can be found on a temporary URL:
http://brian.se.linweb58.kontrollpanelen.se/

The following is being used in the custom_functions.php:
//Header and nav
function full_width_nav() { ?>

<?php }
remove_action('thesis_hook_before_header', 'thesis_nav_menu');
add_action('thesis_hook_before_content_area', 'full_width_nav');

And the following is being used in the custom.css:
/* Body */
body.custom {
background:#151D25 url(images/bob_bg.png) 50% 0% fixed no-repeat;
}

/* Header */
.custom #header_area .page {
background:transparent;
padding-top: 0;
}

/*.custom #header {
padding-bottom: 0;
padding-top: 0;
border-top: 0px;
}*/
.custom #header {
border-bottom: 0px;
margin: 0;
padding: 0;
background: url(images/bob_header.png) no-repeat left top;
}
.custom #header #logo {
text-indent: -9999px;
}
.custom #header #logo a {
display: block;
width: 959px; /*change this to the width of your image*/
height: 120px; /*change this to the height of your image*/
}

Reply

Suresh March 18, 2010 at 9:49 AM

hai,

what conflict you are facing.. tell me clearly what you need?…

Reply

Brian March 18, 2010 at 1:46 PM

I update custom_functions.php and custom.css exactly as described above. But nothing happens. It stays put. So my guess is that it doesn’t work due to the code snippets above being in conflict in one way or the other. Maybe it is the locaction of the nav menu? Since the code snippet above directs it to be placed below the nav menu, in full width.

Reply

Suresh March 20, 2010 at 9:51 AM

hai brian,

The custom function code mentioned in the post is for page frame work.. you are using full width frame work..if you need your custom navigation below the header_area, In custom_functions.php code change the hook thesis_hook_after_header into thesis_hook_before_content_area.. it will give the custom nav menu below header similar to page framework..

Reply

David May 4, 2010 at 3:10 AM

I would also like to know how to change the Thesis Search Box Text, “To Search, type and hit enter” to something else?

Reply

Suresh May 4, 2010 at 2:23 PM

hai david,

hacking the core and changing and changing the search box value is easy but while upgrading it may cause some problems.
I am also ting the way to change the search box value without hacking the core…. I think Google custom search is better than thesis search.. That gives more relevant results for search query than thesis search box…

Reply

David May 4, 2010 at 6:07 PM

Hey Suresh,

What do you mean hacking the core? I tried to find the search form template in thesis theme but there is no file? I could only find searchform.php in the default theme folder. Is this the file we need to change? I don’t really want to change to Google custom search just to edit the search box text.

Reply

Suresh May 5, 2010 at 9:55 AM

hai David,

This file is not thesis search form it is a default wordpress theme search form.. if you need search from you should find in side the thesis theme folder..

Reply

David June 4, 2010 at 5:50 AM

You can do this by using a thesis filter.

// Change Default Search Text

function custom_search_text($field_value) {
$field_value = ‘Search Me’;
return $field_value;
}
add_filter(‘thesis_search_form_value’, ‘custom_search_text’);

Reply

tangologix June 9, 2010 at 11:54 PM

nice written . well informative article. i saw it operation on this blog too . nice written info man. thanks for posting.

Reply

kellyhicks June 22, 2010 at 10:46 PM

Hi Pascal,

Thanks for this article, I was able to get it working only I have a custom top nav so how to I change the code to not display the thesis nav again? You can see what I mean here: http://kellyhicksdesign.com

I want the search box to be left aligned in the blue box and would like to remove the thesis nav.

Reply

Suresh June 23, 2010 at 10:54 PM

hai kellyhicks,

I checked your site.. I think you have finished the nav bar alignment..
If not just mention what you need..

Reply

Andrea H July 16, 2010 at 9:00 AM

I tried this and now my blog is just a plain white page. I took the code back out and it didn’t fix it. =(

Thank you for the tutorial anyway.

Reply

Pascal July 20, 2010 at 10:59 PM

have you fixed the issue? If not, contact me via contact form. THanks

Reply

{ 1 trackback }

You are now listed on FAQPAL
December 28, 2009 at 6:02 AM

Leave a Comment

Page 1 of 0