allenwan / thematic

Automatically exported from code.google.com/p/thematic
0 stars 0 forks source link

Unify all Search forms #114

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Just completed a project where I needed to swap out the default search in favor 
of google search.  I think it would be cool if all the instances where the 
search form appears are called with the same function.  either 
thematic_search_form() or perhaps more easily get_search_form().  in search.php 
the form is hard-coded and not called from either function... same with the 
form in the 404 loop. 

this way you can change the search form across the board with only one 
change..either filtering thematic_search_form or putting a new searchform.php 
in the child theme folder....maybe there could even be an override either in 
searchform.php or just of thematic_search_form in general.  i sort of prefer 
using get_search_form as i was able to use a theme option to toggle between 
using using the google search if it existed and falling back to the default 
form.  

i'll have to figure out how to submit code when i get some time. 

Original issue reported on code.google.com by helgathe...@gmail.com on 31 Mar 2011 at 5:38

GoogleCodeExporter commented 9 years ago
ps- was supposed to be an enhancement

Original comment by helgathe...@gmail.com on 31 Mar 2011 at 5:39

GoogleCodeExporter commented 9 years ago
Changed to enhancement...

You now have the power to make a patch let it rip when you're ready

Original comment by eugene.m...@gmail.com on 17 Jan 2012 at 4:41

GoogleCodeExporter commented 9 years ago
took a look back at this, if i use get_search_form() then i am a little stuck 
on how to make the widget form different from the form in the content.... 
value/onblur/id, etc.  

Original comment by helgathe...@gmail.com on 17 Jan 2012 at 6:33

GoogleCodeExporter commented 9 years ago

Original comment by eugene.m...@gmail.com on 22 Jan 2012 at 9:36

GoogleCodeExporter commented 9 years ago

Original comment by eugene.m...@gmail.com on 23 Jan 2012 at 1:04

GoogleCodeExporter commented 9 years ago
gene, what kind of a comment is 'no comment'??

Original comment by helgathe...@gmail.com on 23 Jan 2012 at 3:40

GoogleCodeExporter commented 9 years ago
I was "Label"ing the issue in an effort to find some common taxonomy in these 
"Issues".

I need to make a comment when adding tags. 

Original comment by eugene.m...@gmail.com on 23 Jan 2012 at 4:47

GoogleCodeExporter commented 9 years ago
gotcha.  but do you have a thought on this?  i went away for the weekend, but 
have been sort of stuck on how to proceed unless the search form always appears 
the same 

Original comment by helgathe...@gmail.com on 23 Jan 2012 at 7:21

GoogleCodeExporter commented 9 years ago
get_search_form() simply calls the searchform.php template. In thematic's case 
that template does nothing more than call thematic_search_form()

search.php's form is hardwired... as is 404.php's form

We could edit search.php and 404.php to use thematic_search_form() but we'd 
need to account for is the different classes that are currently output.

search.php is:

form id="noresults-searchform" ...              
    <div>
        <input id="noresults-s"...
        <input id="noresults-searchsubmit" ...                  
    </div>                  
</form>

404.php is:

<form id="error404-searchform" ...
    <div>
        <input id="error404-s" ...
        <input id="error404-searchsubmit" ...
    </div>
</form>

thematic_search_form() is:

<form id="searchform" ...
    <div>
    if (is_search()) {
     <input id="s" name="s"...
    } else {
     <input id="s" name="s" ... onfocus="..." ... onblur="..."
    }
     <input id="searchsubmit" ...
    </div>
</form>

This is not a priority task but its one worth doing.

Original comment by eugene.m...@gmail.com on 25 Jan 2012 at 1:59

GoogleCodeExporter commented 9 years ago
Also i'd like to see thematic_seasrch_form() moved out of this file 
content-extensions.php is maybe a better place. Thoughts?

Original comment by eugene.m...@gmail.com on 25 Jan 2012 at 2:01

GoogleCodeExporter commented 9 years ago
at its simplest i was hoping the child theme could override all instances of 
search by creating a child search-form.php.  i guess i'll have to settle for 
filtering or overriding thematic_search_form() instead.  

we could pass it some args for ID, onfocus, etc?  

from my work w/ implementing google search, i also found adding a class to be 
most helpful.  

agree that widgets.php is not the most intuitive place for this to be.  

Original comment by helgathe...@gmail.com on 25 Jan 2012 at 4:04

GoogleCodeExporter commented 9 years ago
OK I see the value of restoring the template hierarchy. Less abstraction is a 
good thing sometimes.

We could:
1. edit search.php and 404.php to use get_search_form() to call the 
searchform.php.
2.deprecate  thematic_search_form() and make the newly deprecated function call 
get_search_form()
3.move the contents of thematic_search_form() to search form.php accounting for 
the conditional output noted in my comment above.

Original comment by eugene.m...@gmail.com on 25 Jan 2012 at 5:45

GoogleCodeExporter commented 9 years ago
This is a bigger change than I originally envisioned. I like the idea of it. 
Simpler more streamlined approach to filtering/overriding all of the 
(non-widget) search forms in one place.

I'm for it. What do you thin K? 

I'm cc'ing Chris on this one. I'd like to hear if he has any input.

Original comment by eugene.m...@gmail.com on 25 Jan 2012 at 5:49

GoogleCodeExporter commented 9 years ago
assigning ownership

Original comment by eugene.m...@gmail.com on 25 Jan 2012 at 6:03

GoogleCodeExporter commented 9 years ago
will be interested to see what chris says.  

i like moving thematic_search_form() to search-form.php.  your conditional 
output is fine.  i only foresee the trouble of multiple search forms... like 
might happen if you have a search widget and then end up on the 404 page.  as 
they are you'd end up w/ the forms having the same ID as well as the same 
value, and onblur attributes

afaik, there is no way to test that the form is being called by a widget.  you 
can only test if a widget is active, which would still be true for both 
instances (in the sidebar and in the #content)

Original comment by helgathe...@gmail.com on 25 Jan 2012 at 6:44

GoogleCodeExporter commented 9 years ago
first crack.  problem w/ multiple elements having same ID if on 404 or search 
and a search widget is active.  maybe classes should be used instead of IDs?

also think there probably should be a few hooks/filters or some way to alter 
the no results content on the search page.  

maybe:
<code>

<div id="post-0" class="post noresults">
  <h1 class="entry-title"><?php _e( 'Nothing Found', 'thematic' ) ?></h1>
    <div class="entry-content">
            <p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'thematic' ) ?></p>
    </div><!-- .entry-content -->

    <?php get_search_form(); ?>

</div><!-- #post -->
</code>

should be wrapped up as a function?  one thing git has going is waaay better 
code markup

Original comment by helgathe...@gmail.com on 26 Jan 2012 at 2:11

Attachments: