I’m currently designing a site with a custom dropdown login, see here:
The login script wasn’t developed by me and I suspect it isn’t entirely correct, looking at it it’s supposed to have error processing however when I mistype a username or password it takes me to the standard wordpress login page and processes the error there.
Can anyone point me in the right direction in terms of proessing the error on the dropdown instead of re-directing to the standard wordpress login? This is the current code:
<fieldset id="signin_menu">
<?php if (is_user_logged_in()) {
$user = get_user_by('id', get_current_user_id());
if ( $logged_in_title ) echo $before_title . sprintf( $logged_in_title, ucwords($user->display_name) ) . $after_title;
do_action('woocommerce_login_widget_logged_in_before_links');
$links = apply_filters( 'woocommerce_login_widget_logged_in_links', array(
__('My account', 'woocommerce') => get_permalink(woocommerce_get_page_id('myaccount')),
__('Change my password', 'woocommerce') => get_permalink(woocommerce_get_page_id('change_password')),
__('Logout', 'woocommerce') => wp_logout_url(home_url())
));
if (sizeof($links>0)) :
echo '<div style="padding-left:10px">';
foreach ($links as $name => $link) :
echo '<a href="'.$link.'">'.$name.'</a><br>';
endforeach;
echo '</div>';
endif;
do_action('woocommerce_login_widget_logged_in_after_links');
} else {
if ( $logged_out_title ) echo $before_title . $logged_out_title . $after_title;
do_action('woocommerce_login_widget_logged_out_before_form');
global $login_errors;
if ( is_wp_error($login_errors) && $login_errors->get_error_code() ) foreach ($login_errors->get_error_messages() as $error) :
echo '<div class="woocommerce_error">' . $error . "</div>n";
break;
endforeach;
// Get redirect URL
$redirect_to = apply_filters( 'woocommerce_login_widget_redirect', get_permalink(woocommerce_get_page_id('myaccount')) );
} ?>
/test/wp-login.php” method=”post”>
Username
Password
Remember me
” id=forgot_username_link
title=”If you don’t remember your password you can retrive it here” >Forgot your password?