help with search.php
-
i got a weird problem..
i have integrated a theme with wordpress (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'); ?>
-
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?
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=termby 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…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 notexample.com/some-post-name/
.The form action should read..
action="<?php bloginfo('siteurl'); ?>"
..which i’d guess it currently does not..
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 pagehere 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?
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)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?
wow.. i see it now…
didn’t noticed this at all even tough
i stared at the code for a good while..heheyou totally saved me
i entered <?php bloginfo(‘siteurl’); ?> in thier
and it works!!Thanks a bunch hope i could repay you someday 🙂
Cheers, Sagive
You’re welcome.. 🙂
- The topic ‘help with search.php’ is closed to new replies.