Title: help with search.php
Last modified: August 19, 2016

---

# help with search.php

 *  Resolved [sagive](https://wordpress.org/support/users/sagive/)
 * (@sagive)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/help-with-searchphp/)
 * i got a weird problem..
 * i have integrated a theme with wordpress ([http://www.israelguide.org](http://www.israelguide.org))
 * anyhow, **the search works great from the home page**
    but doesn’t work from 
   inner pages…
 * this is command i used to call it
 *     ```
       <?php include(TEMPLATEPATH . '/searchform.php'); ?>
       ```
   

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [robrat](https://wordpress.org/support/users/robrat/)
 * (@robrat)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/help-with-searchphp/#post-1612737)
 * What’s the actual problem? I can’t read Israeli so can’t see what’s happening
   when you search for something from within the site. What actually happens when
   you search from deeper in the site?
 *  Thread Starter [sagive](https://wordpress.org/support/users/sagive/)
 * (@sagive)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/help-with-searchphp/#post-1612751)
 * **when i search from a single post its simply
    redirect me to the home page
   
   (
   which has no wordpress elements)
 * also after i enter a search term the url of the
    page stayes with the adress 
   of the original single post i searched from page plus the ending ?s=term
 * by the way.. this is the search.php script i got
 *     ```
       <ul class="list-category">
       <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
       <div class="categorypost">
       <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
       <div class="entry">
       <?php the_excerpt(); ?>
   
       <p class="postmetadata">
       <img src="<?php bloginfo('template_url'); ?>/images/mini-category.jpg" alt="מילות מפתח" style="vertical-align: text-bottom"> <?php the_category(', ') ?><?php edit_post_link('לערוך', ' | ', ''); ?><br>
   
       <img src="<?php bloginfo('template_url'); ?>/images/tags.jpg" alt="מילות מפתח" style="vertical-align: text-bottom"> <?php the_tags( '' . __('', '') . ' ', ', ', ''); ?><br>
   
       <?php if (pings_open()) : ?><span id="trackback-link"><img src="<?php bloginfo('template_url'); ?>/images/link-arrow.jpg" alt="טרקבק" style="vertical-align: text-bottom"> <a href="<?php trackback_url() ?>" rel="trackback"><?php the_title('', ''); ?></a></span><?php endif; ?>
       </p>
       </div>
       </div>
   
       <?php endwhile; ?>
       <?php endif; ?>
   
       </ul>
       ```
   
 * is it looking for some specific page to display results in?
    and why does it 
   work when i search from home page but not from othere pages…
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/help-with-searchphp/#post-1612760)
 * The problem lies in `searchform.php`, it’s the action set on the form.
 * All search requests should go through the index, ie. your site url, `example.
   com/` and not `example.com/some-post-name/`.
 * The form action should read..
 *     ```
       action="<?php bloginfo('siteurl'); ?>"
       ```
   
 * ..which i’d guess it currently does not..
 *  Thread Starter [sagive](https://wordpress.org/support/users/sagive/)
 * (@sagive)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/help-with-searchphp/#post-1612786)
 * wow your right.. **but**.. i changed it and it didnt help 🙁
 * **here is the searchform.php current code:**
 *     ```
       <form method="get" id="searchform" action="<?php bloginfo('siteurl'); ?>">
       <div>
       	<input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" /><br />
           <input type="submit" value="חיפוש" id="searchsubmit" />
       </div>
       </form>
       ```
   
 * **here is a link to an inner page:**
    [inner page](http://www.israelguide.org/business-in-israel/web-design/%D7%A9%D7%92%D7%99%D7%91-seo/)
 * here is a search term you can paste to the field: תרגומים
 * maybe the problem is that **i dont have any wordpress code embedded in the home
   page** but i dont want to integrate any..
 * if i would make a searchresults.php page – would it matter?
 *  Thread Starter [sagive](https://wordpress.org/support/users/sagive/)
 * (@sagive)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/help-with-searchphp/#post-1612789)
 * tried to edit but didnt find how..
    this is the right searchfrom code
 *     ```
       <form role="search" method="get" id="searchform" action="http://israelguide.org/">
       <div>
       	<input type="text" value="" name="s" id="s" /><br />
           <input type="submit" id="searchsubmit" value="Search" />
       </div>
       </form>
       ```
   
 * since my last message i have changed the home page to static page
    instead of
   a pure php i wrote my self.. so now its a system page.. its better right?
 * but.. that didnt help 🙁
    i am stuck… HELP (plz)
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/help-with-searchphp/#post-1612795)
 * Hi,
 * The code in your response further up was correct.
 *     ```
       <form method="get" id="searchform" action="<?php bloginfo('siteurl'); ?>">
       <div>
       	<input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" /><br />
           <input type="submit" value="חיפוש" id="searchsubmit" />
       </div>
       </form>
       ```
   
 * However, this is what i see on the page you linked above..
 *     ```
       <form action="" id="searchform">
       ```
   
 * Notice the action is missing, and the form attributes are positioned differently.
 * Do you have any other files with the search code in?
 *  Thread Starter [sagive](https://wordpress.org/support/users/sagive/)
 * (@sagive)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/help-with-searchphp/#post-1612801)
 * wow.. i see it now…
 * didn’t noticed this at all even tough
    i stared at the code for a good while..
   hehe
 * you totally saved me
    i entered <?php bloginfo(‘siteurl’); ?> in thier and it
   works!!
 * Thanks a bunch hope i could repay you someday 🙂
 * Cheers, Sagive
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/help-with-searchphp/#post-1612827)
 * You’re welcome.. 🙂

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘help with search.php’ is closed to new replies.

## Tags

 * [home](https://wordpress.org/support/topic-tag/home/)
 * [inner](https://wordpress.org/support/topic-tag/inner/)
 * [pages](https://wordpress.org/support/topic-tag/pages/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 3 participants
 * Last reply from: [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * Last activity: [15 years, 10 months ago](https://wordpress.org/support/topic/help-with-searchphp/#post-1612827)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
