Advertisements

language_attributes

Definition:
function language_attributes($doctype = 'html') {}

Display the language attributes for the html tag.
Builds up a set of html attributes containing the text direction and language information for the page.

Parameters

  • string $doctype: The type of html document (xhtml|html).

Defined filters

  • language_attributes
    apply_filters('language_attributes', $output)

Source code

function language_attributes($doctype = 'html') {

	$attributes = array();

	$output = '';



	if ( function_exists( 'is_rtl' ) )

		$attributes[] = 'dir="' . ( is_rtl() ? 'rtl' : 'ltr' ) . '"';



	if ( $lang = get_bloginfo('language') ) {

		if ( get_option('html_type') == 'text/html' || $doctype == 'html' )

			$attributes[] = "lang=\"$lang\"";



		if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )

			$attributes[] = "xml:lang=\"$lang\"";

	}



	$output = implode(' ', $attributes);

	$output = apply_filters('language_attributes', $output);

	echo $output;

}

2241

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: