ThemeShaper Forums » Thematic

[closed]

Adding searchbar to header

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

Tags:

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

    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 4 years ago #
  2. that is particularly naughty! good luck getting everything straightened out.

    i just saw that snippet this morning here :

    http://wptheming.com/2009/10/useful-thematic-filters/

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

    or you can add a search box to the menu this way:
    http://www.cozmoslabs.com/2009/04/15/add-a-search-box-to-the-thematic-menu/

    Posted 4 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'); ?>

    or

    <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" />
    </div>
    </form>

    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 4 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 4 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 4 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 4 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 4 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 4 years ago #
  9. you could always add a widget area to the header and just drop in the search widget
    see...
    http://forums.themeshaper.com/topic/widgets-in-the-header

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.