Ticket #5567 (closed enhancement: fixed)

Opened 11 months ago

Last modified 5 months ago

Search widget doesn't use searchform.php

Reported by: Pixelstyle Assigned to: ionfish
Priority: normal Milestone: 2.6
Component: Template Version: 2.3.2
Severity: normal Keywords: search widget has-patch tested
Cc:

Description

The search widget doesn't use rthe standard searchform.php

I've found two tickets about the search widget, but none of them suggests the most logical solution to the probnlem, namely to make the widget use searchform.php.

It might be that this is a conscious choice because not all themes have a searchform.php. But then it would be logical to make it an option on the search widget option button (use searchform.php: tickbox).

Attachments

search-widget.diff (0.9 kB) - added by DerFichtl on 01/04/08 14:50:08.
searchwidget.diff (0.9 kB) - added by ionfish on 01/23/08 16:09:10.
Same as above but diffed from WP root for convenience.
searchwidget-2.diff (0.9 kB) - added by ionfish on 02/05/08 14:26:19.
searchwidget-3.diff (1.1 kB) - added by ionfish on 06/24/08 12:43:59.

Change History

01/02/08 11:46:12 changed by ionfish

  • keywords changed from search, widget to search, widget, needs-patch.

+1

The default theme has a searchform.php which the widget should default to if the current theme has no searchform.php file.

01/02/08 17:51:17 changed by lloydbudd

  • milestone changed from 2.4 to 2.5.

No patch, milestone defaults to current+1.

01/04/08 14:26:53 changed by DerFichtl

  • owner changed from anonymous to DerFichtl.

01/04/08 14:50:08 changed by DerFichtl

  • attachment search-widget.diff added.

01/04/08 15:04:32 changed by DerFichtl

  • keywords changed from search, widget, needs-patch to search, widget, needs-patch, has-patch, needs-testing.

01/06/08 21:28:53 changed by ffemtcj

  • keywords changed from search, widget, needs-patch, has-patch, needs-testing to search widget has-patch needs-testing.

01/23/08 16:06:25 changed by ionfish

  • keywords changed from search widget has-patch needs-testing to search widget has-patch tested.
  • milestone changed from 2.6 to 2.5.

Works fine for me, both with a theme's searchform.php and with the default one when the theme has no searchform.php file.

01/23/08 16:09:10 changed by ionfish

  • attachment searchwidget.diff added.

Same as above but diffed from WP root for convenience.

02/05/08 14:26:19 changed by ionfish

  • attachment searchwidget-2.diff added.

02/05/08 14:27:48 changed by ionfish

  • owner changed from DerFichtl to ionfish.

Attached an improved patch which doesn't reveal the origin of the search form publicly and has more WordPressy? syntax.

02/08/08 21:25:13 changed by Otto42

+1 to this, however it would be nice if the default search box had an id of "searchsubmit" on the submit button.

<input type="submit" id="searchsubmit" value="<?php echo attribute_escape(__('Search')); ?>" />

This is in line with the existing searchform.php file in the default theme, and makes styling of the submit button possible.

02/08/08 21:38:46 changed by ionfish

Sorry Otto, I'm not sure I follow. The patch makes the search widget use either the theme's searchform.php or the default theme's searchform.php if the theme doesn't have one. If the default theme's searchform.php has an id of "searchsubmit" then search widgets will get that simply in virtue of them using the same source file.

02/13/08 17:28:23 changed by ionfish

  • status changed from new to assigned.

Any more comments or a chance of getting this in for 2.5?

03/10/08 00:44:16 changed by ionfish

  • milestone changed from 2.5 to 2.6.

Bumping to 2.6.

05/02/08 19:45:37 changed by Otto42

  • milestone changed from 2.6 to 2.5.2.

Any chance of this getting into 2.5.2 already?

05/19/08 20:58:40 changed by JohnLamansky

+1 for getting this into 2.5.2

(follow-up: ↓ 15 ) 06/23/08 16:50:15 changed by ryan

It's not uncommon for people to delete the default theme. If the current theme doesn't supply a search form, let's just emit one and forgo looking at the default theme.

(in reply to: ↑ 14 ) 06/23/08 16:53:52 changed by Otto42

Replying to ryan:

It's not uncommon for people to delete the default theme. If the current theme doesn't supply a search form, let's just emit one and forgo looking at the default theme.

There's several places in the core code where it looks at the default theme for stuff like this. I refer you to get_header, get_footer, get_sidebar...

We often say on the support forums that deleting the default theme is not recommended because of that fact.

And quite frankly, I think that it *is* uncommon for people to delete the default theme.

So I'm going to go with leaving it to look for one in the default theme directory, because of all those reasons.

06/23/08 17:24:32 changed by ryan

With the advent of WP_CONTENT_DIR, it will become more common. I don't have the default theme in my WP_CONTENT_DIR.

get_header() and friends have the advantage that a theme almost never calls them if it doesn't also supply the corresponding files. The same cannot be said for a widget.

06/24/08 12:31:41 changed by ionfish

  • milestone changed from 2.5.2 to 2.6.

Updated patch reflecting Ryan's point attached.

06/24/08 12:43:59 changed by ionfish

  • attachment searchwidget-3.diff added.

07/03/08 17:03:37 changed by ryan

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [8250]) Use searchform.php for search widget, if available. Props ionfish. fixes #5567