ThemeShaper Forums » Thematic


Adding searchbar to header

(9 posts)
  • Started 11 years ago by robcub
  • Latest reply from Jonny Janiero
  • This topic is not resolved


  1. Hello, I have been asked by a client to work on an existing site with Thematic here:

    Unfortunately I was created by someone else (badly, in my opinion) who use Thematic but didn't create a child theme (naughty).

    Anyway, I went to put a search bar in the header the old-fashioned way, with code. And when I tried searching for something, there was a host of problems (not least the word "Bread" in search.php for no apparent reason).

    OK it's late and I'm probably going mad but I'll get on to this tomorrow. In the meantime can anyone point me in the right direction for adding search in the header?

    Posted 11 years ago #
  2. that is particularly naughty! good luck getting everything straightened out.

    i just saw that snippet this morning here :

    /* Add search to header */
    function add_search(){
    include (TEMPLATEPATH . '/searchform.php');

    or you can add a search box to the menu this way:

    Posted 11 years ago #
  3. Thank you for your help, helgatheviking, I added the above code to the main theme's functions.php and it didn't do anything.

    What does seem to work is putting either:

    <?php include(TEMPLATEPATH . '/searchform.php'); ?>


    <form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
    <div id="search">
    	<input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" size="18" />
    	<input type="submit" id="searchsubmit" value="Search" />

    into the header-extensions.php in library > extentions.

    I know this is probably the wrong way of doing it but this file has already been modified in order to add the logo etc.

    I think my problem is more with the search results where I was getting

    "search not-singular search-no-results loggedin mac chrome"

    at the top of the results page!

    Posted 11 years ago #
  4. I've just realised that I get this message in the search results

    search not-singular search-no-results loggedin

    when only one search result is returned.

    It's OK when their are multiple results or when there are no results!

    Posted 11 years ago #
  5. I've worked out a fix but I'll be you a pound to a penny it'll come back to bite me on my backside.

    The message at the top of the screen comes from the body class which is in header.php:

    <body class="<?php thematic_body_class() ?>" >

    which I just changed to <body>

    which seemed to get rid of it.

    But now the question is: does the site use this body class anywhere else?

    Posted 11 years ago #
  6. well no my code probably only works in your child theme. It is not advisable to edit core thematic files directly.

    Posted 11 years ago #
  7. Yes, I thought so. Thank you for your help. But, when I got this site the theme was already done and the site was already 50 pages with lots of little custom fields, templates and tweaks all on the core thematic files so I think I have to carry on like this...

    Posted 11 years ago #
  8. I will try to adopt this code in my website so as to get the desired results...thanks for sharing the information..

    Posted 11 years ago #
  9. you could always add a widget area to the header and just drop in the search widget

    Posted 11 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.