Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Wordpress Search function not Working...

Posted on 2008-06-11
17
Medium Priority
?
603 Views
Last Modified: 2013-12-13
Check out the site: http://snipurl.com/2fq1u-fg44

The sidebar has a search function but it's not working.

I have a custom front page (home.php) that the htaccess is pointing as the main front page.

However, the search function requires the /index.php before it to work (otherwise the search doesn't work... try a random search to see what I mean).

How can I fix this? I.e. allow the search function to append the /index.php into the form action?

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

Open in new window

0
Comment
Question by:zzargo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 8
17 Comments
 
LVL 15

Expert Comment

by:dosth
ID: 21766546
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/index.php">
<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>
0
 

Author Comment

by:zzargo
ID: 21769179
I tried that, but that doesn't seem to work... check out the site again. ANy other ideas?
0
 
LVL 15

Expert Comment

by:dosth
ID: 21769467
can you hardcode this for checking

<form method="get" id="searchform" action="http://www.acqyr.com/Positive_Affirmations/index.php">
<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>
0
Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

 

Author Comment

by:zzargo
ID: 21769532
Hi there,

still doesn't seem to work (give it a try yourself with the new code)
0
 
LVL 15

Expert Comment

by:dosth
ID: 21769791
it works, can you tell me where you edited the search form?

please create a test.html page and add the below code
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
 
<body>
<form method="get" id="searchform" action="http://www.acqyr.com/Positive_Affirmations/index.php">
<div><input type="text" value="" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>
</body>
</html>

Open in new window

0
 

Author Comment

by:zzargo
ID: 21769828
I understand that it should work... but try doing the search yourself on the site to see what I mean. It doesn't append the /index.php to it.

This is a Wordpress install. I put the code in the searchform.php file in the Theme directory.

/wp-content/themes/default/searchform.php
0
 
LVL 15

Expert Comment

by:dosth
ID: 21770053
modify the searchformp.php

with this code

<form method="get" id="searchform" action="http://www.acqyr.com/Positive_Affirmations/index.php">
<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>

if you add this i am able to see this in view source
0
 

Author Comment

by:zzargo
ID: 21770382
That's what I mean... it's there! Identical to what you have pasted.

I have that in the file, but for some reason it's not showing it in the source for me either.

Is there another location that the searchform.php file is called in Wordpress? I don't understand why this doesn't work!
0
 
LVL 15

Expert Comment

by:dosth
ID: 21770499
ohhhhhhhhh

you are using the default theme only and modifying the searchformp.php page right

just for testing can you rename this page and test
0
 

Author Comment

by:zzargo
ID: 21770647
I renamed it... and it still seems to function but incorrectly... how the heck does that even still work!? It must not be used at all!

Any ideas?
0
 

Author Comment

by:zzargo
ID: 21770671
HMm... it's using the Search widget within the "presentation > widget" area of Wordpress
0
 
LVL 15

Expert Comment

by:dosth
ID: 21770710
then it is refereing to wrong theme, if i rename searchform.php i get error so it is some thing with theme, please check what theme you have selected

include(/home/fms/public_html/wp-content/themes/default/searchform.php) [function.include]: failed to open stream: No such file or directory in /home/fmspublic_html/wp-content/themes/default/sidebar.php on line 6

Warning: include() [function.include]: Failed opening '/home/fms/public_html/wp-content/themes/default/searchform.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/fms/public_html/wp-content/themes/default/sidebar.php on line 6
0
 

Author Comment

by:zzargo
ID: 21770856
No, it is using the right theme.

The problem is that it is using the Search widget, as explained above... and the search widget doesn't reference the searchform.php file at all.

How can I adjust that?
0
 
LVL 15

Accepted Solution

by:
dosth earned 2000 total points
ID: 21771073
please check here
/public_html/wp-includes/widgets.php
line 438

function wp_widget_search
0
 

Author Comment

by:zzargo
ID: 21771141
YES! Thank you! It was actually on line 411 for me... i added the /index.php to it:

            <form id="searchform" method="get" action="<?php bloginfo('home'); ?>/index.php">
                  <div>
                  <input type="text" name="s" id="s" size="15" /><br />
                  <input type="submit" value="<?php echo attribute_escape(__('Search')); ?>" />
                  </div>
                  </form>

And it works!!

Awesome, thanks so much for taking so much time with this! :)
0
 
LVL 15

Expert Comment

by:dosth
ID: 21771185
glad to help and learn
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question