WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] General template - WP_login_form | hebrew on form (5 posts)

  1. Yakir
    Member
    Posted 4 years ago #

    Hi,

    Iv'e been messing around with the function wp_login_form in order to place my login in the header.

    I've done a small number of cosmetic changes.
    (see http://shipudim.com)

    Anyway,
    As my site is in hebrew, I want the value of the fields to be in hebrew. yet when I change the array:

    'redirect' => site_url( $_SERVER['REQUEST_URI'] ), // Default redirect is back to the current page
    	 					'form_id' => 'loginform',
    						'label_username' => __( '' ),
    						'label_password' => __( '' ),
    						'label_remember' => __( 'זכור אותי' ),
    						'label_log_in' => __( 'Log In' ),
    						'id_username' => 'user_login',
    						'id_password' => 'user_pass',
    						'id_remember' => 'rememberme',
    						'id_submit' => 'wp-submit',
    						'remember' => true,
    						'value_username' => 'שם משתמש',
    						'value_remember' => false, // Set this to true to default the "Remember me" checkbox to checked

    It somehow cancels hebrew values.
    the זכור אותי and the שם משתמש .

    Ive tried putting it directly, like so:
    <input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="שם משתמש'. esc_attr( $args['value_username'] ) . '" size="10" tabindex="0" onfocus="this.value=\'\'" />
    but then It goes out bad (squares and question marks).

    is it not utf-8 or something (the site as a all is, as there is hebrew).

    Thanks for every answer.

  2. Yakir
    Member
    Posted 4 years ago #

    since im already deep into the second page....

    bump.

  3. Yakir
    Member
    Posted 4 years ago #

    beep

  4. Yakir
    Member
    Posted 4 years ago #

    function wp_login_form( $args = array() ) {
    
    	$defaults = array( 'echo' => true,
    						'redirect' => site_url( $_SERVER['REQUEST_URI'] ), // Default redirect is back to the current page
    	 					'form_id' => 'loginform',
    						'label_username' => '',
    						'label_password' => '',
    						'label_remember' => __( 'Remember Me' ),
    						'label_log_in' => __( 'Log In' ),
    						'id_username' => 'user_login',
    						'id_password' => 'user_pass',
    						'id_remember' => 'rememberme',
    						'id_submit' => 'wp-submit',
    						'remember' => true,
    						'value_username' => __( 'Username' ),
    						'value_remember' => false, // Set this to true to default the "Remember me" checkbox to checked
    					);
    	$args = wp_parse_args( $args, apply_filters( 'login_form_defaults', $defaults ) );
    
    	$form = '
    		<form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . site_url( 'wp-login.php', 'login' ) . '" method="post">
    			' . apply_filters( 'login_form_top', '' ) . '
    
    				<label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label>
    				<input type="text"   name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="'.  esc_attr( $args['value_username'] ) . '" size="10" tabindex="0" onfocus="this.value=\'\'" />
    
    			<label for="' . esc_attr( $args['id_password'] ) . '">' . esc_html( $args['label_password'] ) . '</label>
    				<input type="password"  name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" value="סיסמא" size="10" tabindex="0" onfocus="this.value=\'\'"/>
    
    			' . apply_filters( 'login_form_middle', '' ) . '
    			' . ( $args['remember'] ? '<label><input name="rememberme" type="checkbox" id="' . esc_attr( $args['id_remember'] ) . '" value="forever" tabindex="90"' . ( $args['value_remember'] ? ' checked="checked"' : '' ) . ' /> ' . esc_html( $args['label_remember'] ) . '</label>' : '' ) . '
    
    				<input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" tabindex="100" />
    				<input type="hidden" name="redirect_to" value="' . esc_attr( $args['redirect'] ) . '" />
    
    			' . apply_filters( 'login_form_bottom', '' ) . '
    		</form>';
    
    	if ( $args['echo'] )
    		echo $form;
    	else
    		return $form;
    }

    Code added for future reference.
    In order for this to work you must have hebrew wordpress installed.

    HTML + php s**ks :(

    any way, it works.

  5. yonitg
    Member
    Posted 3 years ago #

    Hi Yakir,
    did you get the registration to work with the hewbrew user name?

Topic Closed

This topic has been closed to new replies.

About this Topic