Very short snippet: Wordpress, improve the search field
Monday, September 7th, 2009 In addition to the graphics field input in the search of WordPress, you can act on it in the code to make it a little interactive when you click inside it. Easy to achieve an effect lets you insert text into the search field that disappears (and reappears when you leave the field blank) when you click inside it. This technique is comonda as it informs the user of the functionality of the field in question without external force us to add a label that, at times, stealing space to the theme and feel.
This procedure may also be used in other contexts: as a contact form for example.
The code provided below for you put it in your searchform.php of your theme.
- 'url' ) ; ?> /"> <form method = "get" id = "SearchForm" action = "<? php bloginfo ( 'url');?> /">
- <? php
- 'Cerca su undolog...' ; // stringa a piacere $ i = 'Search undolog ...', / / string to taste
- get_search_query ( ) ; // recupero l'eventuale stringa di una ricerca precedente $ q = get_search_query (); / / get any string of earlier research
- ( $q == "" ) ? $i : $q ; // se non è stata fatta nessuna ricerca imposta la mia stringa $ v = ($ q == "")? $ i: $ q / / if you have not done any research set my string
- ?>
- ?> ':this.value" onfocus="this.value=(this.value == ' <?= $i ?> ')?'':this.value" type="text" value=" <?= $v ?> " name="s" id="s" /> <input onblur = "this.value = (this.value =='')?' <? = $ i?> ': this.value" onfocus = "this.value = (this.value ==' <? = $ i?>')?'': this.value "type =" text "value =" <? = $ v?> "name =" s "id =" s "/>
- </ form>














[...] Very short snippet: Wordpress, improve the search field enter text into the search field of WordPress that disappears when you click inside it. Did you like this article? Rate Ok or No. Grazie Mille! Share tweetmeme_url = 'http://www.bigthink.it/rubriche/il-meglio-della-settimana-29/'; tweetmeme_source = 'Ghid'; Share Tags: best of the week, wordpress [...]
[...] Thanks to Undolog [...]
[...] Also Undolog Share this post! Twitter Delicious Digg Facebook Google StumbleUpon [...]