add_action( 'wp_login_failed', 'my_front_end_login_fail' ); // hook failed login
function my_front_end_login_fail( $username ) {
$referrer = $_SERVER['HTTP_REFERER']; // where did the post submission come from?
// if there's a valid referrer, and it's not the default log-in screen
if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) {
wp_redirect( $referrer . '?login=failed' ); // let's append some information (login=failed) to the URL for the theme to use
exit;
}
}
function wwoofhawaii_form_alter(&$form, &$form_state, $form_id) {
global $base_url;
if ($form_id == ‘search_block_form’) {
$form[‘search_block_form’][‘#title’] = t(‘Search’); // Change the text on the label element
$form[‘search_block_form’][‘#title_display’] = ‘invisible’; // Toggle label visibilty
$form[‘search_block_form’][‘#size’] = 40; // define size of the textfield
$form[‘search_block_form’][‘#default_value’] = t(‘Search’); // Set a default value for the textfield
//$form[‘actions’][‘submit’][‘#value’] = t(‘GO!’); // Change the text on the submit button
$form[‘actions’][‘submit’] = array(‘#type’ => ‘image_button’, ‘#src’ => $base_url.’/’.path_to_theme() . ‘/images/search-icon.png’);// Add extra attributes to the text box
// Add extra attributes to the text box
$form[‘search_block_form’][‘#attributes’][‘onblur’] = “if (this.value == ”) {this.value = ‘Search’;}”;
$form[‘search_block_form’][‘#attributes’][‘onfocus’] = “if (this.value == ‘Search’) {this.value = ”;}”;
// Prevent user from searching the default text
$form[‘#attributes’][‘onsubmit’] = “if(this.search_block_form.value==’Search’){ alert(‘Please enter a search’); return false; }”;
// Alternative (HTML5) placeholder attribute instead of using the javascript
$form[‘search_block_form’][‘#attributes’][‘placeholder’] = t(‘Search’);