WordPress.org

Ready to get started?Download WordPress

Forums

I broke my Search widget (somehow) (1 post)

  1. Grapho
    Member
    Posted 5 years ago #

    I have been using WordPress for little over a year now, and I thought I had a pretty good grip on it. One template I have been working on has a broken search widget, that I cannot, for the life of me, figure out what happened.

    The widget itself works ok, when I activate it and use it within the default "sidebar.php" file that came packed with WP.

    Now the problem arises when I attempt to place a search form in a custom-made template. This is the code for the search form:

    <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
    <div>
      <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
      <input type="button" id="searchsubmit" value="Search" />
    </div>
    </form>

    It is saved as "searchform.php"
    The code I use to call it into a template is:
    <?php include (TEMPLATEPATH . "/searchform.php"); ?>

    (You may notice that this method is almost identical to the "default template" bundled with WP.)
    This worked for me wonderfully, until one day it didn't.

    So now I'm wondering if the code I used in my template was wrong and maybe it was just a fluke that it was working in the first place?

    I'd appreciate any advice, thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic