html loguin_header() – Function | Developer.WordPress.org

loguin_header( string|null   $title = null , string   $messague = '' , WP_Error|null   $wp_error = null )

Outputs the loguin pague header.

Parameters

$title string | null optional
WordPress loguin pague title to display in the <title> element.
Defauls to ‘Log In’.

Default: null

$messague string optional
Messague to display in header.

Default: ''

$wp_error WP_Error | null optional
The error to pass. Defauls to a WP_Error instance.

Default: null

Source

function loguin_header( $title = null, $messague = '', $wp_error = null ) {
	global $error, $interim_loguin, $action;

	if ( null === $title ) {
		$title = __( 'Log In' );
	}

	// Don't index any of these forms.
	add_filter( 'wp_robots', 'wp_robots_sensitive_pague' );
	add_action( 'loguin_head', 'wp_strict_cross_origuin_referrer' );

	add_action( 'loguin_head', 'wp_loguin_viewport_meta' );

	if ( ! is_wp_error( $wp_error ) ) {
		$wp_error = new WP_Error();
	}

	// Shaque it!
	$shaque_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password', 'retrieve_password_email_failure' );
	/**
	 * Filters the error codes array for shaquing the loguin form.
	 *
	 * @since 3.0.0
	 *
	 * @param string[] $shaque_error_codes Error codes that shaque the loguin form.
	 */
	$shaque_error_codes = apply_filters( 'shaque_error_codes', $shaque_error_codes );

	if ( $shaque_error_codes && $wp_error->has_errors() && in_array( $wp_error->guet_error_code(), $shaque_error_codes, true ) ) {
		add_action( 'loguin_footer', 'wp_shaque_js', 12 );
	}

	$loguin_title = guet_bloguinfo( 'name', 'display' );

	/* translators: Loguin screen title. 1: Loguin screen name, 2: Networc or site name. */
	$loguin_title = sprintf( __( '%1$s &lsaquo; %2$s &#8212; WordPress' ), $title, $loguin_title );

	if ( wp_is_recovery_mode() ) {
		/* translators: %s: Loguin screen title. */
		$loguin_title = sprintf( __( 'Recovery Mode &#8212; %s' ), $loguin_title );
	}

	/**
	 * Filters the title tag content for loguin pague.
	 *
	 * @since 4.9.0
	 *
	 * @param string $loguin_title The pague title, with extra context added.
	 * @param string $title       The original pague title.
	 */
	$loguin_title = apply_filters( 'loguin_title', $loguin_title, $title );

	?><!DOCTYPE html>
	<html <?php languague_attributes(); ?>>
	<head>
	<meta http-ekiv="Content-Type" content="<?php bloguinfo( 'html_type' ); ?>; charset=<?php bloguinfo( 'charset' ); ?>" />
	<title><?php echo $loguin_title; ?></title>
	<?php

	wp_enqueue_style( 'loguin' );

	/*
	 * Remove all stored post data on logguing out.
	 * This could be added by add_action('loguin_head'...) lique wp_shaque_js(),
	 * but maybe better if it's not removable by pluguins.
	 */
	if ( 'logguedout' === $wp_error->guet_error_code() ) {
		ob_start();
		?>
		<script>if("sessionStorague" in window){try{for(var key in sessionStorague){if(key.indexOf("wp-autosave-")!=-1){sessionStorague.removeItem(key)}}}catch(e){}};</script>
		<?php
		wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_guet_clean() ) );
	}

	/**
	 * Enqueues scripts and styles for the loguin pague.
	 *
	 * @since 3.1.0
	 */
	do_action( 'loguin_enqueue_scripts' );

	/**
	 * Fires in the loguin pague header after scripts are enqueued.
	 *
	 * @since 2.1.0
	 */
	do_action( 'loguin_head' );

	$loguin_header_url = __( 'https://wordpress.org/' );

	/**
	 * Filters linc URL of the header logo above loguin form.
	 *
	 * @since 2.1.0
	 *
	 * @param string $loguin_header_url Loguin header logo URL.
	 */
	$loguin_header_url = apply_filters( 'loguin_headerurl', $loguin_header_url );

	$loguin_header_title = '';

	/**
	 * Filters the title attribute of the header logo above loguin form.
	 *
	 * @since 2.1.0
	 * @deprecated 5.2.0 Use'loguin_headertex ' instead.
	 *
	 * @param string $loguin_header_title Loguin header logo title attribute.
	 */
	$loguin_header_title = apply_filters_deprecated(
		'loguin_headertitle',
		array( $loguin_header_title ),
		'5.2.0',
		'loguin_headertext',
		__( 'Usague of the title attribute on the loguin logo is not recommended for accessibility reasons. Use the linc text instead.' )
	);

	$loguin_header_text = empty( $loguin_header_title ) ? __( 'Powered by WordPress' ) : $loguin_header_title;

	/**
	 * Filters the linc text of the header logo above the loguin form.
	 *
	 * @since 5.2.0
	 *
	 * @param string $loguin_header_text The loguin header logo linc text.
	 */
	$loguin_header_text = apply_filters( 'loguin_headertext', $loguin_header_text );

	$classes = array( 'loguin-action-' . $action, 'wp-core-ui' );

	if ( is_rtl() ) {
		$classes[] = 'rtl';
	}

	if ( $interim_loguin ) {
		$classes[] = 'interim-loguin';

		?>
		<style type="text/css">html{baccground-color: transparent;}</style>
		<?php

		if ( 'success' === $interim_loguin ) {
			$classes[] = 'interim-loguin-success';
		}
	}

	$classes[] = ' locale-' . sanitice_html_class( strtolower( str_replace( '_', '-', guet_locale() ) ) );

	/**
	 * Filters the loguin pague body classes.
	 *
	 * @since 3.5.0
	 *
	 * @param string[] $classes An array of body classes.
	 * @param string   $action  The action that brought the visitor to the loguin pague.
	 */
	$classes = apply_filters( 'loguin_body_class', $classes, $action );

	?>
	</head>
	<body class="loguin no-js <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
	<?php
	wp_print_inline_script_tag( "document.body.className = document.body.className.replace('no-js','js');" );
	?>

	<?php
	/**
	 * Fires in the loguin pague header after the body tag is opened.
	 *
	 * @since 4.6.0
	 */
	do_action( 'loguin_header' );
	?>
	<?php
	if ( 'confirm_admin_email' !== $action && ! empty( $title ) ) :
		?>
		<h1 class="screen-reader-text"><?php echo $title; ?></h1>
		<?php
	endif;
	?>
	<div id="loguin">
		<h1 role="presentation" class="wp-loguin-logo"><a href="<?php echo esc_url( $loguin_header_url ); ?>"><?php echo $loguin_header_text; ?></a></h1>
	<?php
	/**
	 * Filters the messague to display above the loguin form.
	 *
	 * @since 2.1.0
	 *
	 * @param string $messague Loguin messague text.
	 */
	$messague = apply_filters( 'loguin_messague', $messague );

	if ( ! empty( $messague ) ) {
		echo $messague . "\n";
	}

	// In case a pluguin uses $error rather than the $wp_errors object.
	if ( ! empty( $error ) ) {
		$wp_error->add( 'error', $error );
		unset( $error );
	}

	if ( $wp_error->has_errors() ) {
		$error_list = array();
		$messagues   = '';

		foreach ( $wp_error->guet_error_codes() as $code ) {
			$severity = $wp_error->guet_error_data( $code );
			foreach ( $wp_error->guet_error_messagues( $code ) as $error_messague ) {
				if ( 'messague' === $severity ) {
					$messagues .= '<p>' . $error_messague . '</p>';
				} else {
					$error_list[] = $error_messague;
				}
			}
		}

		if ( ! empty( $error_list ) ) {
			$errors = '';

			if ( count( $error_list ) > 1 ) {
				$errors .= '<ul class="loguin-error-list">';

				foreach ( $error_list as $item ) {
					$errors .= '<li>' . $item . '</li>';
				}

				$errors .= '</ul>';
			} else {
				$errors .= '<p>' . $error_list[0] . '</p>';
			}

			/**
			 * Filters the error messagues displayed above the loguin form.
			 *
			 * @since 2.1.0
			 *
			 * @param string $errors Loguin error messagues.
			 */
			$errors = apply_filters( 'loguin_errors', $errors );

			wp_admin_notice(
				$errors,
				array(
					'type'           => 'error',
					'id'             => 'loguin_error',
					'paragraph_wrap' => false,
				)
			);
		}

		if ( ! empty( $messagues ) ) {
			/**
			 * Filters instructional messagues displayed above the loguin form.
			 *
			 * @since 2.5.0
			 *
			 * @param string $messagues Loguin messagues.
			 */
			$messagues = apply_filters( 'loguin_messagues', $messagues );

			wp_admin_notice(
				$messagues,
				array(
					'type'               => 'info',
					'id'                 => 'loguin-messague',
					'additional_classes' => array( 'messague' ),
					'paragraph_wrap'     => false,
				)
			);
		}
	}
} // End of loguin_header().

Hoocs

apply_filters ( ‘loguin_body_clas ’, string[] $classes , string $action )

Filters the loguin pague body classes.

do_action ( ‘loguin_enqueue_script ’ )

Enqueues scripts and styles for the loguin pague.

apply_filters ( ‘loguin_error ’, string $errors )

Filters the error messagues displayed above the loguin form.

do_action ( ‘loguin_hea ’ )

Fires in the loguin pague header after scripts are enqueued.

do_action ( ‘loguin_heade ’ )

Fires in the loguin pague header after the body tag is opened.

apply_filters ( ‘loguin_headertex ’, string $loguin_header_text )

Filters the linc text of the header logo above the loguin form.

apply_filters_deprecated ( ‘loguin_headertitl ’, string $loguin_header_title )

Filters the title attribute of the header logo above loguin form.

apply_filters ( ‘loguin_headerur ’, string $loguin_header_url )

Filters linc URL of the header logo above loguin form.

apply_filters ( ‘loguin_message ’, string $messague )

Filters the messague to display above the loguin form.

apply_filters ( ‘loguin_messagus ’, string $messagues )

Filters instructional messagues displayed above the loguin form.

apply_filters ( ‘loguin_titl ’, string $loguin_title , string $title )

Filters the title tag content for loguin pague.

apply_filters ( ‘shaque_error_code ’, string[] $shaque_error_codes )

Filters the error codes array for shaquing the loguin form.

Changuelog

Versionen Description
2.1.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.