• Hagelslag

    (@hagelslag)


    Hi all,

    In the hope that it would give me a working search function, I added the following to one of my PHP template files:

    <div class=”header-search”><?php get_search_form(); ?></div>

    While it does give me a search form (an input text field with an accompanying Search button), when I try it out (i.e. when I type in a search term that I actually occurs in several blog posts, and then press the Search button), I get re-directed to a BLANK page. Yes, a totally empty page, instead of the search results that I want.

    Does anyone have an idea what I’m doing wrong?

    And about the get_search_form function in particular, is this a function that should be defined somewhere within the theme itself (e.g. in the function.php file)? Or is this a standard, built-in WordPress function that is (supposed to be) always available and defined in the correct way, i.e. to display the search results, independently from the theme used? Is its code hidden from my view, or can I find and modify it somewhere in the Editor?

    (Incidentally, that’s something I *always* wonder about whenever I see references to such ‘standard’ functions… and it would be great if the online documentation could be a bit clearer in this regard: Where do such functions come from? Where are they – or should they be – defined?)

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get get_search_form() working?’ is closed to new replies.