Title: Problem with Search function
Last modified: August 19, 2016

---

# Problem with Search function

 *  [fanderzzon](https://wordpress.org/support/users/fanderzzon/)
 * (@fanderzzon)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/problem-with-search-function/)
 * Hi freinds,
 * I have created my own site in WordPress [http://www.fiddeandersson.se/](http://www.fiddeandersson.se/)
   
   I have done the code and design by myself but I have a problem now. I want to
   create a search function but don’t have any experience about it.
 * This is what i done so far:
 * 1) In sidebar.php i have add this code:
 *     ```
       <div id="search">
       <?php include (TEMPLATEPATH . '/searchform.php'); ?>
       </div>
       ```
   
 * 2) In searhform.php i have add this code:
 *     ```
       <form role="search" method="get" id="searchform" action="<?php bloginfo('url'); ?>">
           <label class="search" for="s"></label>
           <input type="text" value="" name="s" id="s" />
           <input type="submit" id="searchsubmit" value="Search" />
       </form>
       ```
   
 * 3) In search.php i have add this code:
 *     ```
       <?php get_header(); ?>
   
       <div id="content">
   
       <?php if (have_posts()) : ?>
   
       <h2>Sökresultat</h2>
   
        <?php while (have_posts()) : the_post(); ?>
   
        <h2><a href="<?php the_permalink(); ?>" title="Permanent link to <?php the_title_attribute(); ?>">
       		<?php the_title(); ?></a></h2>
   
        <p>Postat av: <?php the_author() ?> <?php the_time('Y-m-d')?> <?php the_time('H:i') ?> </p>
   
         <?php the_content() ?>
   
         <p><?php edit_post_link('Redigera','','<span class="tecken"> | </span>'); ?>  <?php comments_popup_link('0 kommentarer', '1 kommentar', '% kommentarer'); ?> <span class="tecken">|</span> <span class="pub">Kategoriserat under <?php the_category(', ') ?></p>
   
       <?php endwhile; ?>
        <?php else : ?>
   
                <h2>Sidan du sökte kunde inte hittas.</h2>
       <p>Tyvärr hittades den ej</p>
   
           <?php endif; ?>
   
       </div>
       <?php get_footer(); ?>
       ```
   
 * So my question is have do i create a search function from scratch? I have follow
   the WordPress guide about creating a search page but doesn’t solve my problem.
 * Do someone have a tutorial have to code a search.php with just some basics functions?
 * Best regards
    Fidde

The topic ‘Problem with Search function’ is closed to new replies.

## Tags

 * [problem](https://wordpress.org/support/topic-tag/problem/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [fanderzzon](https://wordpress.org/support/users/fanderzzon/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/problem-with-search-function/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
